[R] Question: how to build a subset to do separate calculations

Spencer zhuge99 at u.washington.edu
Thu Jul 24 22:00:36 CEST 2008


Dear R Experts,

I am trying to create several subsets that I want to use as separate 
datasets. After separate subsets are created for each country, I want to 
do some calculations for each. I did the following:

data <- data.frame(na.omit(read.spss("trial.sav")))

attach (data)

Netherlands <- subset(data, COUNTRY = "NETHERLANDS")
attach(Netherlands)

But after this step, when I check the summary statistics for 
"Netherlands," what returns is the summary for the original dataset. 
I've also tried defining Netherlands as Netherlands <- 
data.frame(subset(data, COUNTRY = "NETHERLANDS")), but get the same result.

Any help would be greatly appreciated!


Spencer

-- 
Spencer Cohen
PhD Student
Department of Geography
University of Washington
Email: zhuge99 at u.washington.edu
Website: staff.washington.edu/zhuge99



More information about the R-help mailing list