KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a data frame that looks like: ID Time U1 U2 U3 U4 ... 1 20 1 2 3 5 .. 2 20 2 5 9 4 .. 3 20 2 5 6 4 .. . . And I would need to keep it like: ID Time U 1 20 1 1 20 2 1 20 3 1 20 5 2 20 2 2 20 5 2 20 9 2 20 4 3 20 2 3 20 5 3 20 6 3 20 4 I tried with: X <- read.table("mydata.txt", header=TRUE, sep=",") X_D <- as.data.frame(X) X_new <- stack(X_D, select = -c(ID, Time)) But I haven't managed to get the data into that form. Honestly, I have little experience with stacking/transposing, so any help is greatly appreciated!
Tags (comma-separated)
Save Edits
Cancel