Displaying 20 results from an estimated 6000 matches similar to: "Adding data.frames together"
2004 Feb 11
1
64-bit Windows 2003 build of R
I am running into serious memory constraint issues with the 32 bit build
of R. We have Windows 2003 on an Itanium 64 box with the Intel 64-bit C
compiler (8.0.041) and want to create a 64-bit version of R.
Unfortunately, I am no longer "current" with C builds, i.e. - I haven't
done one in years and have never used the Intel 64-bit compiler. I
could use any suggestions, make file,
2011 Aug 18
2
Best way/practice to create a new data frame from two given ones with last column computed from the two data frames?
Dear expeRts,
What is the best approach to create a third data frame from two given ones, when
the new/third data frame has last column computed from the last columns of the two given
data frames?
## Okay, sounds complicated, so here is an example. Assume we have the two data frames:
df1 <- data.frame(Year=rep(2001:2010, each=2), Group=c("Group 1","Group 2"), Value=1:20)
2009 Jan 21
3
merging several dataframes from a list
Hi there,
I have a list of dataframes (generated by reading multiple files) and all
dataframes are comparable in dimension and column names. They also have a
common column, which, I'd like to use for merging. To give a simple example of
what I have:
df1 <- data.frame(c(LETTERS[1:5]), c(2,6,3,1,9))
names(df1) <- c("pos", "data")
df3 <- df2 <- df1
df2$data
2008 Feb 19
2
Looping through a list of objects & do something...
Hey Folks,
Could somebody show me how to loop through a list of dataframes? I want to
be able to generically access their elements and do something with them.
For instance, instead of this:
df1<- data.frame(x=(1:5),y=(1:5));
df2<- data.frame(x=(1:5),y=(1:5));
df3<- data.frame(x=(1:5),y=(1:5));
plot(df1$x,df1$y);
plot(df2$x,df2$y);
plot(df3$x,df3$y);
I would like to do something like:
2009 Feb 19
3
Multiple merge, better solution?
Hello,
My problem is that I would like to merge multiple files with a common
column but merge accepts only two
data.frames to merge. In the real situation, I have 26 different
data.frames with a common column. I can of course use merge many times
(see below) but what would be more sophisticated solution? For loop?
Any ideas?
DF1 <- data.frame(var1 = letters[1:5], a = rnorm(5))
DF2 <-
2011 Apr 30
3
indexing into a data.frame using another data.frame that also contains values for replacement
Hello all,
I have a quandry I have been scratching my head about for a
while. I've searched the manual and the web and have not been able to
find an acceptable result, so I am hoping for some help.
I have two data frames and I want to index into the first using
the second, and replace the specific values I have indexed with more
values from the second data.frame. I can do this
2008 Feb 10
11
data frame question
Hello
I have 2 data frames df1 and df2. I would like to create a
new data frame new_df which will contain only the common rows based on the first 2
columns (chrN and start). The column score in the new data frame
should
be replaced with a column containing the average score (average_score) from df1
and df2.
df1= data.frame(chrN= c(“chr1”, “chr1”, “chr1”, “chr1”, “chr2”,
“chr2”, “chr2”),
2011 Dec 07
2
Dividing rows when time is overlapping
Hi all,
I have dataframe that was created from the fusion of two dataframes. Both
spanned over the same time intervall but contained different information.
When I put them together, the info overlapped since there is no holes in the
time interval of one of the dataframe. Here is an example where the rows
"sp=A and B" are part of a first df and the rows "sp=C" come from a
2012 Jul 18
2
duplicate data between two data frames according to row names
Hi everybody.
I'll first explain my problem and what I'm trying to do.
Admit this example:
I'm working on 5 different weather stations.
I have first in one file 3 of these 5 weather stations, containing their
data. Here's an example of this file:
DF1 <- data.frame(station=c("ST001","ST004","ST005"),data=c(5,2,8))
And my two other stations in
2012 Jul 11
1
sapply question
Why does this sapply code change df3 but not df1?
Thanks
df1 <- read.table(text="
cola colb colc cold cole
1 NA 5 9 NA 17
2 NA 6 NA 14 NA
3 3 NA 11 15 19
4 4 8 12 NA 20
", header=TRUE)
df2 <-df1*2
df1
df2
df3 <-sapply(names(df1),function(x) {df1[[x]]<- df2[[x]]})
df1
df3
[[alternative HTML version deleted]]
2011 Jun 06
1
Merge two columns of a data frame
I have the following data:
prefix <- c("cheap", "budget")
roots <- c("car insurance", "auto insurance")
suffix <- c("quote", "quotes")
prefix2 <- c("cheap", "budget")
roots2 <- c("car insurance", "auto insurance")
roots3 <- c("car insurance", "auto
2003 Sep 04
1
error in lm.fit
Hello R user,
I have several data frames with >100 columns and I did a linear regression
over time of each column
df1.lm <- lapply(df1, function(x) lm(x~year)$coeff[2])
that worked fine and I get slope of each column oder time - until I divided
df1 by df2
df3 <- df1/df2
> df3.lm <- lapply(df3, function(x) lm(x~year)$coeff[2])
Error in lm.fit(x, y, offset = offset, ...) :
2011 Mar 18
1
Problem with Slope.test function
Hi all,
I need to test the significnce of difference between slopes of two regression lines and regression line with theoretical line. I try to use Slope.test function from emu package,
but an error occured...
library(emu)
d1<-data.frame(P1=c(1,2,3,5,7,8,9,13,14,15),
P2=c(1,2,5,8,11,13,15,15,18,24),
R=c(2,7,8,9,16,21,27,31,33,36)) # First data set
m1<-lm(R~P1+P2+P1*P2,data=d1) # Regr.
2010 Nov 11
4
How to get a specific named element in a nested list
Hello,
I have a nested named list structure, like the following:
x <- list(
list(
list(df1,df2)
list(df3,
list(df4,df5))
list(df6,df7)))
with df1...d7 as data frames. Every data frame is named.
Is there a way to get a specific named element in x?
so, for example,
x[[c("df5")]] gives me the data frame 5?
Thank you in advance!
Best,
Friedericksen
2010 Dec 16
2
Compare two dataframes
Hello,
I have two dataframes DF1 and DF2 that should be identical but are not
(DF1 has some rows that aren't in DF2, and vice versa). I would like
to produce a new dataframe DF3 containing rows in DF1 that aren't in
DF2 (and similarly DF4 would contain rows in DF2 that aren't in DF1).
I have a solution for this problem (see self contained example below)
but it's awkward and
2009 Oct 07
1
merging dataframes with an unequal number of variables
Hallo Everyone
I have the kind of problem that one should never have because one must
always plan well and communicate with your team. But now I haven't so here
is my problem.
I have data coming in on a daily basis from surveys in 10 towns. The
questionnaire has 62 variables but some of the regions have used older
versions of the questionnaire that have a few variables less. I want to
combine
2018 Nov 10
2
Asignar distancias
Utilizo la función merge desde hace poco, pero no se me ocurre cómo
utilizarla para esto. Yo pienso que se puede hacer con una combinación
de ifelse-s pero no sé cómo. Seguro que hay más de una forma ce hacerlo.
Quoting José María Mateos <chema en rinzewind.org>:
> On Sat, Nov 10, 2018 at 07:54:19PM +0100, Manuel Mendoza wrote:
>> Muy buenas. A ver si alguien puede echarme
2017 Jan 16
2
Error al fusionar tablas
Buenas tardes,
Estoy tratando de fusionar dos data.frames pero no obtengo lo deseado.
Un data.frame (Df1)tiene 53.657 observaciones (y 8 variables) que
pertenecen una a cada individuo de la muestra. El otro (Df2) tiene 63.987
observaciones (y 17 variables), de los 53.657 individuos previos porque
algun individuo tiene varias observaciones. Ambos solo coinciden por la
variable
2013 Sep 22
2
Coding several dummy variables into a single categorical variable
Colleagues,
I have generated several dummy variables:
n$native0 <- 1 * (n$re=="white" & n$usborn=="yes")
n$native1 <- 1 * (n$re=="afam" & n$usborn=="yes")
n$native2 <- 1 * (n$re=="carib" & n$usborn=="yes")
n$native3 <- 1 * (n$re=="carib" & n$usborn=="no")
I would now like to combine these
2010 Jan 22
2
Question on Merge/Lookup
I need to merge three datasets and don't know how. If I were using SQL, I
would use df3, look up the characteristics of each date in df1 and the value
for each observation in df2.
df1 - unique list of Dates and characteristics of those dates
Date, YYYYMM, YYYYWW, DOW
df2 - the raw data
Date, Place, Value
df3 - all posibile combinations of Date + Place (via