[R] subsetting to exclude different values for each subject in study

Bert Gunter gunter.berton at gene.com
Thu May 22 17:36:46 CEST 2014


Follow the link at the bottom of this message!

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
H. Gilbert Welch




On Thu, May 22, 2014 at 8:31 AM, Monaly Mistry <monaly.mistry at gmail.com> wrote:
> Hi,
>
> Sorry I'm fairly new to R and I don't really understand using dput(), when
> you say reproducible example do you mean the code with the output?
>
> Best,
>
> Monaly.
>
>
> On Thu, May 22, 2014 at 4:03 PM, arun <smartpink111 at yahoo.com> wrote:
>
>> Hi,
>>
>> It would be helpful if you provide a reproducible example using ?dput().
>>
>> A.K.
>>
>>
>>
>>
>> On Thursday, May 22, 2014 10:15 AM, Monaly Mistry <monaly.mistry at gmail.com>
>> wrote:
>> Hi,
>>
>> I've written a code to determine the difference in score for a single
>> subject and its non-neighbours
>>
>> o<-(ao[,c(13,5)]) ##this is the table with the relevant information
>> o<-na.omit(o)  ##omitted data with NA
>> o<-o[!o$NestkastNummer %in% c(176,140,162,713),] ##removed neighbours
>> XO[7,1]<-abs((XO[1,"176"]-(mean(o[,"COR_LOC"]))))  #difference between that
>> individual and average non-neighbours scores
>>
>> Since each subject has a different number of non-neighbours I was wondering
>> if there is an efficient way of writing the code, instead of writing the
>> same code again and again (76 subjects) for each subject and its
>> non-neighbours.
>>
>>
>> Best,
>>
>> Monaly.
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



More information about the R-help mailing list