Skip to content

Instantly share code, notes, and snippets.

View berkorbay's full-sized avatar
🏄

Berk Orbay berkorbay

🏄
  • Tideseed
  • Istanbul, Turkey
  • 01:18 (UTC +03:00)
View GitHub Profile
#Akademik Bilişim 2016 - R ile Veri Analizi Kursu
#Eğitmenler: Mustafa Baydoğan ve Berk Orbay
#dplyr ve ggplot2 örnekleri
#Aşağıdaki satırları anlamanız önemli değil
rm(list=ls(all=TRUE)) #Ortamda bulunan bütün değişkenleri yok et.
gc() #Hafızayı temizle (garbage collection)
options(stringsAsFactors=FALSE) #data.frame yapısında characterleri factor değil character şeklinde tanımla
options(repos="https://cran.rstudio.com/") #R paketlerini indirirken bu depoyu kullan
#library(dplyr)
library(ggplot2)
#mydata<-read.table("~/Downloads/bcom.csv",sep=",",header=TRUE) %>% tbl_df
#md2<-mydata %>% mutate(Date=as.Date(as.character(Date),format="%b %d,%Y"))
#ggplot(md2,aes(x=Date,y=Price)) + geom_line()
###Data frame versiyonu
mydata<-read.table("~/Downloads/bcom.csv",sep=",",header=TRUE)
@berkorbay
berkorbay / first_time_use_learnfin.r
Last active November 8, 2016 09:43
These gists are specially created to initialize uslfin users.
#Part of the learnfin package tutorial.
#First set of experiments with (almost) default values.
####REQUIRED - CHANGE BELOW
setwd("Set this value to the path of the input parameters excel file.")
##Example MacOS, Linux setwd("~/Documents/learnfin_implementation/")
##Example Windows setwd("C:/Documents/learnfin_implementation/")
#The code below will do a series of experiments and return the summary results of those experiments.
#Experiment parameters are taken from the input_parameters.xlsx file.
@berkorbay
berkorbay / jaccard_examples.r
Created September 28, 2016 13:48
Jaccard distance
install.packages("readxl")
# install.packages("clusteval")
install.packages("prabclus")
install.packages("vegan")
library(readxl)
# library(clusteval)
library(prabclus)
library(vegan)
@berkorbay
berkorbay / r_ifttt_notification.r
Last active January 5, 2017 13:07
R ve IFTTT ile Notificaton Atmak
#R ile cep telefonuna notification gönderme kodu
#Detaylar için adresindeki yazıyı okuyun.
#httr paketi gerekli. Yuklemediyseniz yükleyin.
#install.packages("httr")
#Event adini girin.
event_name <- "R_ile_notification"
#Key değerini girin (kendinizinkiyle değiştirin)
@berkorbay
berkorbay / change_min_max_labels_shiny.R
Last active March 12, 2022 21:16
Changing the min/max labels in Shiny sliders
ui <- fluidPage(
tags$head(
#Using ionRangeSlider's javascript options you can hide/show selector labels and min/max labels
HTML("
<script>
$(document).ready(function(){
$(\".js-range-slider\").ionRangeSlider({
hide_min_max: false,
hide_from_to: true
@berkorbay
berkorbay / example_model_with_CART.R
Created April 12, 2017 07:14
This is an example code for BOUN58D project.
#Get the required libraries, install first if not installed.
options(dplyr.width=Inf)
library(boun58d) #Copy paste the necessary function if you cannot install this from github
library(tidyverse)
library(tidyquant)
library(rpart)
library(rpart.plot)
library(rattle)
set.seed(58) #Don't forget to set the seed for reproducibility
@berkorbay
berkorbay / annoying_problems.R
Last active January 21, 2019 08:18
write this to terminal if you have LC problems
## Rule 0: strings as factors!!!
options(stringsAsFactors=FALSE)
## To avoid quaint time zone issues, set to UTC if you are working on a single timezone
Sys.setenv(TZ="UTC")
## on_sys_locale_problems
sudo defaults write org.R-project.R force.LANG en_US.UTF-8 #Mac Terminal
Sys.setlocale("LC_ALL", 'en_US.UTF-8') #Linux R Console
Sys.setlocale(locale="Turkish_Turkey.1254") #Windows
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
@berkorbay
berkorbay / ab2018_gerekli_paketler.R
Last active January 29, 2018 08:30
Akademik Bilişim 2018 için gerekli paketler
#Customer Survey Data
survey_data <- data.frame(
customer = 1:16,
OS = c(0,0,0,0,1,0,0,0,1,1,0,1,1,1,1,1),
Price = c(6,7,6,5,7,6,5,6,3,1,2,5,2,3,1,2),
Software = c(5,3,4,7,7,4,7,5,5,3,6,7,4,5,6,3),
Aesthetics = c(3,2,4,1,5,2,2,4,6,7,6,7,5,6,5,7),
Brand = c(4,2,5,3,5,3,1,4,7,5,7,6,6,5,5,7)
)