-
-
Save rrodrigueznt/2e9b032c7d6f214caf60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Load any library able to read Excel files | |
library(XLConnect) | |
## Load any library able to select a substring | |
library(stringr) | |
## Read file contents by naming file and sheet | |
IDIS.USC <- file.path("~/Dropbox/IDIS-devel/IDIS.activities.USC.20130415.xls") | |
Actividades <- readWorksheetFromFile(IDIS.USC, sheet="Actividades") | |
## Subset, transform and order the data frame | |
codes <- Actividades[,c("Rexistro","TipoAxuda")] | |
codes <- unique(codes) | |
codes <- transform(codes, Rexistro = str_sub(Rexistro,6,7)) | |
codes <- unique(codes) | |
codes <- codes[order(codes[,1],codes[,2]), ] | |
## Write out a CSV file complient with Excel 2011 for Mac OS X | |
write.csv(codes, file = "~/Dropbox/IDIS-devel/USC.projects.codes.lat1.csv", row.names = FALSE, fileEncoding = "latin1") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment