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

From: Spencer <zhuge99_at_u.washington.edu>
Date: Thu, 24 Jul 2008 13:00:36 -0700

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


______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Received on Thu 24 Jul 2008 - 20:28:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jul 2008 - 21:33:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive