I would like to specify the row / column names in functions **ply, ldplyfrom plyr package.
eg,
I have a list foothat I want to convert to data.frameand crop significant digits withsignif()
foo <- list(var.a = runif(3), var.b = runif(3), var.c=runif(3))
Now I have
q <- ldply(foo, signif, 2)
colnames(dq)[1] <- c('id', 'q1', 'q2','q3')
rownames(dq) <- dq$id
Is there an easier way?
The two previous questions asked the question of how to use plyr to rename rows and cols using plyr, but I think my question is different. Can names be specified simultaneously with another function (or if I do it right)? Is this a useful feature request?
source
share