I have a df
like this:
X1 X2 X3 X4
Number 4 4 4 4
Number.1 2 3 3 2
And I'd like to transform it into this:
> X1
NA
4
2
NA
4
3
NA
4
3
NA
4
2
NA
How can I intercalate NA
with my df
like in the example?
So far I tried with sapply(df, function(x) NA, t(Number(y)))
but it retrieves an error... I know I have to use t()
to transpose my df
but how to add the NA
in between columns to rows?
Any suggestions?
Note: I am not new to R
but lately I have been having some issues... I searched all over StackOverflow but I could not find the answer.