I am trying to reshape my data using the melt function. I successfully did it once importing data from a csv file, but somehow when I tried to do to data from an xlsx file the error popped up.
Here are my data
PAR T27 T25.5 T24 T22.5 T21 T19.5 T18 T16.5
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 0 0.06 0.06 0.06 0.06 0.06 0.06 0.06 0.06
2 6 1.44 1.67 1.63 1.6 1.6 1.42 1.54 1.47
3 18 3.78 4.94 4.88 4.68 4.72 3.87 4.34 4.08
4 35 5.06 7.63 7.7 7.05 7.04 5.23 5.7 5.2
5 61 5.68 8.97 9.47 8.41 8.18 5.72 6.04 5.46
6 93 5.51 8.49 9.47 8.3 7.68 5.35 5.57 5.01
7 121 4.35 6.83 8.07 6.97 6.29 4.43 4.4 4.08
8 195 3.21 5.28 6.55 5.44 4.82 3.19 3.29 2.96
9 268 1.91 2.88 3.6 2.96 2.74 1.66 1.77 1.3
Here are my codes which worked for the csv file and not for the xlsx file:
library(readxl)
RLCx <- read_excel("RLC.xlsx")
RLCx$PAR=as.character(RLCx$PAR)
RLCxmelt<-melt(RLCx, id = c("PAR"))
Error message that get is:
Error in match.names(clabs, names(xi)) :
names do not match previous names
The desired outcome (photo attached) is to have PAR column and T as independent variables.
I also tried to use melt(RLCx, measure vars. = ("PAR")
as well, but that didn't reshape the table in a sensible way. I'd appreciate if someone could help me out here. Thank you.