library(RMySQL)
mydb = dbConnect(MySQL(), user='cscw', password='cscw', dbname='datasets_p', host='paws-db')
Loading required package: DBI
dbSendQuery(mydb, 'use datasets_p;')
results <- dbSendQuery(mydb, 'select * from enwiki_sessions_20150801 limit 100000')
data <- fetch(results, n = -1)
<MySQLResult:(218,0,0)> 
data$cend <- as.POSIXct(data$end, format = "%Y%m%d%H%M%S")
data$cstart <- as.POSIXct(data$start, format = "%Y%m%d%H%M%S")
data$length <- data$cend - data$cstart
hist(as.numeric(data$length))
data$loglength <- log10(as.numeric(data$length))
hist(as.numeric(data$loglength))
Mode <- function(x) {
  ux <- unique(x)
  ux[which.max(tabulate(match(x, ux)))]
}
Mode(data$start)
clean_data <- subset(data, start = "20020225154311")
'20020225154311'
pos_clean_data <- subset(data, length > 0)
pos_clean_data$eps <- pos_clean_data$events / as.numeric(pos_clean_data$length)
subset(pos_clean_data, eps > 1)
user_textstartendindexeventscendcstartlengthloglengtheps
22926198.54.202.xxx2001122919104520011229191047232001-12-29 19:10:472001-12-29 19:10:452 secs0.301031.5
344930200202251543112002022515511567182002-02-25 15:51:152002-02-25 15:43:11484 secs2.6848451.483471
34518Conversion script200202251321332002022515511550278462002-02-25 15:51:152002-02-25 13:21:338982 secs3.9533733.1002
4947824.188.241.17120020523131707200205231317081022002-05-23 13:17:082002-05-23 13:17:071 secs02
52138217.162.214.7220020607201700200206072017011522002-06-07 20:17:012002-06-07 20:17:001 secs02
54017AxelBoldt200206161625532002061616255497322002-06-16 16:25:542002-06-16 16:25:531 secs02
56757Zoe20020701003429200207010034303922002-07-01 00:34:302002-07-01 00:34:291 secs02
install.packages("funFEM", repos='http://cran.us.r-project.org')
require(funFEM)
require(fda)
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
The downloaded source packages are in
	‘/tmp/Rtmpm7xf4Q/downloaded_packages’
basis <- create.bspline.basis(c(min(clean_data$cstart), max(clean_data$cend)), nbasis = 21, norder = 4)
fdobj <- smooth.basis(clean_data$cstart, clean_data$events, basis)
res = funFEM(fdobj, K = 4)
Error in resultat[[id_max]]: attempt to select less than one element
plot(fdobj)
'done'