data.frame without ruining column names
Solution 1:
You can stop R
changing the names to syntatically valid names by setting check.names = FALSE
. See ?data.frame
for details.
# assuming your data is in a list called my_list
do.call(data.frame, c(my_list, check.names = FALSE))
Solution 2:
data.frames in R are actually lists. Therefore, this is also valid:
data.frame(my_list, check.names = FALSE)
Knowing this opens up the possibilities of using lapply
on data.frames, which I think is pretty cool:
my_data <- data.frame(my_list, check.names = FALSE)
lapply(my_data, IQR)