[R] Fetch and merge from a data set
arun
smartpink111 at yahoo.com
Tue Jun 25 14:33:56 CEST 2013
HI,
Try this:
merge(data,data1["NAME"])
A.K.
----- Original Message -----
From: Nico Met <nicomet80 at gmail.com>
To: Rui Barradas <ruipbarradas at sapo.pt>
Cc: R help <r-help at r-project.org>
Sent: Tuesday, June 25, 2013 6:00 AM
Subject: Re: [R] Fetch and merge from a merge(dat1["NAME"],dat2)
data set
Many thanks Rui,
However If I want to extract only first column (data1) from data file, then
how Can I do it?
Thanks again
Nico
On Tue, Jun 25, 2013 at 11:43 AM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> Hello,
>
> I'm not sure I understand, but it seems as simple as
>
> merge(data1, data)
>
>
> Hope this helps,
>
> Rui Barradas
>
> Em 25-06-2013 10:34, Nico Met escreveu:
>
>> Dear all,
>>
>> I would like to fetch a list (data1) of entities from a big data file
>> (data) and merged together. for example: data is the file from where I
>> want
>> to extract
>>
>> dput(data)
>> structure(list(NAME = structure(c(6L, 6L, 7L, 6L, 6L, 7L, 6L,
>> 7L, 3L, 5L, 3L, 3L, 3L, 3L, 4L, 3L, 3L, 4L, 3L, 3L, 3L, 3L, 1L,
>> 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L), .Label = c("CDS0008_3",
>> "CDS0008_9", "CDS0248_2", "CDS0248_3", "CDS0248_9", "CDS0644",
>> "CDS0645"), class = "factor"), QUAL = structure(c(1L, 1L, 1L,
>> 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,
>> 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("CE",
>> "IE", "IL", "NL"), class = "factor"), DIFF = c(-1.3998944145561,
>> -3.2771509067793, -3281.07651466667, 8.4344933333332, 1.825,
>> -0.584379415213178, -0.842892819141902, -7939.4442483333,
>> 0.305343667019102,
>> 11.4859716384148, 1242.72166499999, 33.2540033333333, -14.8333333333333,
>> 62.8783807080717, 0.323435555555555, 3325.4720195, 33.8787927988058,
>> -26.7723700000001, 58.5555555555556, 58.5555555555556, 0.0566947723248923,
>> 1.29414722222222, -13.319016665, -18.2, -76.0081565999972, -13.319016665,
>> -18.2, -13.319016665, -18.2, -2632.77274125, -42.6985227297727,
>> -19.2272727272727, -640.535327886362), PVALUE = c(0.393708851005828,
>> 0.213217899579307, 0.59042649939326, 0.874157227673879, 0.953482720079014,
>> 0.737143165148719, 0.76195136190783, 0.27992628190224, 0.737143165148719,
>> 0.76195136190783, 0.27992628190224, 0.672772547835936, 0.86918514824479,
>> 0.86918514824479, 0.794677241773376, 0.67568899695407, 0.0792182671307693,
>> 0.53713122011077, 0.298506678908869, 0.343822055403655, 0.962553162399683,
>> 0.335590623453015, 0.962553162399683, 0.335590623453015,
>> 0.966426100547593,
>> 0.671619043425778, 0.225088848812347, 0.962553162399683,
>> 0.335590623453015,
>> 0.17524845367103, 0.205476355179601, 0.229212899348569, 0.739457737437997
>> ), MEAD = c(61.997380489015, 38.9012158419308, 42541.899878,
>> 644.342793333333, 58.8, 65.4391126224113, 45.1617170900398,
>> 37470.3747366666,
>> 61.6954795437718, 36.4397768557611, 26367.6229666667, 485.3921,
>> 76, 0, 0.871720000000001, 28005.1589441667, 46.2203164422305,
>> 713.029716666667, 64, 64, 23.0947770774977, 1.456775, 79.2102758175251,
>> 39.5498022382743, 31387.15404, 883.475686666, 180, 76.8751996288758,
>> 41.0701371024372, 23960.47775025, 746.3317500025, 104.5, 17488.00655825
>> )), .Names = c("NAME", "QUAL", "DIFF", "PVALUE", "MEAD"), class =
>> "data.frame",
>> row.names = c(NA,
>> 33L))
>>
>>
>> And data1 : subset of entities
>>
>> dput(data1)
>> structure(list(NAME = structure(c(5L, 4L, 2L, 3L, 1L), .Label =
>> c("CDG981",
>> "CDS0248_2", "CDS0248_9", "CDS0644", "CDS0645"), class = "factor"),
>> VAL = structure(c(1L, 2L, 5L, 3L, 4L), .Label = c("YU1",
>> "YU2", "YU4", "YU5", "YU7"), class = "factor")), .Names = c("NAME",
>> "VAL"), class = "data.frame", row.names = c(NA, 5L))
>>
>>
>> Please help me how can I do it.
>>
>> Many thanks
>>
>> Nico
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________**________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
>> PLEASE do read the posting guide http://www.R-project.org/**
>> posting-guide.html <http://www.R-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
[[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