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  -1.400043517 Landings Prediction
#> 2   0.255317055 Landings Prediction
#> 3  -2.437263611 Landings Prediction
#> 4  -0.005571287 Landings Prediction
#> 5   0.621552721 Landings Prediction
#> 6   1.148411606 Landings Prediction
#> 7  -1.821817661 Landings Prediction
#> 8  -0.247325302 Landings Prediction
#> 9  -0.244199607 Landings Prediction
#> 10 -0.282705449 Landings Prediction