Displaying 2 results from an estimated 2 matches for "cars1".
Did you mean:
cars
2010 Dec 16
2
Compare two dataframes
...DF and them comparing the two DFs
based on this unique ID.
Is there a better way?
Many thanks for your help,
Mark
#compare two dataframes and extract uncommon rows
#MAKE SOME DATA
cars$id<-paste(cars$speed,cars$dist,sep="") $create unique ID field by
pasting all columns together
cars1<-cars[1:35,]
cars2<-cars[16:50,]
#EXTRACT UNIQUE ROWS
cars1_unique<-cars1[cars1$id %in% setdiff(cars1$id,cars2$id),] #rows
unique to cars1 (i.e., not in cars2)
cars2_unique<-cars2[cars2$id %in% setdiff(cars2$id,cars1$id),] #rows
unique to cars2
2002 Jul 26
0
predict() still not yet "safe".. (PR#1840)
...= .....)
Here is a simple (longer than necessary) example
#### This modified from the last part of example(cars) {of R 1.5.1}:
data(cars)
## An example of polynomial regression
## -- to show the bug, the linear example is sufficient
cars.1 <- lm(dist ~ poly(speed, degree = 1), data = cars)
cars1 <- lm(dist ~ speed, data = cars)# the `same'
all.equal(predict(cars.1), predict(cars1))# the fitted values are ok
cars.4 <- lm(dist ~ poly(speed, degree = 4), data = cars)
newd <- data.frame(speed = d <- seq(0, 25, length = 51)) # shorter than in ?cars
pr1d <-...