Reputation: 1
I have a data frame uploaded from excel with 10 columns and 100 rows, and all the data is 0. Now I would like to change every 5th value in the second column to 1. Is this possible? If so, how?
Upvotes: 0
Views: 184
Reputation: 6768
One approach using seq
is df[seq(from = 5, to = nrow(df), by = 5), 2] <- 1
Upvotes: 1