similar to: Identical data frames

Displaying 20 results from an estimated 10000 matches similar to: "Identical data frames"

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.
2012 Mar 14
3
merge bug fix in R 2.15.0
Is it intended that the first suffix can no longer be blank? Seems to be caused by a bug fix to merge in R 2.15.0. $Rdevel --vanilla DF1 = data.frame(a=1:3,b=4:6) DF2 = data.frame(a=1:3,b=7:9) merge(DF1,DF2,by="a",suffixes=c("",".1")) Error in merge.data.frame(DF1, DF2, by = "a", suffixes = c("", ".1")) : there is already a column
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
2010 May 14
2
operations between two aggregated data frames?
Hi All, I've come up with a solution for this problem that relies on a for loop, and I was wondering if anybody had any insight into a more elegant method: I have two data frames, each has a column for categorical data and a column for date. What I'd like to do, ideally, is calculate the number of days between all pairs of dates in data frame 1 and data frame 2 (*but only for members
2004 Feb 05
2
Histograms by two factors
Hi I am trying to print out means, STDs and histograms under two sets of factors. I can manage it for one set - see below but not for two sets. That is, I want ot print out the mean STD and Histogram for each ITEM code within each DELIVERABLE code. In addition I can only get to view the histogram for the last item. How do you get R to stop overriding the histogram for eg level 1 for factor 1
2013 Jan 15
1
SQLDF column errors
I am trying to exclude integer values from a small data frame 1, d1 that have matching hits in data frame 2, d2 (Very big) which involves matching those hits first. I am trying to use sqldf on the df's in the following fashion: df1: V1 12675 14753 16222 18765 df2: head(df2) V1 V2 13647 rd1500 14753 rd1580 15987 rd1590 16222 rd2020.....
2009 Jan 18
1
Multiplication of dataframes
If I have 2 data frames; df1: dim(df1) = (1,10) df2: dim(df2) = (2000,10) Both with column header names, how do I multiply them together please. I.e create a dateframe dim() = (2000,1) Many Thanks in advance Glenn [[alternative HTML version deleted]]
2010 Oct 20
2
rowsum
Hello, I am trying to achieve something which I *think* is possible using rowsum, but a little help should be useful: Consider the following dataframe DF0: A B C 89 1 140 89 06 20 89 29 137 89 52 13 89 57 10 89 97 23 89 1 37 89 1 12 89 1 3 52 1 11 52 1 31 52 1 16 52 1 6 52 1 10 52 1 13 52 1 10 52 1 25 52 1 2 52 59 38 52 97 75 57 1 14 57 1 13 57 1 14 57 114 12 57 1 23 57 06 26 I need create a
2005 Nov 10
3
Remove levels
Daer All, I have a factor variable, X with 5 levels. When I type tables(X) it gives me: table(X) 1 2 3 4 5 10 5 0 0 0 How to drop the levels with zeros such that when I will type: table(X) it will give me: table(X) 1 2 10 5 Thank a lot, Bernard --------------------------------- [[alternative HTML version deleted]]
2008 Jan 30
4
boxplot and number of observations per box
Dear all, How can I plot the number of observations per box in a boxplot. Many thanks, Bernard --------------------------------- [[alternative HTML version deleted]]
2005 Sep 08
5
data manipulation
Dear All, I would be grateful if you can help me. My problem is the following: I have a data set like: ID time X1 X2 1 1 x111 x211 1 2 x112 x212 2 1 x121 x221 2 2 x122 x222 2 3 x123 x223 where X1 and X2 are 2 covariates and "time" is the time of observation and ID indicates the
2005 Oct 06
3
Singular matrix
Dear All, I have written the following programs to find a non-singular (10*10) covariance matrix. Here is the program: nitems <- 10 x <- array(rnorm(5*nitems,3,3), c(5,nitems)) sigma <- t(x)%*%x inverse <- try(solve(sigma), TRUE) while(inherits(inverse, "try-error")) { x <- array(rnorm(5*nitems,3,3), c(5,nitems)) sigma <- t(x)%*%x inverse <-
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)
2007 Nov 19
4
sequence of vectors
Dear All, I wonder if there is any R function to generate a sequence of vectors from existing ones. For example: x 1<- c(1,2,3) x2 <- c(4,5) x3 <- c(6,7,8) The desired output is a list of all 3*2*3 = 18 possible combinations of elements of x1,x2 and x3. One element for example is (1,4,6). Many thanks in advance, Bernard
2005 Dec 20
2
Time data
Dear All, I wonder how to compute the age from the date of birth and the date of examination. Suppose that have the following data: df <- as.data.frame(rbind(c(1,"10/08/1950","15/03/1998"), c(1,"10/08/1950","20/07/1998"), c(1,"10/08/1950","23/10/1998"))) names(df) <- c("ID", "date_birth",
2005 Jun 09
1
Subassignments involving NAs in data frames
I'm seeing some inconsistent behavior when re-assigning values in a data frame. The first assignment turns all of the 0s in my data frame to 2s, the second fails to do so. > df1 <- data.frame(a = c(NA, 0, 3, 4)) > df2 <- data.frame(a = c(NA, 0, 0, 4)) > df1[df1 == 0] <- 2 ## Works > df2[df2 == 0] <- 2 Error: NAs are not allowed in subscripted assignments Checking an
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)
2008 Dec 28
2
Conditional operation on multiple columns from two data frames
Hi- I have two data frames for which I wish to conditionally subtract the values of one dataframe from the other. I want to subtract df1$x from df2$x when their id is equal and the absolute value of difference between the dates is 12 hours or less. If there is no match of equal id's and dates less than 12 hours apart I want it to return "NA". Note that df1 has missing values in x
2008 Apr 04
0
Loosing attributes while binding data frames ...
Hello I want to keep track of my units in the data frame. I have been advised in the past on this list to create a new "units" attribute of the data frame and keep the units strings there. It works fine as long as I don't manipulate the data frame. Here's an example: -------------CODE BEGIN ----------------------- df1 <- data.frame(x = 1:10, y = runif(10))
2006 Feb 21
3
Compute a correlation matrix from an existing covariance matrix
Dear All, I am wondering if there is an R function to convert a covariance matrix to a correlation matrix. I have a covariance matrix sigma and I want to compute the corresponding correlation matrix R from sigma. Thank you very much, Bernard --------------------------------- [[alternative HTML version deleted]]