R语言 计算一个值的正切 – tan() 函数 R语言中的 tan() 函数用于计算作为参数传递给它的数值的正切值。 语法: tan(x) 参数: x: 数值 例子 1 : # R code to calculate tangent of a value # Assigning values to variables x1 <- -90 x2 <- -30 # Using tan() Function tan(x1) tan(x2)RCopy 输出 [1] 1.9952 [1] 6.405331RCopy 例2 : # R code to calculate tangent of a value # Assigning values to variables x1 <- pi x2 <- pi / 3 # Using tan() Function tan(x1) tan(x2)RCopy 输出 [1] -1.224647e-16 [1] 1.732051RCopy