Skip to contents

Useful for preparing data for facet plots, especially when combining many data sets or adding many columns

Usage

make_cols(x, new.cols)

Arguments

x

Data frame

new.cols

Matrix or data frame of values of new columns.

Examples

x<-data.frame(rnorm(10))
names(x)<-'est'
new.cols<-cbind('Landings','Prediction')
colnames(new.cols)<-list('source','response')
make_cols(x,new.cols)
#>           est   source   response
#> 1  -0.2473253 Landings Prediction
#> 2  -0.2441996 Landings Prediction
#> 3  -0.2827054 Landings Prediction
#> 4  -0.5536994 Landings Prediction
#> 5   0.6289820 Landings Prediction
#> 6   2.0650249 Landings Prediction
#> 7  -1.6309894 Landings Prediction
#> 8   0.5124269 Landings Prediction
#> 9  -1.8630115 Landings Prediction
#> 10 -0.5220125 Landings Prediction