1
0
Files
rises_declines_wikia_code/00_count_editors.R
groceryheist 72633c193b Initial commit
p#	new file:   runwikiq.sh
2018-06-02 15:32:19 -07:00

29 lines
1.1 KiB
R
Executable File

#!/usr/bin/env Rscript
## script that saves the number of unique editors to a wiki. For use with parallelsql
# Copyright (C) 2018 Nathan TeBlunthuis
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
source("lib-00-utils.R")
opt <- commandArgs(trailingOnly = TRUE)
input.dir <- "../wikiq_wikia_2010_all_nopersistance/"
output.dir <- "../wikiq_wikia_2010_unique_editors/"
d <- load.wikiq.file(paste0(input.dir,opt[1]))
n.editors <- length(unique(d[anon == FALSE & namespace == 0, editor.id]))
write(n.editors,file=paste0(output.dir,gsub("\\.tsv$",'.editors',opt[1])),append=FALSE)