dataframe - single quote in cbind for appending data to data frame in R -
i trying understand syntax in following line of code. single quote inside cbind function here? please explain example, if possible. complete code sample, please visit site.
type: 'after' : logical 'check' : vector if (after) cbind(data, ' ' = check) else cbind(' ' = check, data)
it's handy way give appended column empty (looking) name in resulting data.frame.
compare:
> data <- data.frame(a=1:3, b=4:6) > cbind(data, 1:3) b 1:3 1 1 4 1 2 2 5 2 3 3 6 3 > cbind(data, ' '=1:3) b 1 1 4 1 2 2 5 2 3 3 6 3 ## , see column name not empty... > names(cbind(data, ' '=1:3)) [1] "a" "b" " "
Comments
Post a Comment