# NOT RUN {
df3 <- data.frame(id = 1:4,
age = c(40,50,60,50),
dose.a1 = c(1,2,1,2),
dose.a2 = c(2,1,2,1),
dose.a14 = c(3,3,3,3))
gather_(df3,pivot = c("id","age"))
df4 <- gather_(df3,pivot = c("id","age"))
df5 <- rbind(df4,
data.frame(id=5, age=20,parameters="dose.a14",values=8),
data.frame(id=6, age=10,parameters="dose.a1",values=5))
spread_(df5,col_name="parameters",col_values="values",pivot=c("id","age"))
# }
Run the code above in your browser using DataLab