R rbind - unexpected symbol error when merging row

2019-07-18 08:47发布

问题:

I am trying to merge data vertically from two separate data frames as shown below. I believe I've met the criteria, namely both have the same column names. Does anyone see why I'm getting the error below?

> str(rnorm.SR.df)
'data.frame':   20 obs. of  2 variables:
 $ criticalMeasureCount: num  3.37 1.77 1.29 1.79 2.09 ...
 $ projectType        : chr  "SR" "SR" "SR" "SR" ...`

> str(rnorm.nonSR.df)
'data.frame':   30 obs. of  2 variables:
 $ criticalMeasureCount: num  3.635 1.057 0.836 3.722 5.887 ...
 $ projectType        : chr  "Non-SR" "Non-SR" "Non-SR" "Non-SR" ...
> rnorm.allprojects.df <- rbind(data rnorm.nonSR.df, data rnorm.SR.df)
Error: unexpected symbol in "rnorm.allprojects.df <- rbind(data rnorm.nonSR.df"

Thanks for your help

回答1:

Error: unexpected symbol in "rnorm.allprojects.df <- rbind(data rnorm.nonSR.df"

What is "data " doing there in "data rnorm.nonSR.df"? Just a typo, isn't it? Probably you meant:

rnorm.allprojects.df <- rbind(rnorm.nonSR.df, rnorm.SR.df)


标签: r rbind