x <- mtcars[1:3, 1:4]
rotate_df(x)
rotate_df(x, rn = "property")
# use values in 1. column as column name
rotate_df(x, cn = TRUE)
rotate_df(x, rn = "property", cn = TRUE)
# also works on list-results
library(purrr)
dat <- mtcars[1:3, 1:4]
tmp <- purrr::map(dat, function(x) {
sdev <- stats::sd(x, na.rm = TRUE)
ulsdev <- mean(x, na.rm = TRUE) + c(-sdev, sdev)
names(ulsdev) <- c("lower_sd", "upper_sd")
ulsdev
})
tmp
as.data.frame(tmp)
rotate_df(tmp)
tmp <- purrr::map_df(dat, function(x) {
sdev <- stats::sd(x, na.rm = TRUE)
ulsdev <- mean(x, na.rm = TRUE) + c(-sdev, sdev)
names(ulsdev) <- c("lower_sd", "upper_sd")
ulsdev
})
tmp
rotate_df(tmp)
Run the code above in your browser using DataLab