] On Behalf Of jim holtman
Sent: Wednesday, July 3, 2013 7:22 AM
To: André de Boer
Cc: R mailing list
Subject: Re: [R] merge dataframes
FAQ 7.31
On Wed, Jul 3, 2013 at 7:55 AM, Andri de Boer
wrote:
Hello,
I have two dataframes:
dat1<-data.frame(x=c(1.0,1.2,3.2,4.0,5.1),y=c(23,17,12,27,8))
Anthropology
Texas A&M University
College Station, TX 77840-4352
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of jim holtman
Sent: Wednesday, July 3, 2013 7:22 AM
To: André de Boer
Cc: R mailing list
Subject: Re: [R] merge dataf
FAQ 7.31
On Wed, Jul 3, 2013 at 7:55 AM, André de Boer wrote:
> Hello,
>
> I have two dataframes:
> dat1<-data.frame(x=c(1.0,1.2,3.2,4.0,5.1),y=c(23,17,12,27,8))
> dat2<-data.frame(x=seq(0,6,by=0.1),y=rep(0,60)))
>
> I want to replace the corresponding rows of dat2 with the ones of dat1.
> I tr
Hello,
I have two dataframes:
dat1<-data.frame(x=c(1.0,1.2,3.2,4.0,5.1),y=c(23,17,12,27,8))
dat2<-data.frame(x=seq(0,6,by=0.1),y=rep(0,60)))
I want to replace the corresponding rows of dat2 with the ones of dat1.
I tried:
for(i in 1:nrow(dat1))
{
dat2[dat2$x==dat1[i,1],2]<-dat1[i,2]
}
But I d
Hi @ all,
thanks for the solutions! Now I can go on.
Greetz
GeoPhagUS
--
View this message in context:
http://r.789695.n4.nabble.com/merge-dataframes-with-condition-tp4649605p4649712.html
Sent from the R help mailing list archive at Nabble.com.
__
Refering the discussed issue: As a result I have dataframe like the
following.
animal<-c("bear","lion","monkey","fish","zebra")
S<-c(10,20,40,5,12)
N<-c(5,8,15,26,1)
Z<-c(24,12,8,7,2)
R<-c(21,14,2,5,3)
Q<-c(13,9,9,16,1)
df1<-data.frame(animal,S,N,Z,R,Q)
Now, I want to plot it as a stacked barcha
Is this what you want:
> animal<-c("bear","bear","lion","monkey","fish","monkey","bear","zebra","zebra")
> val<-c(2,42,67,5,12,9,87,1,12)
> place<-c("S","N","N","Z","R","O","E","I","Q")
> df1<-data.frame(animal,val,place)
> animal<-c("bear","bear","lion","monkey","fish","monkey","bear","zebra","ze
Hi @ all,
I wamnt to combine two dataframes including a condition.
I have two dataframes like the following:
animal<-c("bear","bear","lion","monkey","fish","monkey","bear","zebra","zebra")
val<-c(2,42,67,5,12,9,87,1,12)
place<-c("S","N","N","Z","R","O","E","I","Q")
df1<-data.frame(animal,val,plac
Hi everybody,
I got a solution for my problem with Eric Paniagua (many thanks!)! Thank you
a lot everybody!
Paniagua said explained that I was losing row.names when I merged a
data.frame with a factor object (data2$color), because a factor objects
don't have row.names. Instead of merging data1 to
On Oct 7, 2011, at 9:34 AM, jdanielnd wrote:
Hello,
I am having some problems to use the 'merge' function. I'm not sure
if I got
its working right.
What I want to do is:
1) Suppose I have a dataframe like:
height width
11.12.3
22.1
I'm not sure if this solves the problem.
The NA cases are spread into de cases. This solution always returns the NA
cases for the last variables as the last cases.
It's not keeping the same row.names they have in data1.
What I want to do it return exactly the same data1 (cases in the same
order)
On 07.10.2011 15:34, jdanielnd wrote:
Hello,
I am having some problems to use the 'merge' function. I'm not sure if I got
its working right.
What I want to do is:
1) Suppose I have a dataframe like:
height width
11.12.3
22.1
Hello,
I am having some problems to use the 'merge' function. I'm not sure if I got
its working right.
What I want to do is:
1) Suppose I have a dataframe like:
height width
11.12.3
22.12.5
31.81.9
4
13 matches
Mail list logo