Thank you. I really appreciate the help so that my future questions will not lack in quality. So here is part of the Q_new data frame:
tibble::tribble(~Site.ID, ~Vol..mL., "H1", 63L, "H2", 82L, "H3",
69L)
#> # A tibble: 3 x 2
#> Site.ID Vol..mL.
#> <chr> <int>
#> 1 H1 63
#> 2 H2 82
#> 3 H3 69
Data frame Infil_Data.Time.1 looks like:
tibble::tribble(~m, ~Time, ~Site.ID, ~Vol..mL., NA, 0L, "H1",
63, NA, 30L, "H1", 62, NA, 60L, "H1", 60, NA, 90L, "H1",
59, NA, 120L, "H1", 58, NA, 150L, "H1", 56, NA, 180L, "H1",
54, NA, 210L, "H1", 52.5, NA, 240L, "H1", 50, NA, 270L, "H1",
48.5, NA, 300L, "H1", 46.5, NA, 0L, "H2", 82, NA, 30L, "H2",
77, NA, 60L, "H2", 73, NA, 90L, "H2", 68, NA, 120L, "H2",
65, NA, 150L, "H2", 61, NA, 180L, "H2", 56, NA, 210L, "H2",
52, NA, 240L, "H2", 47.5, NA, 270L, "H2", 42.5, NA, 300L,
"H2", 37.5)
#> # A tibble: 22 x 4
#> m Time Site.ID Vol..mL.
#> <lgl> <int> <chr> <dbl>
#> 1 NA 0 H1 63
#> 2 NA 30 H1 62
#> 3 NA 60 H1 60
#> 4 NA 90 H1 59
#> 5 NA 120 H1 58
#> 6 NA 150 H1 56
#> 7 NA 180 H1 54
#> 8 NA 210 H1 52.5
#> 9 NA 240 H1 50
#> 10 NA 270 H1 48.5
#> # ... with 12 more rows
And lastly, I want Infil_Data.Time to look like:
tibble::tribble(~m, ~Time, ~Site.ID, ~Vol..mL., 63L, 0L, "H1",
63, 63L, 30L, "H1", 62, 63L, 60L, "H1", 60, 63L, 90L, "H1",
59, 63L, 120L, "H1", 58, 63L, 150L, "H1", 56, 63L, 180L,
"H1", 54, 63L, 210L, "H1", 52.5, 63L, 240L, "H1", 50, 63L,
270L, "H1", 48.5, 63L, 300L, "H1", 46.5, 82L, 0L, "H2", 82,
82L, 30L, "H2", 77, 82L, 60L, "H2", 73, 82L, 90L, "H2", 68,
82L, 120L, "H2", 65, 82L, 150L, "H2", 61, 82L, 180L, "H2",
56, 82L, 210L, "H2", 52, 82L, 240L, "H2", 47.5, 82L, 270L,
"H2", 42.5, 82L, 300L, "H2", 37.5)
#> # A tibble: 22 x 4
#> m Time Site.ID Vol..mL.
#> <int> <int> <chr> <dbl>
#> 1 63 0 H1 63
#> 2 63 30 H1 62
#> 3 63 60 H1 60
#> 4 63 90 H1 59
#> 5 63 120 H1 58
#> 6 63 150 H1 56
#> 7 63 180 H1 54
#> 8 63 210 H1 52.5
#> 9 63 240 H1 50
#> 10 63 270 H1 48.5
#> # ... with 12 more rows
The code I wrote should give back the third data frame that I provided.
R1 <- 0
R2 <- 1
jeff <- while (!is.null(Q_new$Vol..mL)) {
for (x in 1:11) {
R1 <- R1 + 1 %>% assign(Infil_Data.Time.1$m, Q_new[R2,
1]) %>% (next)(x)
}
R2 = R2 + 1
}
#> Error in eval(expr, envir, enclos): object 'Q_new' not found