Skip to content

Instantly share code, notes, and snippets.

View sbalci's full-sized avatar
🔬
🔬👀📑🗃📊🏨🗄📇📖⚗📝🎶📈📉📃🖍🔬🔬🏋🏻‍♂🚴🏻‍♂🚙👨‍💻🤷‍♂📸📺🎛🔭🔬💊🔐🍫🌸

Serdar Balcı sbalci

🔬
🔬👀📑🗃📊🏨🗄📇📖⚗📝🎶📈📉📃🖍🔬🔬🏋🏻‍♂🚴🏻‍♂🚙👨‍💻🤷‍♂📸📺🎛🔭🔬💊🔐🍫🌸
View GitHub Profile
@sbalci
sbalci / gist:42d03c24f1b72f2bd8a8c4cb198fa8ff
Created January 5, 2017 18:08 — forked from dantalus/gist:e181ea23abc6e82239ab
Summarize data using R for latex tables
summaryA <- function(data, ...){
# Example
#
# data <- data.frame("A" = rnorm(500, 0, 1),
# "B" = rnorm(500, 0, 1),
# "C" = factor(sample(c("Ca", "Cb"), 500, replace = T)))
#
# a <- summaryA(data)
#
Sex & 3 & & & & \\
\multicolumn{1}{r}{Male} & & 51\% & 50\% & 60\% \\
\multicolumn{1}{r}{Female} & & 49\% & 50\% & 40\% \\
Gestational Age (wks) & 0 & 40.3(39.3 to 41) & 40.3(39.3 to 41) & 40.1(39.4 to 41) \\
Birth weight (g) & 3 & 3460(3150 to 3770) & 3430(3120 to 3720) & 4390(4065 to 4605) \\
Birth length (cm) & 71 & 50.2(49 to 51.8) & 50(48.9 to 51.5) & 53(51.5 to 54) \\
Fat mass (\%) & 531 & 10.9(8.2 to 13.8) & 10.6(8 to 13.4) & 16(13.1 to 18.5) \\
Age (yrs) & 0 & 30(28 to 33) & 30(28 to 33) & 31(28 to 33) \\
Height (cm) & 0 & 165(161 to 168) & 165(161 to 168) & 165(160.2 to 169) \\
Weight (kg) & 0 & 65(59.2 to 74) & 65(60 to 74) & 65(58 to 75.8) \\
\documentclass{article}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{array}
\usepackage{float}
\usepackage[cm]{fullpage}
\begin{document}
\begin{tabular}{p{3.0cm}ccccc}
\toprule
@sbalci
sbalci / GIF-Screencast-OSX.md
Created April 19, 2017 18:17 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@sbalci
sbalci / SPSSimportRwithVariableLabels.R
Last active April 29, 2018 19:05
SPSS import R with Variable Labels
library(foreign) # foreign paketi yükleniyor
# read.spss komutu ile değer etiketlerini almasını ve bunu liste olarak değil de data.frame olarak kaydetmesini istiyoruz
mydata <- read.spss("mydata.sav", use.value.labels = TRUE, to.data.frame = TRUE)
# aktardığımız data.frame'in özellikleri (attr) içinde değişkenlerin etiketleri var, bunları dışarı çıkartıyoruz
VariableLabels <- as.data.frame(attr(mydata, "variable.labels"))
# elde ettiğimiz data.frame'deki satır isimleri değişkenlerin isimleri oluyor, karşılarında da değişken etiketleri var
# satır isimlerini de dışarı çıkartıyoruz
# https://github.com/spgarbet/tangram
# http://htmlpreview.github.io/?https://github.com/spgarbet/tg/blob/master/vignettes/example.html
library(tangram)
library(Hmisc)
getHdata(pbc)
# View(pbc)
table <- tangram(drug ~ bili + albumin + stage + protime + sex + age + spiders, data = pbc)
table
.Rproj.user
.Rhistory
.RData
.Ruserdata
@sbalci
sbalci / remove_password_excel.R
Created July 1, 2018 08:32 — forked from markheckmann/remove_password_excel.R
Remove sheet's password protection in Excel
# remove sheet protection in Excel
# Sample file: https://www.dropbox.com/s/4ul0kowrscyr8cz/excel_protected.xlsx?dl=0
library(stringr)
library(zip)
# file with protected sheets
file <- "data/excel_protected.xlsx"
# file name and path after removing protection
library(gganimate) # thomasp85/gganimate
library(cartogram)
library(geogrid) # Need github version jbaileyh/geogrid
library(rnaturalearth)
library(sf)
library(scico)
us <- ne_states('united states of america', returnclass = 'sf')
us <- us[!us$woe_name %in% c('Alaska', 'Hawaii'), ]
us <- st_transform(us, '+proj=eqdc +lat_0=39 +lon_0=-96 +lat_1=33 +lat_2=45 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs')
@sbalci
sbalci / RSelenium.R
Created July 14, 2018 21:02 — forked from HanjoStudy/RSelenium.R
useR2018
##########################################################
#
# HANJO ODENDAAL
# hanjo.oden@gmail.com
# www.daeconomist.com
# @UbuntR314
# https://github.com/HanjoStudy
#
#
# ██████╗ ███████╗███████╗██╗ ███████╗███╗ ██╗██╗██╗ ██╗███╗ ███╗