I have some trouble to convert my melted data from long to wide and also filter at the same time. I can proceed to subset before but I would like to do them at the same time and save them as different tables.
ID,freq,Subject,Time
aaaaa,5545,M1,0
aaaaa,5471,M2,0
aaaaa,5029,M3,0
aaaaa,4531,M1,3h
aaaaa,4523,M2,3h
aaaaa,3915,M3,3h
aaaaa,3800,M1,1day
aaaaa,3609,M2,1day
aaaaa,3427,M3,1day
bbbb,3426,M1,0
bbbb,3272,M2,0
bbbb,3266,M3,0
bbbb,5545,M1,3h
bbbb,5471,M2,3h
bbbb,5029,M3,3h
bbbb,4532,M2,1day
bbbb,4533,M3,1day
this is a snipnet from my data. I would like to obtain a table like below and save every subject in a different object(M1, M2, and M3...). I read and try to reshape and cast commands but could not manage what I need. how can you manage a table like below? Thank for the help and suggestions.
ID 0 3h 1day
aaaaa 5545 4531 3800
bbbb 3426 5545 4531