摘要:
A=outer(1:4, 1:30, function(x, y) 10*x + y);A i <- 1:4; j <- 1:30; # i and j ni<- length(i); nj <- length(j) # lengths of i and j y <- matrix(NA, nj, ni) # create a matrix with nj rows and ni colum...
阅读全文
摘要:
#求电费,<50,85折,50--120,50元/度,>120,1.15倍 myfunction 120) energyprice = deg*price*1.15 else if(deg 100) energyprice = deg*price*1.15 else if (poor == TRUE) energyprice = energyprice*0....
阅读全文
摘要:
rm(list = ls()) options(digits = 2) Student <- c("John Davis","Angela Williams","Bullwinkle Moose", "David Jones","Janice MaRkhammer","Cheryl Cushing"
阅读全文
摘要:
#chapter5 #### rm(list = ls()) round(333333.141592653,digits = -5) # x<-rnorm(1:9) x round(x,digits = 2) abs(-0.2) sqrt(c(64,81)) #开平方 ceiling(pi) #上限(天花板) pi floor(pi) #对应ceiling trunc(5....
阅读全文
摘要:
#chapter 3#### attach(mtcars) plot(wt,mpg) abline(lm(mpg~wt)) #adds a line of best fit title("regression of mpg on weight") detach(mtcars) pdf("mygraph.pdf") attach(mtcars) plot(wt,mpg) abline(lm...
阅读全文