Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #25387

Closed (moved)
(moved)
Open
Created Feb 28, 2018 by Karsten Loesing@karsten

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.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking