Is there a way to use data.frame without it ruining the column names?
I have following structure:
$`Canon PowerShot`
[1] 9.997803e-01 9.997318e-01 3
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))
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)