I have a data frame that measures vertical movement of multiple objects with unique ID's. I want to rescale the X,Y coordinates from pixels to cm by using the rescale package. Each object has a minimum value of 0cm and maximum of 12.5cm, but the pixel lengths are all different because some objects were closer and some further away. I wanted to group my data by unique ID, and then rescale between 0 and 12.5cm. This is the code I used:
Data <- Data %>%
group_by(ID) %>%
rescale(Data$Y, to = c(0, 12.5), from = range(Data$Y, na.rm = TRUE, finite = TRUE))
I think I am grouping my data wrong, because I keep getting the following error:
Error in UseMethod("rescale") :
no applicable method for 'rescale' applied to an object of class "c('grouped_df', 'tbl_df', 'tbl', 'data.frame')"
Any suggestions for how to format this?