I'm trying to crate a data.table with 3 vectors. Where vector A Trial = [a,b,c...n]
, vector B rep = [1,2,3,...,n]
and vector C plot = [r01, r02, r03,...,n]
where r= "rep" (replicates)
Example:
> trial <- c("a", "b", "c")
> plot <- c(101:103,201:203,301:303)
> rep <- c(1,2,3)
> trial
[1] "a" "b" "c"
> plot
[1] 101 102 103 201 202 203 301 302 303
> rep
[1] 1 2 3
> dt <- data.table(trial,plot,rep)
> dt
trial plot rep
1: a 101 1
2: b 102 2
3: c 103 3
4: a 201 1
5: b 202 2
6: c 203 3
7: a 301 1
8: b 302 2
9: c 303 3
> dt <- data.table(trial,rep,plot)
> dt
trial rep plot
1: a 1 101
2: b 2 102
3: c 3 103
4: a 1 201
5: b 2 202
6: c 3 203
7: a 1 301
8: b 2 302
9: c 3 303
Neither of these are quite correct.
I want rep to increment plot by 100 x rep + plot #.
For trial (x): rep 1, plot 1 -> 101
For trial (x): rep 1, plot 2 -> 102
For trial (x): rep 2, plot 1 -> 201
For trial (x): rep 2, plot 2 -> 202
etc.