I'm trying to add a column to a dataframe and I'm using the rep() function. Why do the first line work, but the next one doesn't?
> S_Grime$Græsning=rep(1:2, 50:49)
> R_Grime$Græsning=rep(1:2, 34:27)
Error in rep(1:2, 34:27) : invalid 'times' argument
My data:
> head(S_Grime)
# A tibble: 6 x 3
Feltnummer value Græsning
<dbl> <dbl> <int>
1 1 6.26 1
2 2 5.72 1
3 3 8.74 1
4 4 5.33 1
5 5 6.23 1
6 6 8.67 1
> head(R_Grime)
# A tibble: 6 x 2
Feltnummer value
<dbl> <dbl>
1 2 2
2 3 2
3 4 2
4 5 2
5 7 2
6 11 2
> str(R_Grime)
tibble [61 x 2] (S3: tbl_df/tbl/data.frame)
$ Feltnummer: num [1:61] 2 3 4 5 7 11 12 13 14 15 ...
$ value : num [1:61] 2 2 2 2 2 2 2 2 4 2 ...
> str(S_Grime)
tibble [99 x 3] (S3: tbl_df/tbl/data.frame)
$ Feltnummer: num [1:99] 1 2 3 4 5 6 7 8 9 10 ...
$ value : num [1:99] 6.26 5.72 8.74 5.33 6.23 ...
$ Græsning : int [1:99] 1 1 1 1 1 1 1 1 1 1 ...