r - Merge values of a factor column -


column data$form contains 170 unique different values, (numbers 1 ~800). merge values (e.g 10 radius/step).

i need in order use:

colors = rainbow(length(unique(data$form))) 

in plot , provide better visual result.

thank in advance help.

you can use %/% group them , mean combine them , normalize scale them.

 # if want 20 groups:  groups <- sort(form) %/% (800/20)    x <- c(by(sort(form), groups, mean))   x <- normalize(x, true) * 19 + 1          0         1         2         3         4   1.000000  1.971781  2.957476  4.103704  4.948560          5         6         7         8         9   5.950617  7.175309  7.996914  8.953086  9.952263         10        11        12        13        14  10.800705 11.901235 12.888889 13.772291 14.888889         15        16        17        18        19  15.927984 16.864198 17.918519 18.860082 20.000000  

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -