I would like to update a data frame to add 10 columns with values based on another column
Starting with this
df <- data.frame(ID = 1:3, name = c("Bob", "Jim", "Fred"), endValue= c(3, 7, 4))
And ending with this
|ID|Name|endValue|A|B|C|D|E|F|G|H|I|J|
|1|Bob|3|Y|Y|Y|N|N|N|N|N|N|N|
|2|Jim|7|Y|Y|Y|Y|Y|Y|Y|N|N|N|
|3|Fred|4|Y|Y|Y|Y|N|N|N|N|N|N|
So each new record needs:
- the original contents
- Ten new columns
- A conditional value based on whether the endValue is less than or equal to the column no
Any help welcome...