r - data.frame without ruining column names -
is there way use data.frame without ruining column names?
i have following structure:
$`canon powershot` [1] 9.997803e-01 9.997318e-01 3.327920e-01 3.327920e-01 9.988220e-01 [6] 4.030871e-05 4.928497e-05 $`casio exilim` [1] 5.322024e-06 9.999646e-01 5.322024e-06 5.322024e-06 9.999646e-01 [6] 5.322024e-06 9.999646e-01 $finepix [1] 3.850036e-05 9.998887e-01 6.650074e-02 6.650074e-02 9.998465e-01 [6] 9.998465e-01 4.345598e-05 $`kodak easyshare` [1] 3.548812e-05 9.998604e-01 3.996137e-01 3.996137e-01 9.987841e-01 [6] 3.179604e-05 2.789861e-05 $`nikon coolpix series` [1] 9.156401e-02 9.998091e-01 1.995972e-01 1.995972e-01 9.996341e-01 [6] 7.033741e-05 8.499410e-05
but after using do.call(data.frame, my_list)
, this:
canon.powershot casio.exilim finepix kodak.easyshare 1 9.997803e-01 5.322024e-06 3.850036e-05 3.548812e-05 2 9.997318e-01 9.999646e-01 9.998887e-01 9.998604e-01 3 3.327920e-01 5.322024e-06 6.650074e-02 3.996137e-01 4 3.327920e-01 5.322024e-06 6.650074e-02 3.996137e-01 5 9.988220e-01 9.999646e-01 9.998465e-01 9.987841e-01 6 4.030871e-05 5.322024e-06 9.998465e-01 3.179604e-05 7 4.928497e-05 9.999646e-01 4.345598e-05 2.789861e-05 nikon.coolpix.series 1 9.156401e-02 2 9.998091e-01 3 1.995972e-01 4 1.995972e-01 5 9.996341e-01 6 7.033741e-05 7 8.499410e-05
(note there . instead of ' ' in column names)
you can stop r
changing names syntatically valid names setting check.names = false
. see ?data.frame
details.
# assuming data in list called my_list do.call(data.frame, c(my_list, check.names = false))