Displaying 20 results from an estimated 50000 matches similar to: "List of Data Frames"
2013 Jan 02
2
rbind: inconsistent behaviour with empty data frames?
The rbind on empty and nonempty data frames behaves inconsistently. I am
not sure if by design.
In the first example, first row is deleted, which may or may not be on
purpose:
df1 <- data.frame()
df2 <- data.frame(foo=c(1, 2), bar=c("a", "b"))
rbind(df1, df2)
foo bar
2 2 b
Now if we continue:
df1 <- data.frame(matrix(0, 0, 2))
names(df1) <- names(df2)
2004 Mar 09
5
Adding data.frames together
I have a series of data frames that are identical structurally, i.e. -
made with the same code, but I need to add them together so that they
become one, longer, data frame, i.e. - each of the slot vectors are
increased in length by the length of the added data frame vectors.
So if I have df1 with a slot A so that length(df1$A) = 100 and I have
df2 with a slot A so that length(df2$A)=200 then I
2007 Jul 03
2
vertically concatenating data frames
Hi,
what is the recommended way to vertically concatenate 2 data frames with
the same column names but different number of rows?
My problem is something along these lines:
df1 <- data.frame(var1=var1,var2=var2,var3=var3) # nrow(df1)=1000
df2 <- data.frame(var1=var4,var2=var5,var3=var6) # nrow(df2)=2000
I tried df <- c(df1,df2), no success. stack does not seem to be
appropriate
2012 Oct 11
3
Sorting a data frame by specifying a vector
Hello all,
I cannot seem to figure out this seemingly simple procedure.
I want to sort a data frame by a specified character vector.
So for :
df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs=
runif(length(rep(c("Summer","Fall","Winter","Spring"),4))))
I want to sort the data frame
2006 Sep 19
4
Union of two data frames
Hi,
I have two data frames each with 5 columns and different number of
rows. some of the row names in one data frame are the same as the row
names in the other. I want to be able to merge the two data frames to
get a new data frame in which the duplicated row names are only shown
once with the data for the rest of the columns used from the first
data frame.
Essentially, I want to make a union
2010 Sep 04
4
Please explain "do.call" in this context, or critique to "stack this list faster"
I've been doing some consulting with students who seem to come to R
from SAS. They are usually pre-occupied with do loops and it is tough
to persuade them to trust R lists rather than keeping 100s of named
matrices floating around.
Often it happens that there is a list with lots of matrices or data
frames in it and we need to "stack those together". I thought it
would be a simple
2010 Jan 20
1
Merge and join data
Hi,
I'm looking to combine two data frames. Several of the columns are in
common while the others need to be summed up. The apply functions and
the merge functions don't seem to be working. I've included a basic
example of what I'm trying to do below. Thanks!
Sean
data.frame1<-as.data.frame(matrix(c('winter','dredge','515',100,150),1,5))
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 Jan 17
2
Prediciting sports team scores
I am working on predicitng the scores for a days worth of matches of team
sports. I have already collected data for the teams for the season we are
concentrating on.
I have been fitting poisson models for football games and have worked out
what model is best and which predictor variables are most important.
We would now like to predict the probability distribution for the scores for
each team.
2006 Sep 23
3
Data frames questions
Hi there, couple of questions on data frames:
1) Is there a way to build an empty data frame, containing nothing but the
data frame variable names?
2) Is there a way to reorder the variables in a data frame, e.g. When I go
to write out a data frame using write.table or write.matrix, I want the
output in a certain order...
3) How to I "append" to the bottom of a dataframe?
Thanks!
--j
2007 Oct 25
1
Appropriate measure of correlation with 'zero-inflated' data?
I have reached the correlation section in a course that I teach and I
hit upon the idea of using data from the weekly Bowl Championship
Series (BCS) rankings to illustrate different techniques for assessing
correlation.
For those not familiar with college football in the United States
(where "football" refers to American football, not what is called
soccer here and football in most
2011 May 16
2
rbind with partially overlapping column names
Hello,
I would like to merge two data frames with partially overlapping column
names with an rbind-like operation.
For the follow data frames,
df1 <- data.frame(a=c("A","A"),b=c("B","B"))
df2 <- data.frame(b=c("b","b"),c=c("c","c"))
I would like the output frame to be (with NAs where the frames don't
2011 May 24
2
plotting single variables common to multiple data frames
Hello all,
I have files (see attached) which are created daily. I want to load
about a weeks worth of them (7 daily files) and plot a weeks worth of
one variable together. So one variable name is delta_D_H. I would like
to plot this variable from all 7 days on one plot. I'm having trouble
figure out how to do this.
I've loaded them all up using this
time=Sys.time()
t1<-
2018 Feb 27
3
Aggregate over multiple and unequal column length data frames
Thank you Pikal and Bert. My apology for posting parts of my previous
email in HTML. Bert's suggestion will work but i am wondering if there
is an alternative
especially in the case where the data frames are big; that is the
difference in lengths among them is large. Below is a list of sample
date frames and desired result.
EK
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
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
2012 Nov 12
3
select different variables from a list of data frames
Hi:
How do I select different variables from a list of data frames.
I have a list of 13 that looks like below. Each data frame has more variables than I need. How do I go through the list and select the variables that I need.
In the example below, I need to get the variables "a", and "q10" and "q14" to be returned to two separate data frames.
Thank you.
Yours, Simon
2017 Jan 16
2
Error al fusionar tablas
Holabueno, aunque hay muchas posibilidades para fusionar ambas tablas, usando la tuya sería algo así:Df3<-merge(Df1,Df2,by="Reviewer.Username", all = TRUE)
El Lunes 16 de enero de 2017 20:08, Jesús Para Fernández <j.para.fernandez en hotmail.com> escribió:
Los data.frames para unirlos lo mejor es que tengan el mismo numero de columnas o variables.
El dataframe2
2010 Nov 03
2
biding rows while merging at the same time
Hello!
I have 2 data frames like this (well, actually, I have 200 of them):
df1<-data.frame(location=c("loc 1","loc 2","loc
3"),date=c("1/1/2010","1/1/2010","1/1/2010"), a=1:3,b=11:13,c=111:113)
df2<-data.frame(location=c("loc 1","loc 2","loc
2008 Sep 14
5
difference of two data frames
Hello
I have 2 data frames DF1 and DF2 where DF2 is a subset of DF1:
DF1= data.frame(V1=1:6, V2= letters[1:6])
DF2= data.frame(V1=1:3, V2= letters[1:3])
How do I create a new data frame of the difference between DF1 and DF2
newDF=data.frame(V1=4:6, V2= letters[4:6])
In my real data, the rows are not in order as in the example I provided.
Thanks much
Joseph
[[alternative HTML version