Hello everyone! I hope you are doing well! I have a medical dataset with multiple temperature measurements per patient. (every 6 hours for 48 hours, 9 measurements per patient).
names(TempDataset)
[1] "Date" "MRN"
[3] "Age" "Gender"
[5] "Exclude" "Etiology"
[7] "Surivived to decannulation" "Survived"
[9] "Timetodecannul" "TimetoICUdischarge"
[11] "Temperature0hs" "Temperature6hs"
[13] "Temperature12hs" "Temperature18hs"
[15] "Temperature24hs" "Temperature30hs"
[17] "Temperature36hs" "Temperature42hs"
[19] "Temperature48hs"
All the temperature columns [11:19] are double. I want to create additional variables that can do summary statistics per patient. (Temperature range /patient, mean/ patient etc). Is that possible?
In the case example of range, I have tried to use the range function through mutate, to create a Temperaturerange variable, however it has not worked. Any ideas?
TempDataset %>%
- mutate(Temperaturerange = range(TempDataset$Temperature0hs,TempDataset$Temperature6hs,TempDataset$Temperature12hs,TempDataset$Temperature18hs
- ,TempDataset$Temperature24hs, TempDataset$Temperature30hs, TempDataset$Temperature36hs,TempDataset$Temperature42hs, TempDataset$Temperature48hs))
Error: Problem withmutate()
inputTemperaturerange
.
x InputTemperaturerange
can't be recycled to size 217.
i InputTemperaturerange
isrange(...)
.
i InputTemperaturerange
must be size 217 or 1, not 2.
Runrlang::last_error()
to see where the error occurred.
I am quite new to R so please excuse me if the question is considered simple or naive.