# Goals: To write functions
#To write functions that send back multiple objects.
# FIRST LEARN ABOUT LISTS --
X = list(height=5.4, weight=54)
print("Use default printing --")
print(X)
print("Accessing individual elements --")
cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
# FUNCTIONS --
square <- function(x) {
R自己默认的有效数字到小数点第15位,超过15就四舍五入了。你可以自己验证以下逻辑语句。
>0.9999999999999999==1
[1] FALSE
>0.99999999999999999==1
[1] TRUE
>0.99999999999999995==1
[1] TRUE
>0.99999999999999994==1
[1] FALSE
如果是第一个0.9999999999999999,x向量自然没有不是整数的坐标,所以返回值是numeric (0)