Skip to content

Instantly share code, notes, and snippets.

View jsaraviadrago's full-sized avatar
🎯
Focusing

Juan Carlos Saravia jsaraviadrago

🎯
Focusing
View GitHub Profile
library(tm)
library(SnowballC)
library(wordcloud)
library(RColorBrewer)
data <- readLines(file.choose())
mydata <- Corpus(VectorSource(data))
# Create repo in Github
# All of this has to be done in terminal
# Before doing this you have to go with the terminal to the folder that your files are
git init
git add .
git commit -m "First commit Message"
git remote add origin GitHub-repository-URL #Instead of GitHub-repository-URL put the URL from your Github repo
git push -u origin master
# All files will be up in the cloud.
### Tabla de sedes de 5 años con estudiantes de 5 años
#' @param data para ser usada
#' @param ... variables que uno utiliza para agregar y hacer la tabla
table5 <- function(data,...){
tabla <- data %>%
group_by(...) %>%
summarise(n=n()) %>%
mutate(PORCENTAJE = round(n/sum(n)*100,1),
#### Función para generar lista de duplicados ####
lisdup <- function(x,y) {
# Generar un listado de los duplicados
n_occur <- data.frame(table(x$y))
n_occur[n_occur$Freq > 1,]
x[x$y %in% n_occur$Var1[n_occur$Freq > 1],]
}
# Very simple update for the last version of R in UBUNTU
sudo apt-get update
sudo apt-get install r-base r-base-dev
sudo apt-get upgrade
###### Creando la funcion de ELO para futbol##############
# Weighted average of points obtained during the last four years.
# Importance of match
# Strength of opposing team
# Strength of the confederations are all taken into account
## The number of points for team i in a match between teams i and j is given by
#Equation:
# Note: this needs to be run in terminal
tar xf R-3.5.3.tar.gz # Unpack the R version you need to put in Ubuntu
cd R-3.5.3 # Set the directory
./configure # Assign it to the folder in computer
apt-get install gfortran libreadline-dev bzip2-dev liblzma-dev libcurl4-gnutls-dev
which R # it is usefull to know in which folder R uis running.
sudo make install # Sometimes there is a problem with R studio.
make check # Check if it is working properly.
# it is possible that when you open Rstudio you'll have the following message.