Hey everybody,

I am working with the R Shiny currently and having a problem of converting the data from the wide format into long format.I have tried to use the "reshape2" package with the "melt" function just in the R Console and it was working fine to convert one variable type ("Weight_V1","Weight_V2","Weight_V3") into like what shown in the picture below with the new variable "Weight" and "Visit" (this one was converted and exported before using SAS program):

But my question is, Is it actually possible to convert more than one variable type for example not only for Weight (Weight_V1,Weight_V2,Weight_V3) but for BodyFat (BodyFat_V1,BodyFat_V2,BodyFat_V3) as well but still assigned to the same column for "Visit" and create other new column for the variable "BodyFat"???

This is how it looks like using the SAS code:

Results in SAS Program:

I was trying to find the solution in R Shiny and how it could be interactive for the user which mean that they could just write or choose from the Input which variables and convert it into the long format type of data like i did in SAS, but i couldn't find any solution for this problem. Do you have any idea for this?

I am quite new with R Shiny and I hope someone can help me with this one. Thanks a lot!!