An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/a9904c5b/attachment-0002.pl>
Merging
15 messages · Tammy Ma, Simon Pickett, Pankaj Chopra +2 more
Hi, I'm pretty sure you dont mean "merge" since merge() creates a new big data frame from two small ones. It appears that you want to omit some rows. As I said before, get used to selecting rows like this data.frame<-data.frame[data.frame$conditional.rows>1000,] (for example) Although I dont have a clue what criteria you are using to select the rows you want... Simon.
Hi, All. I have a data frame with the part as : ..... 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 0 147 2006-02-22 16:31:14 useractivity_idle 0 0 1421 2006-02-22 16:28:18 useractivity_act 8 0 1431 2006-02-22 16:28:26 4 2 0 1441 2006-02-22 16:28:28 3 3 0 1451 2006-02-22 16:28:31 4 4 0 1461 2006-02-22 16:28:35 3 159 25 1471 2006-02-22 16:31:14 useractivity_idle 0 0 .... I want to merge the above as 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 25 147 2006-02-22 16:31:14 useractivity_idle 0 0 How should I do`?? Thanks. Tammy
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/d0b3bf68/attachment-0002.pl>
Is this what you want it to do ('n' is the original data frame)?
> n
v V1 V2 V3 V4
1 k a 2 1 2
2 l b 1 2 1
3 m c 2 1 2
4 n d 1 2 1
5 o e 2 1 2
> n1 <- n[,3:5]
> n2 <- duplicated(n1)
> n3 <- n[!n2,]
> n3
v V1 V2 V3 V4
1 k a 2 1 2
2 l b 1 2 1
Pankaj
Tammy Ma wrote:
Thanks for your reply, I couldn't use the method what the example gives. Because Data frame is quite big, and it has so many rows which are repeated. I am not pretty sure about the range of 1000. It turns out I should merge those row which repeated. Tammy
From: simon.pickett at bto.org
To: metal_licaling at live.com; r-help at r-project.org
Subject: Re: [R] Merging
Date: Tue, 17 Mar 2009 10:02:51 +0000
Hi,
I'm pretty sure you dont mean "merge" since merge() creates a new big data
frame from two small ones. It appears that you want to omit some rows.
As I said before, get used to selecting rows like this
data.frame<-data.frame[data.frame$conditional.rows>1000,]
(for example)
Although I dont have a clue what criteria you are using to select the rows
you want...
Simon.
Hi, All. I have a data frame with the part as : ..... 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 0 147 2006-02-22 16:31:14 useractivity_idle 0 0 1421 2006-02-22 16:28:18 useractivity_act 8 0 1431 2006-02-22 16:28:26 4 2 0 1441 2006-02-22 16:28:28 3 3 0 1451 2006-02-22 16:28:31 4 4 0 1461 2006-02-22 16:28:35 3 159 25 1471 2006-02-22 16:31:14 useractivity_idle 0 0 .... I want to merge the above as 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 25 147 2006-02-22 16:31:14 useractivity_idle 0 0 How should I do`?? Thanks. Tammy
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/6ee4c156/attachment-0002.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/ad8ff10d/attachment-0002.pl>
Is this what you want it to do? (aDF is the original data frame)
aDF
V1 V2 V3 V4 1 2006-02-22 16:28:18 useractivity_act 8 0 2 2006-02-22 16:28:26 4 2 0 3 2006-02-22 16:28:28 3 3 0 4 2006-02-22 16:28:31 4 4 1 5 2006-02-22 16:28:35 3 159 0 6 2006-02-22 16:31:14 useractivity_idle 0 0 7 2006-02-22 16:28:18 useractivity_act 8 0 8 2006-02-22 16:28:26 4 2 0 9 2006-02-22 16:28:28 3 3 0 10 2006-02-22 16:28:31 4 4 0 11 2006-02-22 16:28:35 3 159 25 12 2006-02-22 16:31:14 useractivity_idle 0 0
with(aDF, aggregate(V4, by=list(V1, V2, V3), sum))
Group.1 Group.2 Group.3 x 1 2006-02-22 16:31:14 useractivity_idle 0 0 2 2006-02-22 16:28:26 4 2 0 3 2006-02-22 16:28:28 3 3 0 4 2006-02-22 16:28:31 4 4 1 5 2006-02-22 16:28:18 useractivity_act 8 0 6 2006-02-22 16:28:35 3 159 25 hth Keith J "Tammy Ma" <metal_licaling at live.com> wrote in message news:BAY0-DP3-858363E64F6ED84F9F6F486980 at phx.gbl...
My aim is not only relect unduplicated column, I also want merge the last column beside selection Thanks. Tammy
Date: Tue, 17 Mar 2009 06:59:20 -0400
From: pchopra at ncsu.edu
To: metal_licaling at live.com
CC: r-help at r-project.org
Subject: Re: [R] Merging
Is this what you want it to do ('n' is the original data frame)?
> n
v V1 V2 V3 V4 1 k a 2 1 2 2 l b 1 2 1 3 m c 2 1 2 4 n d 1 2 1 5 o e 2 1 2
> n1 <- n[,3:5] > n2 <- duplicated(n1) > n3 <- n[!n2,] > n3
v V1 V2 V3 V4 1 k a 2 1 2 2 l b 1 2 1 Pankaj Tammy Ma wrote:
Thanks for your reply, I couldn't use the method what the example gives. Because Data frame is quite big, and it has so many rows which are repeated. I am not pretty sure about the range of 1000. It turns out I should merge those row which repeated. Tammy
From: simon.pickett at bto.org To: metal_licaling at live.com; r-help at r-project.org Subject: Re: [R] Merging Date: Tue, 17 Mar 2009 10:02:51 +0000 Hi, I'm pretty sure you dont mean "merge" since merge() creates a new big data frame from two small ones. It appears that you want to omit some rows. As I said before, get used to selecting rows like this data.frame<-data.frame[data.frame$conditional.rows>1000,] (for example) Although I dont have a clue what criteria you are using to select the rows you want... Simon.
Hi, All. I have a data frame with the part as : ..... 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 0 147 2006-02-22 16:31:14 useractivity_idle 0 0 1421 2006-02-22 16:28:18 useractivity_act 8 0 1431 2006-02-22 16:28:26 4 2 0 1441 2006-02-22 16:28:28 3 3 0 1451 2006-02-22 16:28:31 4 4 0 1461 2006-02-22 16:28:35 3 159 25 1471 2006-02-22 16:31:14 useractivity_idle 0 0 .... I want to merge the above as 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 25 147 2006-02-22 16:31:14 useractivity_idle 0 0 How should I do`?? Thanks. Tammy
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/fa9d9acf/attachment-0002.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/41b0a301/attachment-0002.pl>
Tammy, You won't get more help if you post this again every half an hour... I don't quite understand what you exactly want to do, but it seemed at least to me that Keith's suggestion (see again below) pretty much does what you want. If not, could you please specify *EXACTLY* what you want to do. Thanks! Annette
From: Keith Jewell <k.jewell_at_campden.co.uk> Date: Tue, 17 Mar 2009 12:23:34 +0000 Is this what you want it to do? (aDF is the original data frame)
aDF
V1 V2 V3 V4
1 2006-02-22 16:28:18 useractivity_act 8 0
2 2006-02-22 16:28:26 4 2 0
3 2006-02-22 16:28:28 3 3 0
4 2006-02-22 16:28:31 4 4 1
5 2006-02-22 16:28:35 3 159 0
6 2006-02-22 16:31:14 useractivity_idle 0 0
7 2006-02-22 16:28:18 useractivity_act 8 0
8 2006-02-22 16:28:26 4 2 0
9 2006-02-22 16:28:28 3 3 0
10 2006-02-22 16:28:31 4 4 0
11 2006-02-22 16:28:35 3 159 25
12 2006-02-22 16:31:14 useractivity_idle 0 0
with(aDF, aggregate(V4, by=list(V1, V2, V3), sum))
Group.1 Group.2 Group.3 x
1 2006-02-22 16:31:14 useractivity_idle 0 0
2 2006-02-22 16:28:26 4 2 0
3 2006-02-22 16:28:28 3 3 0
4 2006-02-22 16:28:31 4 4 1
5 2006-02-22 16:28:18 useractivity_act 8 0
6 2006-02-22 16:28:35 3 159 25
hth
Keith J
Tammy Ma schrieb:
I still couldn't solve it........any help would be preciated! Tammy
From: metal_licaling at live.com To: r-help at r-project.org Date: Tue, 17 Mar 2009 11:49:10 +0200 Subject: [R] Merging Hi, All. I have a data frame with the part as : ..... 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 0 147 2006-02-22 16:31:14 useractivity_idle 0 0 1421 2006-02-22 16:28:18 useractivity_act 8 0 1431 2006-02-22 16:28:26 4 2 0 1441 2006-02-22 16:28:28 3 3 0 1451 2006-02-22 16:28:31 4 4 0 1461 2006-02-22 16:28:35 3 159 25 1471 2006-02-22 16:31:14 useractivity_idle 0 0 .... I want to merge the above as 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 25 147 2006-02-22 16:31:14 useractivity_idle 0 0 How should I do`?? Thanks. Tammy
Annette Heisswolf Section of Ecology Department of Biology University of Turku 20014 Turku, Finland
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/2119a0ec/attachment-0002.pl>
Looks as if you copied my code without modifying to suit your data frame. My data frame (aDF) had column names V1, V2, V3, V4
str(aDF)
'data.frame': 12 obs. of 4 variables: $ V1: chr "2006-02-22 16:28:18" "2006-02-22 16:28:26" "2006-02-22 16:28:28" "2006-02-22 16:28:31" ... $ V2: Factor w/ 4 levels "3","4","useractivity_act",..: 3 2 1 2 1 4 3 2 1 2 ... $ V3: num 8 2 3 4 159 0 8 2 3 4 ... $ V4: num 0 0 0 1 0 0 0 0 0 0 ... ..so I referred to V1, V2, V3, V4 in the aggregate. We don't know the column names in your data frame, which I guess is called act_data12. (By the way, you told us almost nothing about your data frame. Consider reading and following the posting guide.) What does
str(act_data12)
produce? hth Keith J ========================== "Tammy Ma" <metal_licaling at live.com> wrote in message news:BAY0-DP1-6D9323FB68F77E4CFA77186980 at phx.gbl... Thanks. Actually, I have been trying many time using method from KJ, There is always the following information coming up or Rgui exit without reason.. I have no idea about this? gh<-with(act_data12, aggregate(V4, by=list(V1,V2,V3), sum)) Error in unlist(y, recursive = FALSE) : promise already under evaluation: recursive default argument reference or earlier problems? Tammy
Date: Tue, 17 Mar 2009 15:23:44 +0200 From: annette.heisswolf at utu.fi Subject: Re: [R] Merging To: metal_licaling at live.com; r-help at r-project.org Tammy, You won't get more help if you post this again every half an hour... I don't quite understand what you exactly want to do, but it seemed at least to me that Keith's suggestion (see again below) pretty much does what you want. If not, could you please specify *EXACTLY* what you want to do. Thanks! Annette
From: Keith Jewell <k.jewell_at_campden.co.uk> Date: Tue, 17 Mar 2009 12:23:34 +0000 Is this what you want it to do? (aDF is the original data frame)
aDF
V1 V2 V3 V4
1 2006-02-22 16:28:18 useractivity_act 8 0
2 2006-02-22 16:28:26 4 2 0
3 2006-02-22 16:28:28 3 3 0
4 2006-02-22 16:28:31 4 4 1
5 2006-02-22 16:28:35 3 159 0
6 2006-02-22 16:31:14 useractivity_idle 0 0
7 2006-02-22 16:28:18 useractivity_act 8 0
8 2006-02-22 16:28:26 4 2 0
9 2006-02-22 16:28:28 3 3 0
10 2006-02-22 16:28:31 4 4 0
11 2006-02-22 16:28:35 3 159 25
12 2006-02-22 16:31:14 useractivity_idle 0 0
with(aDF, aggregate(V4, by=list(V1, V2, V3), sum))
Group.1 Group.2 Group.3 x
1 2006-02-22 16:31:14 useractivity_idle 0 0
2 2006-02-22 16:28:26 4 2 0
3 2006-02-22 16:28:28 3 3 0
4 2006-02-22 16:28:31 4 4 1
5 2006-02-22 16:28:18 useractivity_act 8 0
6 2006-02-22 16:28:35 3 159 25
hth
Keith J
Tammy Ma schrieb:
I still couldn't solve it........any help would be preciated! Tammy
From: metal_licaling at live.com To: r-help at r-project.org Date: Tue, 17 Mar 2009 11:49:10 +0200 Subject: [R] Merging Hi, All. I have a data frame with the part as : ..... 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 0 147 2006-02-22 16:31:14 useractivity_idle 0 0 1421 2006-02-22 16:28:18 useractivity_act 8 0 1431 2006-02-22 16:28:26 4 2 0 1441 2006-02-22 16:28:28 3 3 0 1451 2006-02-22 16:28:31 4 4 0 1461 2006-02-22 16:28:35 3 159 25 1471 2006-02-22 16:31:14 useractivity_idle 0 0 .... I want to merge the above as 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 25 147 2006-02-22 16:31:14 useractivity_idle 0 0 How should I do`?? Thanks. Tammy
-- Annette Heisswolf Section of Ecology Department of Biology University of Turku 20014 Turku, Finland
_________________________________________________________________ Drag n' drop-Get easy photo sharing with Windows LiveT Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx --------------------------------------------------------------------------------
______________________________________________ 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.
In case it helps, this refers to the columns by position rather than name...
aggregate(aDF[,4], by=aDF[,-4], sum)
It sums the fourth column (I'm guessing this is what Tammy meant by "merge") for unique combinations of all columns except the fourth. It doesn't need the column names inside the aggregate, but does need the dataframe name. Because the dataframe name is specified inside the aggregate, we don't need the with(). HTH Keith J "Keith Jewell" <k.jewell at campden.co.uk> wrote in message news:gpoc8f$jl0$1 at ger.gmane.org...
Looks as if you copied my code without modifying to suit your data frame. My data frame (aDF) had column names V1, V2, V3, V4
str(aDF)
'data.frame': 12 obs. of 4 variables: $ V1: chr "2006-02-22 16:28:18" "2006-02-22 16:28:26" "2006-02-22 16:28:28" "2006-02-22 16:28:31" ... $ V2: Factor w/ 4 levels "3","4","useractivity_act",..: 3 2 1 2 1 4 3 2 1 2 ... $ V3: num 8 2 3 4 159 0 8 2 3 4 ... $ V4: num 0 0 0 1 0 0 0 0 0 0 ... ..so I referred to V1, V2, V3, V4 in the aggregate. We don't know the column names in your data frame, which I guess is called act_data12. (By the way, you told us almost nothing about your data frame. Consider reading and following the posting guide.) What does
str(act_data12)
produce? hth Keith J ========================== "Tammy Ma" <metal_licaling at live.com> wrote in message news:BAY0-DP1-6D9323FB68F77E4CFA77186980 at phx.gbl... Thanks. Actually, I have been trying many time using method from KJ, There is always the following information coming up or Rgui exit without reason.. I have no idea about this? gh<-with(act_data12, aggregate(V4, by=list(V1,V2,V3), sum)) Error in unlist(y, recursive = FALSE) : promise already under evaluation: recursive default argument reference or earlier problems? Tammy
Date: Tue, 17 Mar 2009 15:23:44 +0200 From: annette.heisswolf at utu.fi Subject: Re: [R] Merging To: metal_licaling at live.com; r-help at r-project.org Tammy, You won't get more help if you post this again every half an hour... I don't quite understand what you exactly want to do, but it seemed at least to me that Keith's suggestion (see again below) pretty much does what you want. If not, could you please specify *EXACTLY* what you want to do. Thanks! Annette
From: Keith Jewell <k.jewell_at_campden.co.uk> Date: Tue, 17 Mar 2009 12:23:34 +0000 Is this what you want it to do? (aDF is the original data frame)
aDF
V1 V2 V3 V4
1 2006-02-22 16:28:18 useractivity_act 8 0
2 2006-02-22 16:28:26 4 2 0
3 2006-02-22 16:28:28 3 3 0
4 2006-02-22 16:28:31 4 4 1
5 2006-02-22 16:28:35 3 159 0
6 2006-02-22 16:31:14 useractivity_idle 0 0
7 2006-02-22 16:28:18 useractivity_act 8 0
8 2006-02-22 16:28:26 4 2 0
9 2006-02-22 16:28:28 3 3 0
10 2006-02-22 16:28:31 4 4 0
11 2006-02-22 16:28:35 3 159 25
12 2006-02-22 16:31:14 useractivity_idle 0 0
with(aDF, aggregate(V4, by=list(V1, V2, V3), sum))
Group.1 Group.2 Group.3 x
1 2006-02-22 16:31:14 useractivity_idle 0 0
2 2006-02-22 16:28:26 4 2 0
3 2006-02-22 16:28:28 3 3 0
4 2006-02-22 16:28:31 4 4 1
5 2006-02-22 16:28:18 useractivity_act 8 0
6 2006-02-22 16:28:35 3 159 25
hth
Keith J
Tammy Ma schrieb:
I still couldn't solve it........any help would be preciated! Tammy
From: metal_licaling at live.com To: r-help at r-project.org Date: Tue, 17 Mar 2009 11:49:10 +0200 Subject: [R] Merging Hi, All. I have a data frame with the part as : ..... 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 0 147 2006-02-22 16:31:14 useractivity_idle 0 0 1421 2006-02-22 16:28:18 useractivity_act 8 0 1431 2006-02-22 16:28:26 4 2 0 1441 2006-02-22 16:28:28 3 3 0 1451 2006-02-22 16:28:31 4 4 0 1461 2006-02-22 16:28:35 3 159 25 1471 2006-02-22 16:31:14 useractivity_idle 0 0 .... I want to merge the above as 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 25 147 2006-02-22 16:31:14 useractivity_idle 0 0 How should I do`?? Thanks. Tammy
-- Annette Heisswolf Section of Ecology Department of Biology University of Turku 20014 Turku, Finland
_________________________________________________________________ Drag n' drop-Get easy photo sharing with Windows LiveT Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx [[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. ______________________________________________ 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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090317/c9677461/attachment-0002.pl>
OK, I can't see anything wrong with that. a) post the results of ...
sessionInfo()
... so we can check you're using a reasonably up to date system
b) send a copy of your data set to me at...
k.jewell at campden.co.uk
... and I'll see if I can reproduce your error. I can take most common data
formats, but you might want to use
write.table(aDF, file.choose())
HTH Keith J "Tammy Ma" <metal_licaling at live.com> wrote in message news:BAY0-DP4-773C6BFDDC43849F5DC6786980 at phx.gbl...
My data frame is:
str(act_data12)
'data.frame': 1687 obs. of 5 variables: $ Date : chr "2006-02-22" "2006-02-22" "2006-02-22" "2006-02-22" ... $ Dtime : chr "14:36:10" "14:36:11" "14:36:12" "14:37:38" ... $ FocusApp_seq: chr "useractivity_act" "4" "3" "0" ... $ App_duration: int 1 1 86 58 1 1 9 3 1 41 ... $ Frequency : int 0 0 22 0 1 0 0 0 0 0 ... I used: gh<-with(act_data12, aggregate(Frequency, by=list(Date, Dtime, FocusApp_seq, App_duration), sum)) Error info: Error in unlist(y, recursive = FALSE) : promise already under evaluation: recursive default argument reference or earlier problems? or R exited when running.. Thanks for your concentration. Tammy
To: r-help at stat.math.ethz.ch From: k.jewell at campden.co.uk Date: Tue, 17 Mar 2009 12:23:34 +0000 Subject: Re: [R] Merging Is this what you want it to do? (aDF is the original data frame)
aDF
V1 V2 V3 V4 1 2006-02-22 16:28:18 useractivity_act 8 0 2 2006-02-22 16:28:26 4 2 0 3 2006-02-22 16:28:28 3 3 0 4 2006-02-22 16:28:31 4 4 1 5 2006-02-22 16:28:35 3 159 0 6 2006-02-22 16:31:14 useractivity_idle 0 0 7 2006-02-22 16:28:18 useractivity_act 8 0 8 2006-02-22 16:28:26 4 2 0 9 2006-02-22 16:28:28 3 3 0 10 2006-02-22 16:28:31 4 4 0 11 2006-02-22 16:28:35 3 159 25 12 2006-02-22 16:31:14 useractivity_idle 0 0
with(aDF, aggregate(V4, by=list(V1, V2, V3), sum))
Group.1 Group.2 Group.3 x 1 2006-02-22 16:31:14 useractivity_idle 0 0 2 2006-02-22 16:28:26 4 2 0 3 2006-02-22 16:28:28 3 3 0 4 2006-02-22 16:28:31 4 4 1 5 2006-02-22 16:28:18 useractivity_act 8 0 6 2006-02-22 16:28:35 3 159 25 hth Keith J "Tammy Ma" <metal_licaling at live.com> wrote in message news:BAY0-DP3-858363E64F6ED84F9F6F486980 at phx.gbl...
My aim is not only relect unduplicated column, I also want merge the last column beside selection Thanks. Tammy
Date: Tue, 17 Mar 2009 06:59:20 -0400
From: pchopra at ncsu.edu
To: metal_licaling at live.com
CC: r-help at r-project.org
Subject: Re: [R] Merging
Is this what you want it to do ('n' is the original data frame)?
> n
v V1 V2 V3 V4 1 k a 2 1 2 2 l b 1 2 1 3 m c 2 1 2 4 n d 1 2 1 5 o e 2 1 2
> n1 <- n[,3:5] > n2 <- duplicated(n1) > n3 <- n[!n2,] > n3
v V1 V2 V3 V4 1 k a 2 1 2 2 l b 1 2 1 Pankaj Tammy Ma wrote:
Thanks for your reply, I couldn't use the method what the example gives. Because Data frame is quite big, and it has so many rows which are repeated. I am not pretty sure about the range of 1000. It turns out I should merge those row which repeated. Tammy
From: simon.pickett at bto.org To: metal_licaling at live.com; r-help at r-project.org Subject: Re: [R] Merging Date: Tue, 17 Mar 2009 10:02:51 +0000 Hi, I'm pretty sure you dont mean "merge" since merge() creates a new big data frame from two small ones. It appears that you want to omit some rows. As I said before, get used to selecting rows like this data.frame<-data.frame[data.frame$conditional.rows>1000,] (for example) Although I dont have a clue what criteria you are using to select the rows you want... Simon.
Hi, All. I have a data frame with the part as : ..... 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 0 147 2006-02-22 16:31:14 useractivity_idle 0 0 1421 2006-02-22 16:28:18 useractivity_act 8 0 1431 2006-02-22 16:28:26 4 2 0 1441 2006-02-22 16:28:28 3 3 0 1451 2006-02-22 16:28:31 4 4 0 1461 2006-02-22 16:28:35 3 159 25 1471 2006-02-22 16:31:14 useractivity_idle 0 0 .... I want to merge the above as 142 2006-02-22 16:28:18 useractivity_act 8 0 143 2006-02-22 16:28:26 4 2 0 144 2006-02-22 16:28:28 3 3 0 145 2006-02-22 16:28:31 4 4 1 146 2006-02-22 16:28:35 3 159 25 147 2006-02-22 16:31:14 useractivity_idle 0 0 How should I do`?? Thanks. Tammy
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.
______________________________________________ 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.
_________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us [[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.