I have a dataframe with 100 columns. Each column represent a probability value.
I want to do scaling there and I am using the following transformation:
df <- df %>%
mutate_at(vars(specific_columns),
funs(function(x) {((x - min(x)) / (max(x) - min(x)))}))
But it doesn't work and doesn't produce the output I want.
For example the sample data is:
col1 col2 col3 col4 col5
0.014492754 0.014492754 0.014492754 0.014492754 0.014492754
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
0.028985507 0.028985507 0.028985507 0.028985507 0.028985507
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
0.014492754 0.014492754 0.014492754 0.014492754 0.014492754
0.014492754 0.014492754 0.014492754 0.014492754 0.014492754
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
0.010989011 0.010989011 0.010989011 0.010989011 0.010989011
0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
Error:
Error in mutate_impl(.data, dots) : Column
col1
is of unsupported type function