Description Usage Arguments Author(s) Examples
Some R functionality (I'm thinking mainly of ggplot2) requires the data you are interested in to be packaged in data frames, hence this function.
1 |
object |
an object |
env |
an environment |
... |
passed arguments |
Henrik Renlund
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # combine variables into a data frame
x <- 1:2
y <- letters[1:2]
make_df(c("x","y"))
# 'env' is R_GlobalEnv by default but can be any environment, data frame or list
make_df(c("mpg", "disp"), env=datasets::mtcars)
# methods include 'list' ...
make_df(list(x=1:2, y=letters[1:2]))
# and 'survfit'
if(FALSE){
n <- 50
s <- survival::Surv(rexp(n), rbinom(n,1,0.2))
f <- factor(rep(letters[1:2], length.out=n))
sf <- survival::survfit(s~f)
make_df(sf)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.