Suppose we have a vector of numbers that has 6 elements (e.g. 200001). We know from the codebook that the first 4 positions is year and the following 2 positions is country id. To extract information from this vector accordingly, we use command "substr."
# example
longvector <- 200001
country <- substr(longvector, start=5, stop=6)
1 day ago
1 comment:
Thanks for posting these R code snippits I find them very useful.
Post a Comment