[R] data.frame package?

Anders Nielsen anielsen at dina.kvl.dk
Tue Apr 30 16:40:17 CEST 2002


Dear Eryk

All of these operations are possible in R, as the following 
example show 

Kind regards, 

Anders.  

> data1<-data.frame(x=1:5, y=1:5/10)
> data2<-data.frame(x=6:10, y=6:10/10)
> data12<-rbind(data1,data2)
> data12
    x   y
1   1 0.1
2   2 0.2
3   3 0.3
4   4 0.4
5   5 0.5
6   6 0.6
7   7 0.7
8   8 0.8
9   9 0.9
10 10 1.0
> is.data.frame(data12)
[1] TRUE
> data12x<-subset(data12, select=-y)
> data12x
    x
1   1
2   2
3   3
4   4
5   5
6   6
7   7
8   8
9   9
10 10
> data12BigX<-subset(data12, x>5)
> data12BigX
    x   y
6   6 0.6
7   7 0.7
8   8 0.8
9   9 0.9
10 10 1.0
> data12BigX
> as.matrix(data12)
    x   y
1   1 0.1
2   2 0.2
3   3 0.3
4   4 0.4
5   5 0.5
6   6 0.6
7   7 0.7
8   8 0.8
9   9 0.9
10 10 1.0

On Tue, 2002-04-30 at 16:58, Witold Eryk Wolski wrote:
> Is there a library that is able for example to
> 1. merge 2 dataframes by row  eg.: rbind(dataframe1, dataframe2):data.frame
> 2. delete a column from a dataframe del(dataframe, colname) or 
> del(dataframe, colindex= 1):data.frame?
> 3. Select lines from a dataframe by a specific function ? 
> select(dataframe, func=small(x){x<1}, colindex=3): data.frame?
> 4. converting all double columns of a data.frame to a matrix. 
> datafram_to_matrix(dataframe1):matrix
> 
> If not would not it be usefull to have such a library on the cran?
> 
> Sincerely
> Eryk
> 
> 
> -- 
>     \|/     \|/     \|/
>     'v'     'v'     'v'
>   //| |\\ //| |\\ //| |\\
> ----m-m-----m-m-----m-m-------w-w-----
>                             \\| |//
>    Eryk Witold Wolski         .^.
>                               /|\
> wolski at molen.mpg.de
> tel      : 0049-(0)30-8413-1543
> fax      : 0049-(0)30-8413-1139
> mobile   : 0049-1793210931
> http://www.molgen.mpg.de/~mass-spec
> http://www.molgen.mpg.de/~wolski
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list