[datatable-help] Please help me with data frame and melt function in R
Michael Smith
my.r.help at gmail.com
Fri Jan 8 03:02:34 CET 2016
First off, if you have questions about "base" R you might wanna try the
R-help mailing list instead of the data.table list.
Second, I guess you're looking for merge. See `?merge`.
Third, if you want to do it the data.table way, you can just do
something like `df2[df2]`.
M
On 01/08/2016 12:03 AM, Maryia wrote:
> Hi all,
>
> I've just come to the amazing R software, so please be patient if my
> question is basic for you. I have 2 text file (say 1.txt and 2.txt), each
> file containing 2 columns and thousands row as like below,
>
> case size
> case1 120
> case2 120
> case3 121
> case4 122
>
> (The number of row in two files are different). I would like to combine the
> related data frames, so I wrote the following code in R (3.2.3 version),
>
> df1 = data.frame("1.txt",header=T)
> df2 = data.frame("2.txt",header=T)
> df = data.frame(df1$size,df2$size)
> library(reshape)
> melted <- melt(df)
>
> But the melt command gives an error that "Using as id variables". Actually,
> the melt function didn't work here.
> Could you please help me out what is wrong here and how to solve it?
>
> Thanks in advance
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Please-help-me-with-data-frame-and-melt-function-in-R-tp4716238.html
> Sent from the datatable-help mailing list archive at Nabble.com.
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>
More information about the datatable-help
mailing list