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?
使用seq
一种方法是df[seq(from = 5, to = nrow(df), by = 5), 2] <- 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.