[R] split data into columns from dataframe

Ivan Calandra ivan.calandra at u-bourgogne.fr
Tue Mar 12 10:27:17 CET 2013


What about read.table()?

--
Ivan CALANDRA
Université de Bourgogne
UMR CNRS/uB 6282 Biogéosciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calandra at u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra

Le 12/03/13 10:03, Roslina Zakaria a écrit :
> Dear r-users,
>   
> Originally my data is in notepad.  I use data.frame(...) to convert the data into columns but it has no header.  The data below is what I got in R.  I would like to extract these data:
>   
> 19710629        39.3  19701126
> 19720629        33.8  19720517
> ...
> when I use data2_30min[1, cbind(1,3,5)] command the result is NULL.
>   
> Then I tried data2_30min[1], it gives me the whole set of data.  I suspect the data is stored in a cell.
>   
> My question is, how do I split the data from dataframe into some columns which separating the data by spaces.  Many examples given on how to split the data with the header.
>   
> The codes and data are given below.  Thank you so much for your help.
>   
> head(data_30min,10); tail(data_30min,10)
> data2_30min <- data.frame(data_30min)
> head(data2_30min,10); tail(data2_30min,10)
> head(data_30min,10); tail(data_30min,10)
> data2_30min[1]
>
>                                                                    data_30min
> 1  19710629 080000(PARTIAL)       39.3 at interval beginning 19701126 010326
> 2  19720629 080000(PARTIAL)       33.8 at interval beginning 19720517 144507
> 3  19730629 080000(PARTIAL)       32.2 at interval beginning 19720910 135747
> 4  19740629 080000(PARTIAL)       38.9 at interval beginning 19731003 124849
> 5  19750629 080000                43.3 at interval beginning 19750105 173500
> 6  19760629 080000(PARTIAL)      101.5 at interval beginning 19750809 111800
> 7  19770629 080000(PARTIAL)       39.4 at interval beginning 19760917 141200
> 8  19780629 080000                38.5 at interval beginning 19780508 195400
> 9  19790629 080000(PARTIAL)       39.0 at interval beginning 19790602 142222
> 10 19800629 080000(PARTIAL)       94.6 at interval beginning 19800329 063532
>
> 	[[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list