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
# Una vez teniendo lista la instalación de PostgreSQL y R: | |
# En el terminal: | |
pacman -S postgresql-libs | |
# Dentro de R instalar el paquete RPostgreSQL | |
install.packages("RPostgreSQL") | |
# Una vez realizado lo anterior se procede a realizar la conexión con: |
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
# Al instalar el paquete shiny aparace un error de dependenca de la libería later | |
# al tratar de instalarla antes aparece lo mismo, si se instala de github se instala | |
# sin problemas: | |
devtools::install_github('r-lib/later') | |
# Instalación de shiny server | |
aurman -S shiny-server | |
# Los ejemplo de shiny no están cuando se realiza la instalación desde aur | |
# Si se requieren hay que descargarlos de github: |
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
# El funcionamiento de bumblebee es bajo demanda | |
# Fuentes: | |
# https://wiki.archlinux.org/index.php/Bumblebee_(Español) | |
# https://wiki.archlinux.org/index.php/NVIDIA_(Español) | |
# https://wiki.archlinux.org/index.php/Nouveau_(Español) | |
# https://antergos.com/wiki/es/hardware/bumblebee-for-nvidia-optimus/ | |
# Editar el archivo /etc/mkinitcpio.conf | |
# poner MODULES=(nouveau) no MODULES="nouveau" como mencionan en algunos lugares como la wiki | |
sudo pacman -S bumblebee mesa xf86-video-intel bbswitch xf86-video-nouveau |
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
# GNU Screen - main configuration file | |
# All other .screenrc files will source this file to inherit settings. | |
# Author: Christian Wills - cwills.sys@gmail.com | |
# Allow bold colors - necessary for some reason | |
attrcolor b ".I" | |
# Tell screen how to set colors. AB = background, AF=foreground | |
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' |
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
urls <- c( | |
"http://stat.ethz.ch/R-manual/R-devel/library/base/html/connections.html", | |
"http://en.wikipedia.org/wiki/Xz", | |
"xxxxx" | |
) | |
readUrl <- function(url) { | |
out <- tryCatch( | |
{ | |
# Just to highlight: if you want to use more than one | |
# R expression in the "try" part then you'll have to |
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
result = tryCatch({ | |
is.numeric(1) | |
# return(TRUE) | |
# no poner return, ya que da error, solo poner TRUE al final si se quiere | |
# una salida TRUE | |
# TRUE | |
# return(0) | |
0 | |
}, warning = function(w){ | |
message("Warning") |
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
updateClob <- function(bd, tabla, condiciones = list(), actualizacion = list()){ | |
# Esta función no se recomienda utilizarla cuando el número de registros a | |
# actualizar es considerablemente grande, ya que descarga la información, | |
# la actualiza en R, la borra en Oracle y luego la vuelve a subir. | |
# | |
# La parte principal de esta función es: | |
# attr(datosOriginales$', names(conteoCaracteres), ', "ora.type") <- "clob"' | |
# que solo está disponible en la función dbWriteTable | |
# |
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
\documentclass{article} | |
\begin{document} | |
<<run-all, results='hide', message=FALSE>>= | |
library(xtable) | |
out = NULL | |
for (g in unique(mtcars$gear)) { | |
out = c(out, knit_child('template.Rnw', sprintf('gear-%s.tex', g))) | |
} |
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
library(Rcpp) | |
# Simple addition | |
add_r <- function(x, y, z) { | |
sum = x + y + z | |
return(sum) | |
} | |
cppFunction( | |
"int add_c(int x, int y, int z) { |
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
tFrame <- function(x) { | |
x <- t(x) | |
row_names <- row.names(x)[2:length(row.names(x))] | |
col_names <- x[1,] | |
x <- tbl_df(as.data.frame(x[2:nrow(x),])) | |
colnames(x) <- col_names | |
rownames(x) <- row_names | |
x <- dplyr::add_rownames(x, var = "strain") | |
x | |
} |