简体   繁体   中英

Create a variable based on another in R

In R Studio, I would like to add a column which is "percentage of maximum load" (see on the pictures), based on the relative load in the same line, and the highest four-line value in the load column. Here the maximum should be "115" in the data.

数据

If I understand well, you could simply do something like that:

data$Percentage <- data$Load / max(data$Load)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM