Displaying 1 result from an estimated 1 matches for "df_wide".
Did you mean:
_wide
2005 Oct 31
0
Problem using reshape with missing values in idvar
...3/2005 220
My code is as follows:
df <- read.csv("df.csv") # Read .csv file into R
df.tt <- sequence(rle(df$ID)$length) # Create a sequence vector tt
based on the number of times ID appears
# Then reshape from long into wide format, with only the time-varying
variables repeated
df_wide <- reshape(cbind(df.tt,df),
idvar("ID","DOB","GENDER","ETHNICITY"), timevar="tt",direction="wide")
This testcase works fine.
Now taking a similar test case, with some missing values in the
idvar, like so,
ID DOB GENDER ETHNICITY...