sorry disreguard

On Thu, Jul 24, 2008 at 4:45 PM, stephen sefick <ssefick@gmail.com> wrote:

> or sapply as I have recently found to be useful.
>
>
> On Thu, Jul 24, 2008 at 4:33 PM, Erik Iverson <iverson@biostat.wisc.edu>
> wrote:
>
>> Spencer -
>>
>> Spencer wrote:
>>
>>>
>>> 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)
>>>
>>
>> You might not want to call it 'data' since 'data' is the name of a
>> function in base R.
>>
>> Also, the usual advice is to avoid attaching data.frames to the search
>> path, for the exact reasons that happen to you below.
>>
>>
>>> 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.
>>>
>>
>> Try typing search() after attaching this to see why.  You may have also
>> seen a message about objects being masked when you used the second 'attach'
>> command; at least I do in my version of R.
>>
>>
>>
>>
>>  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!
>>>
>>
>> Don't use attach.  If you want to do summaries by country, there are many
>> simpler ways.  See ?tapply, ?aggregate, and ?by for instance.
>>
>> Best,
>> Erik
>>
>>
>>>
>>> Spencer
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ______________________________________________
>>> R-help@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.
>>>
>>
>> ______________________________________________
>> R-help@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.
>>
>
>
>
> --
> Let's not spend our time and resources thinking about things that are so
> little or so large that all they really do for us is puff us up and make us
> feel like gods. We are mammals, and have not exhausted the annoying little
> problems of being mammals.
>
> -K. Mullis
>



-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods. We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

	[[alternative HTML version deleted]]

