Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何用R来近似一个数_R - Fatal编程技术网

如何用R来近似一个数

如何用R来近似一个数,r,R,在数学中,我们可以近似得出这样一个数字: 假设我们有x和y和这些值: x=0.35 及 y=0.67 那么x和y的近似值是,x=0.4和y=0.7 我想知道在r怎么做 round函数似乎无法处理此问题 带圆形: x <- 0.35 round(x,digits=1) # [1] 0.4 x带圆形: x <- 0.35 round(x,digits=1) # [1] 0.4 x它周围的函数运行良好,您需要使用它的方式是,您需要输入如下数字: x <- 0.34 round(x

在数学中,我们可以近似得出这样一个数字:

假设我们有
x
y
和这些值:

x=0.35

y=0.67

那么
x
y
的近似值是,
x=0.4
y=0.7

我想知道在r怎么做

round
函数似乎无法处理此问题

带圆形:

x <- 0.35
round(x,digits=1)
# [1] 0.4
x带圆形:

x <- 0.35
round(x,digits=1)
# [1] 0.4

x它周围的函数运行良好,您需要使用它的方式是,您需要输入如下数字:

x <- 0.34
round(x, digits = 1)
# [1] 0.3
x <- 0.37
round(x, digits = 1)
# [1] 0.4

x它周围的函数运行良好,您需要使用它的方式是,您需要输入如下数字:

x <- 0.34
round(x, digits = 1)
# [1] 0.3
x <- 0.37
round(x, digits = 1)
# [1] 0.4
x