r R片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r R片段相关的知识,希望对你有一定的参考价值。

haproxy <- read.csv("some.csv")
options(digits.secs = 3)
haproxy$date<-as.POSIXct(haproxy$timestamp-28800,origin="1970-01-01",tz="UTC")
head(haproxy,10)


# find out qps , count of records per time series 
# per second split 
haproxy_qps <- data.frame(table(cut(haproxy_date, breaks="sec")))

# plot it 
plot(haproxy_qps,type="l")


# filter data based on filed value 
haproxy_pl <- subset(haproxy,type=='idx')


# plot qps
plot(table(cut(haproxy_ts$date, breaks="sec")),type="l")


# uniq values in col
unique(haproxy$pid)

# loop through pids 
for (p in unique(haproxy$pid) ) { print (summary(subset(haproxy,pid==p)$type) ) }

#doing math of col vals and adding new col with results
haproxy$req_lat <- (haproxy$Tt - haproxy$Ti)

plot(haproxy$date,haproxy$req_lat,type="l")


# percentage of requests with various HTTP responses
 x <- data.frame(table(hp_before$status))
 # add column names
 colnames(x) <- c('status','freq')
 # do the math 
 x$perc <- x$freq / sum(x$freq) *100
 
 
 # rename existing column name
library(data.table)
setnames(d, old = c('a','d'), new = c('anew','dnew'))




# various quantiles
with_numa_Ta = with_numa$Ta
quantile(with_numa_Ta, c(.10,.50,.75,.90,.99,.999))
#  10%   50%   75%   90%   99% 99.9% 
#   4     7    14   265   398  1577 

以上是关于r R片段的主要内容,如果未能解决你的问题,请参考以下文章

r 混合R片段

r R有用的代码片段

R 知识片段

R 知识片段

findViewById(R.id.videoView) 在片段中返回 Null (Android Studio)

r 计算管道的步骤(基本片段)