首页 > 代码库 > R exercise
R exercise
data(USArrests)se <- function(x){v <- var(x); n <- length(x);return(sqrt(v/n))}se(c(45,2,3,5,76,2,4))length(x)source(‘mycode.R‘)save.image()library(DMwR)head(algae)algae[1:5,]hist(algae$mxPH)library(car)qq.plot()par(mfrow=c(1,2))boxplot(algae$oPO4,ylab="Orthoposphate(oPO4)")rug(jitter(algae$oPO4),side=2)###xyplotarticleHitsComments <- read.csv("http://www.headfirstlabs.com/books/hfda/hfda_ch12_articleHitsComments.csv",header=TRUE)head(articleHitsComments)library(lattice)xyplot(webHits~commentCount|authorName,data=http://www.mamicode.com/articleHitsComments)########regexhfhh <- read.csv("http://www.headfirstlabs.com/books/hfda/hfda_ch13_data_for_R.csv",header=TRUE)head(hfhh)newlastName <- sub("\\(.*\\)","",hfhh$LastName)head(newlastName)hfhh$LastName <- NULLhead(hfhh)hfhh["LastName"] <- newlastNamehead(hfhh)#sorthfhhSorted <- hfhh[order(hfhh$PersonID),]head(hfhhSorted,n=50)#delete duplicates datahfhhNamesOnly <- hfhhSortedhfhhNamesOnly$CallID <- NULLhfhhNamesOnly$Time <- NULLhfhhNamesOnly <- unique(hfhhNamesOnly)head(hfhhNamesOnly,n=50)write.csv(hfhhNamesOnly,file="hfhhNamesOnly.csv")
R exercise
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。