(R) download V-dem

library(vdemdata)

library(data.table)

library(states)

vdem.raw <- data.table::setDT(vdemdata::vdem)

vdem.codebook <- data.table::setDT(vdemdata::codebook)

metrics<-c('v2x_libdem','v2x_polyarchy')

id.vars<-c('country_name', 'COWcode','histname' ,

           'codingstart_contemp', 'codingend_contemp','year',

           'e_pt_coup','e_civil_war',

           'e_miinterc','e_miinteco','v2expathhg',

           'v2expathhs','v2regimpgroup',

           'v2regsupgroupssize')

vars<-c(id.vars, metrics)

vdem<-vdem.raw[, ..vars]

rm(vdem.raw)

vdem <- vdem[year>1945]

setwd("C:/Users/jojoh/Desktop/20210904backup/dissertation_Data")

write.csv(vdem,

          "vdem.csv", na=".",row.names = TRUE, fileEncoding = "UTF-8")


Comments

Popular Posts