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

2014-05-27 Thread arun
Hi Monaly, According to the description of ?tri2nb The function uses the ‘deldir’ package to convert a matrix of two-dimensional coordinates into a neighbours list of class ‘nb’ with a list of integer vectors containing neighbour region number ids. So, col.tri.nb is a list of leng

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

2014-05-27 Thread Monaly Mistry
Hi Arun, Thank you for your help, I have a few questions though if you don't mind. I'm a bit confused about the following 2 lines of code: col.tri.nb <- tri2nb(coords, row.names=ind) lapply(col.tri.nb,function(x) ind[x])[1:5] ## from what I understand in the first line determines the neighbourin

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

2014-05-23 Thread arun
Hi, Sorry, there is a mistake. XO[2,] should be: XO[2,] <-  sapply(seq_along(col.tri.nb), function(i){ind1 <- as.character(ind[i]); ind2 <- as.character(ind[col.tri.nb[[i]]]); mean(abs(XO[1,ind1]-XO[1,ind2]))} ) A.K. On Friday, May 23, 2014 12:56 PM, arun wrote: Hi Monaly, May be this hel

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

2014-05-23 Thread arun
uot;91")])) >> > > XO["avg", "94"]<- >> > mean(abs((XO[1,"94"])-XO[1,c("73","54","95","93","185")])) >> > > XO["avg", "163"]<- >> > mean(abs((XO[1,"163"

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

2014-05-23 Thread Monaly Mistry
"latitude (m)", ylab="longitude (m)", wpoints="real", verbose=FALSE,num=TRUE, rw=c(0, 1200, 0, 2000)) text(ao$lat_xm, ao$long_ym,col=c(2,1,4),labels=round(ao$NestkastNummer, 3), pos=2, offset=0.2, cex=0.7) #this was to identify the points On Fri, May 23, 2

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

2014-05-23 Thread Frede Aakmann Tøgersen
])-XO[1,c("176","140","133","163")])) > > > XO["avg", "15"]<- mean(abs((XO[1,"15"])-XO[1,c("16","19","14")])) > > > XO["avg", "60"]<- mean(abs((XO[1,"60&qu

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

2014-05-23 Thread Monaly Mistry
uot;,"97","90","84","82","81")])) > > XO["avg", "31"]<- mean(abs((XO[1,"31"])-XO[1,c("2","3","36","35","34")])) > > XO["avg", "73"]<- mean

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

2014-05-22 Thread Monaly Mistry
quot;64"]<- mean(abs((XO[1,"64"])-XO[1,c("113","62","128","124")])) > XO["avg", "74"]<- mean(abs((XO[1,"74"])-XO[1,c("51","73","185")])) > XO["avg", "95"]<

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

2014-05-22 Thread Monaly Mistry
XO["avg", "36"]<- mean(abs((XO[1,"36"])-XO[1,c("28","38","86","709","707","35","3")])) XO["avg", "80"]<- mean(abs((XO[1,"80"])-XO[1,c("42","79&quo

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

2014-05-22 Thread Bert Gunter
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 wrote: > Hi,

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

2014-05-22 Thread Monaly Mistry
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 wrote: > Hi, > > It would be helpful if you provide a reproducible example using ?dput(). > >

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

2014-05-22 Thread Monaly Mistry
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