Skip to content

Instantly share code, notes, and snippets.

View rrodrigueznt's full-sized avatar
😁

Ricardo Rodríguez rrodrigueznt

😁
View GitHub Profile
#
options(stringsAsFactors=F)
#
#
# returns string w/o leading whitespace
trim.leading <- function (x) sub("^\\s+", "", x)
#
# returns string w/o trailing whitespace
trim.trailing <- function (x) sub("\\s+$", "", x)
#
#
#
library(readxl)
IGFAE_Budget201901241600 <- read_excel("C:/Users/Ricardo Rodríguez/Desktop/IGFAE.Budget201901241600.xlsx")
View(IGFAE_Budget201901241600)
#
IGFAEBudgetSummary <- aggregate(IGFAE_Budget201901241600$y2019, by=list(IGFAE_Budget201901241600$category), FUN=sum, na.rm=TRUE)
sum(IGFAE_Budget201901241600$y2019, na.rm = TRUE)
sum(IGFAEBudgetSummary$x)
#
#
library(openxlsx)
library(dplyr)
#
IGFAE_Budget <- openxlsx::read.xlsx("C:/Users/Ricardo Rodríguez/Universidade de Santiago de Compostela/IGFAE-EB - Documents/Strategy/IGFAE.Budget.xlsx")
IGFAE_Budget <- IGFAE_Budget %>% rename(gruposDeCostos = categoryToReport) %>% rename(ano = year)
#
IGFAE_BudgetSubset <- IGFAE_Budget[which(IGFAE_Budget$ano %in% c(2019,2020,2021)),]
#
print(format(round(addmargins(xtabs(amount ~ substr(concept,1,50) + ano, IGFAE_BudgetSubset[grepl('.*?', IGFAE_BudgetSubset$gruposDeCostos),c('concept','ano','amount')]), margin = 1)),decimal.mark=",", big.mark=".",small.mark=".", small.interval=3, nsmall=0), quote = FALSE)
Replace or delete certain characters from filenames of all files in a folder
https://stackoverflow.com/questions/16636996/replace-or-delete-certain-characters-from-filenames-of-all-files-in-a-folder
Dir |
Where-Object { $_.Name -match "\.(docx|pdf)x?$" } |
Rename-Item -NewName { $_.Name -replace "RL","RP" }
% IGFAE 2017 Thesis Report
<%
for (i in 1:nrow(IGFAEAR2017phd)) {
%>
<%= as.character(IGFAEAR2017phd[i,c('Title')]) %>\
<%= as.character(IGFAEAR2017phd[i,c('Author')]) %>\
<%= as.character(IGFAEAR2017phd[i,c('Tutors')]) %>
#
start_time <- Sys.time()
#
library(gistr)
#
options(github.username='rrodrigueznt', digits=3, stringsAsFactors=F)
#
AllMyGists <- gists("mineall")
#
listl <- as.numeric(length(AllMyGists))
RL1. Search for new physics at LHCb
RL1. Exploring dark sectors with the LHCb experiment at CERN
RL2. Unveiling the time structure of QCD collectivity
RL3. Studies in gauge/gravity duality
RL4. Ultra-high-energy cosmic ray and neutrino detection in astroparticle physics
RL5. Search of the nature of neutrinos with the NEXT-100 detector at the Underground Laboratory of Canfranc
RL6. Exotic properties of nuclei at the drip-line with active targets
RL6. Unveiling the interior of neutron stars with the R3B experiment at FAIR
RL7. A laser-generator of 11C for PET medical imaging pre-clinical studies
RL8. Gravitational waves & multi-messenger astronomy
#
options(stringsAsFactors=F)
#
#
# returns string w/o leading whitespace
trim.leading <- function (x) sub("^\\s+", "", x)
#
# returns string w/o trailing whitespace
trim.trailing <- function (x) sub("\\s+$", "", x)
#
#
library(gistr)
#
options(github.username='rrodrigueznt', digits=3, stringsAsFactors=F)
#
AllMyGists <- gists("mineall")
#
listl <- as.numeric(length(AllMyGists))
#
gists <- data.frame(
USCcode,origin,source,scope,total
2015-PN067,public,compet,nati,40384
2014-PI077,public,compet,euun,30250
2016-CE046,private,compet,regi,22002
2016-CE056,private,compet,regi,10000
2015-PN172,public,compet,nati,101990
2015-PN088,public,compet,nati,103140
2016-PN011,public,compet,nati,30699
2015-CE209,private,nocomp,nati,11500
2016-CE009,private,compet,regi,33981