search for: sortvars1

Displaying 2 results from an estimated 2 matches for "sortvars1".

2007 Sep 07
2
R first.id last.id function error
...(Lag(file1$id) != file1$id) file1$last.id[1]<-TRUE #force NA to TRUE #resort to original order file1<- file1[order(file1$id,file1$week),] I am now trying to get the above code to work as a function, and am clearly doing something wrong: > first.last <- function (df, idvar, sortvars1, sortvars2) + { + #sort in ascending order to define first dot + df<- df[order(sortvars1),] + df$first.idvar <- (Lag(df$idvar) != df$idvar) + #force first record NA to TRUE + df$first.idvar[1]<-TRUE + + #sort in descending order to define last dot + df<- df[order(-sortva...
2009 Feb 08
0
Modifying forestplot function in rmeta
...id[1]<-TRUE #force NA to TRUE > >#resort to original order >file1<- file1[order(file1$id,file1$week),] > > > >I am now trying to get the above code to work as a function, and am >clearly doing something wrong: > > > first.last <- function (df, idvar, sortvars1, sortvars2) >+ { >+ #sort in ascending order to define first dot >+ df<- df[order(sortvars1),] >+ df$first.idvar <- (Lag(df$idvar) != df$idvar) >+ #force first record NA to TRUE >+ df$first.idvar[1]<-TRUE >+ >+ #sort in descending order to define last...