r - cbind a vector of different length to a dataframe -


i have dataframe consisting of 2 samples. 1 sample has answered questionnaire state anxiety. case, have calculated vector somatic state anxiety following function "rowsums":

som_lp <- rowsums(sample1[,c(1, 7, 8, 10 )+108], na.rm = true) 

now add existing dataframe "data", function "cbind" doesn't work here, because of different lengths (dataframe 88, som_lp 59).

data <- cbind(data, som_lp)  

can me , there option calculate "som_lp" avoid different lengths?

we can use cbind.fill rowr

library(rowr) cbind.fill(data, som_lp, fill = na) 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -