Skip to content
Prev 304015 / 398506 Next

Concatenating data frames in R versus SAS

There may be a more R-ish way to do this, but here is a function to get you started.  

SASrbind <- function(x, y) {
  x[,setdiff(names(y),names(x))] <- NA
  y[,setdiff(names(x),names(y))] <- NA
  rbind(x,y)
  }

wanted <- SASrbind(agency,prop)


Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204