R:修订间差异
跳到导航
跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
(→範例) |
(→範例) |
||
第22行: | 第22行: | ||
dev.off() | dev.off() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== 外部連結 == | |||
* {{Official|https://www.r-project.org/}} {{en}} | |||
* [https://sweetcode.io/r-apache-log-analysis/ R for Apache Log Analysis: Get It Structured] {{en}} | |||
* [https://www.r-bloggers.com/log-file-analysis-with-r/ Log File Analysis with R] {{en}} | |||
[[Category:軟體]] | |||
[[Category:程式語言]] |
2020年12月5日 (六) 09:12的版本
R是一套程式语言,主力在统计运算。
安装
sudo apt install -y r-base
范例
library(ggplot2)
df <- read.table('blog.gslin.org_ssl-access.log.2.gz')
colnames(df) <- c('host', 'ident', 'authuser', 'date', 'timezone', 'request', 'status', 'bytes', 'referer', 'useragent', 'cipher')
head(df)
df$date=as.POSIXct(df$date, tryFormats=("[%d/%b/%Y:%H:%M:%S"))
head(df)
reqs=as.data.frame(table(df$date))
p <- ggplot(data=reqs, aes(x=as.POSIXct(Var1), y=Freq)) + geom_line() + xlab('Date') + ylab('Requests')
png('a.png', 720, 720)
print(p)
dev.off()