Skip to content

Instantly share code, notes, and snippets.

@guobl
guobl / abline.r
Created December 15, 2012 04:43
R Basic Functions
# This example code is to understand the usage of abline function.
library(TSA)
data(rwalk)
model1 = lm(rwalk ~ time(rwalk))
win.graph(width=4.875,height=2.5,pointsize=8)
plot(rwalk,type="o",ylab="y")
abline(model1) # add the fitted least square line from model1
#炼金术士成长之路(T1): http://www.dataanalysis.cn/alchemist/alchemist.html
QQ <- read.csv("http://www.dataanalysis.cn/doc/a/1/qq.csv")
#Solution for 1th question
A1 <- table(QQ$id)
A2 <- sort(A1,decreasing = T)
A2[1:10]
# 7cha18 6cha4376 4cha3875 8cha083 4cha698 1cha65314
# 1511 1238 1100 695 533 440