Skip to content

Instantly share code, notes, and snippets.

Avatar

Gergely Daróczi daroczig

View GitHub Profile
@daroczig
daroczig / get-data.R
Last active Nov 16, 2020
Number of R packages submitted to CRAN
View get-data.R
## original idea & report by Henrik Bengtsson at
## https://stat.ethz.ch/pipermail/r-devel/2016-February/072388.html
## This script downloads the list of currently published R packages
## from CRAN and also looks at all the archived package versions to
## combine these into a list of all R packages ever published on
## CRAN with the date of first release.
## CRAN mirror to use
CRAN_page <- function(...) {
@daroczig
daroczig / Dockerfile
Created May 14, 2015
R with Java Docker container based on https://github.com/rocker-org/rocker
View Dockerfile
## Start with the official rocker image (lightweight Debian)
FROM rocker/r-base:latest
MAINTAINER Gergely Daroczi <gergely.daroczi@card.com>
## Install Java
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" \
| tee /etc/apt/sources.list.d/webupd8team-java.list \
&& echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" \
| tee -a /etc/apt/sources.list.d/webupd8team-java.list \
View exercise.R
## load data
df <- read.csv('http://bit.ly/CEU-R-numbers')
## analyze the association between x and y
summary(df)
cor(df)
## ..
## visualize the association between x and y
plot(df)
@daroczig
daroczig / nemet.R
Created Dec 3, 2019
Hungarian - German words tester
View nemet.R
library(googlesheets)
library(logger)
library(crayon)
suppressPackageStartupMessages(library(data.table))
logpath <- '/tmp'
logpath <- getwd()
logfile <- file.path(logpath, paste0(as.integer(Sys.time()), '.log'))
log_appender(appender_file(logfile))
log_threshold(TRACE)
@daroczig
daroczig / matek.R
Last active Nov 10, 2019
Math exercises for a 8 yrs old in Hungarian language
View matek.R
## TODO R package
## TODO internation via yaml that also provides the list of languages for the UI
## TODO cli --ui hu --control en --number 1:20 ...
library(logger)
library(crayon)
library(reticulate)
num2words <- import('num2words')
## rich-iannone/UnidecodeR
@daroczig
daroczig / create-local-MRAN-snapshot.R
Created Oct 7, 2019
Create or update a local MRAN snapshot for a list of packages
View create-local-MRAN-snapshot.R
#!/usr/bin/env r
library(miniCRAN)
library(data.table)
library(pander)
library(logger)
library(magrittr)
library(docopt)
## #############################################################################
@daroczig
daroczig / szeged-2017-workshop.R
Created Apr 11, 2019
Visual Methods to Teach Multivariate Statistics with R (at) Challenges and Innovations in Statistics Education (Szeged, Hungary)
View szeged-2017-workshop.R
## intro slides: http://bit.ly/r-intro-slide
## basic operations
1 + 3
3*2
3^2
## constants
pi
"pi"
View iris demo.Rmd
---
title: "Iris teszt elemzés"
author: "Gergely"
date: "`r Sys.time()`"
output: html_document
---
Hello, markdown! Ez egy egyszerű szöveges dokumentum,
a szöveget a markdown jelölőnyelv segítségével tudunk formázni.
@daroczig
daroczig / server.R
Created Jun 29, 2015
Markdown preview via shiny, pandoc and rmarkdown
View server.R
library(shiny)
library(rmarkdown)
shinyServer(function(input, output) {
output$html = reactive({
t <- tempfile()
cat(input$markdown, file = t)
@daroczig
daroczig / BCE-MDDA-2018.R
Created Nov 19, 2018
BCE // Vállalati Pénzügyi Információs Rendszerek // 2018
View BCE-MDDA-2018.R
## #############################################################################
## PCA demo on image processing
## #############################################################################
download.file('http://bit.ly/nasa-image-pca', 'image.jpg') # mode = »bw«
library(jpeg)
img <- readJPEG('image.jpg')
str(img)