嗨,我正试图用两列的数据框来装箱,就像这个
Percentage Value
100% 100
110% 110
120% 120
130% 130
150% 150
用户将输入3个变量,在本例中为起始值100,增长百分比,在本案中为10%,然后何时停止,在本案例中为目标值150(不必完全停止在值内,可以在值大于目标值时停止(。有人能帮我怎么做吗?
您可以看到,数据帧中的行数将根据用户输入而变化。
make_my_df <- function(starting = 100, growth = 10, stop = 150) {
data.frame(Value = seq(from = starting,
to = stop,
by = growth))
}
make_my_df() # Using defaults; enter other parameters as needed
#> Value
#> 1 100
#> 2 110
#> 3 120
#> 4 130
#> 5 140
#> 6 150