I want to transform this data.table (rows to column):
My problem:
id | TIME | VAR
----|------|-----
1 | 1991 | 3.5
1 | 1992 | 4.2
2 | 1991 | 3.4
2 | 1992 | 8.5
I need:
TIME | 1 | 2 |
-----|-----|-----|
1991 | 3.5 | 3.4 |
1992 | 4.2 | 8.5 |
I tested all of this options:
https://www.r-statistics.com/tag/transpose/ https://es.stackoverflow.com/questions/135093/c%C3%B3mo-transformar-filas-por-columnas-agrupando-una-variable
but all of these options are not suit for this problem.
Cheers