I have data like this:
Name Data
A 5
A 6
A -1
A -3
B 6
B 2
B -1
B 9
I want to normalize the data so the values are between -1 and 1. I also want to do group it by name.
Here is what I am trying:
library(dplyr)
library(scales)
df2 <- df %>%
group_by(name) %>%
rescale(Data,to=c(-1,1))
I get this error:
Error in UseMethod("rescale") : no applicable method for 'rescale' applied to an object of class "c('grouped_df', 'tbl_df', 'tbl', 'data.frame')"