Displaying 2 results from an estimated 2 matches for "col_mean_gg".
2017 Jul 20
2
dynamically create columns using a function
...class = "data.frame", row.names = c(NA, -6L))
# function demo_fn
demo_fn<- function (dat, blup_datacut = c("REG1", "REG2"))
{
for (i in seq_along(blup_datacut)) {
col_name_gg <- paste("GG", blup_datacut[i], sep = "_")
col_mean_gg <- paste("YLD_BE", blup_datacut[i], sep = "_")
dat2 <- calc_gg(dataset = dat, col = col_mean_gg, col_name = col_name_gg)
}
dat2
}
# function calc_gg
Calc_gg<- function (dataset, col, col_name)
{
mutate_call = lazyeval::interp(~round(((a - me...
2017 Jul 21
0
dynamically create columns using a function
...)
>
> # function demo_fn
>
> demo_fn<- function (dat, blup_datacut = c("REG1", "REG2"))
>
> {
>
> for (i in seq_along(blup_datacut)) {
>
> col_name_gg <- paste("GG", blup_datacut[i], sep = "_")
>
> col_mean_gg <- paste("YLD_BE", blup_datacut[i], sep = "_")
>
> dat2 <- calc_gg(dataset = dat, col = col_mean_gg, col_name =
> col_name_gg)
>
> }
>
> dat2
>
> }
>
>
> # function calc_gg
>
> Calc_gg<- function (dataset, col, c...