乘以R的百分比增加 由 USA发布于 2020-05-18 00:08:08 rpercentagemultiplying 收藏 如何将数字乘以R的百分比增长。 43424增加120%将是43424 * 2 + 43424 * 0.2 我增加了200%+ 并且百分比也下降 评论 请 登录后发表观点 punde 2020-05-18 00:08:08 简单的情况: increase <- 1.20 start_value <- 43424 inc_value <- start_value * (1 + increase) If you don't want for some reason calculate the percentage, define a value without the %-sign percentage <- 120 increase <- percentage/100 start_value <- 43424 inc_value <- start_value * (1 + increase) If you just have values with % you could transform them into numerical values percentage <- c("120 %", "-200%") increase <- as.numeric(gsub("[[:space:]]*%", "", percentage))/100 start_value <- 43424 inc_value <- start_value * (1 + increase) The regular expression uses removes all spaces and a following %. Hope this solves your issue. 点赞 评论 到底啦
简单的情况:
If you don't want for some reason calculate the percentage, define a value without the
%
-signIf you just have values with
%
you could transform them into numerical valuesThe regular expression uses removes all spaces and a following
%
. Hope this solves your issue.