Add comment section to CSV file headers
From #25382 (moved):
Starting suggestion:
##
## The Tor Project
##
# URL:
# https://metrics.torproject.org/networksize.html?start=2017-11-30&end=2018-02-28
# Parameters:
# networksize: start=2017-11-30 end=2018-02-28
#
# Legend:
# date: UTC date (YYYY-MM-DD) when relays or bridges have been listed as running.
# relays: average number on the given day.
# bridges: average number on the given day.
#
date,relays,bridges
2017-11-30,6512,1955
2017-12-01,6629,1959
2017-12-02,6647,1963
2017-12-03,6650,1976
...
We need to use write.table, for example:
## the data summary
summary(y)
date users downturns upturns lower upper
2018-01-01: 1 Min. :716.0 Mode :logical Mode :logical Min. :165.0 Min. :1039
2018-01-02: 1 1st Qu.:755.0 FALSE:58 FALSE:58 1st Qu.:403.5 1st Qu.:1106
2018-01-03: 1 Median :780.0 Median :455.0 Median :1173
2018-01-04: 1 Mean :778.9 Mean :444.1 Mean :1179
2018-01-05: 1 3rd Qu.:802.5 3rd Qu.:496.2 3rd Qu.:1225
2018-01-06: 1 Max. :858.0 Max. :593.0 Max. :1584
(Other) :52
# writing
write("# some comments", file="data.csv")
write("# some more comments", file="data.csv", append = TRUE)
write.table(y, file="data.csv", append = TRUE, quote=FALSE, sep=",", row.names = FALSE)
Yields:
# some comments
# some more comments
date,users,downturns,upturns,lower,upper
2018-01-01,787,FALSE,FALSE,369,1319
2018-01-02,754,FALSE,FALSE,427,1268
2018-01-03,791,FALSE,FALSE,485,1107
2018-01-04,823,FALSE,FALSE,452,1119
...
We'll be able to re-use quite some content from the current stats.html.