Hi Simon,
Let's see. If I wrap the code into a function:
reverse.df.elements<-function(df,pattern="i",newrange=c(3,1)) {
revlist<-grep(pattern,names(df),fixed=TRUE)
df[,revlist]<-sapply(df[,revlist],rescale,newrange)
return(df)
}
Then this might do the trick:
lapply(list1,reverse.df.elements,
Hi Jim, So that does the rescale part very efficiently. But I’d like to know
how to do that on each list element using lapply or llply. I have about 4 data
frames and a few other recodes to do so automating would be nice, rather than
applying your code to each individual list element.
simon
> O
Hi Simon,
How about this?
library(plotrix)
revlist<-grep("i",names(df),fixed=TRUE)
df[,revlist]<-sapply(df[,revlist],rescale,c(3,1))
Jim
On Fri, Apr 3, 2015 at 6:30 AM, Simon Kiss wrote:
> Hi there: I have a list of data frames with identical variable names.
> I’d like to reverse scale the s
3 matches
Mail list logo