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
grade <- | |
as.data.frame(cbind( | |
ID = c(LETTERS[1:5]), | |
GPA = list('A+','F', c('C-','B','A+'), c('A','A+'), 'D') | |
)) | |
unstack <- function(grade){ | |
do.call(rbind, apply(grade, 1, function(x) | |
data.frame(ID = x$ID, GPA = x$GPA))) | |
} |
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(shiny) | |
library(ggplot2) | |
library(gapminder) | |
library(dplyr) | |
ui <- fluidPage( | |
titlePanel("ggplot test"), | |
sidebarPanel( |
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
function(input, output, session) { | |
# Combine the selected variables into a new data frame | |
selectedData <- reactive({ | |
iris[, c(input$xcol, input$ycol)] | |
}) | |
clusters <- reactive({ | |
kmeans(selectedData(), input$clusters) | |
}) |
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(rvest) | |
library(stringr) | |
dat<-c() | |
for (i in 1:2005){ | |
url<-paste0("http://www.bobaedream.co.kr/cyber/CyberCar.php?gubun=K&page=",i) | |
usedCar <- read_html(url) | |
title <- | |
usedCar %>% | |
html_nodes("td.carinfo a.title") %>% |
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(googleCloudStorageR) | |
library(dplyr) | |
library(bigrquery) | |
library(dbplyr) | |
# 필요 데이터를 다운로드 받습니다. | |
# dabrp_classnote3 프로젝트 폴더일 때를 기준으로 했습니다. | |
chk<-file.info("./data/recomen/tran.csv") | |
if(is.na(chk$size)){ |
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(dplyr) | |
library(ggplot2) | |
# showtext는 윈도우에서 출력시 폰트 문제가 발생하는걸 고칠 수 있게 도와줍니다. | |
# https://github.com/yixuan/showtext | |
library(showtext) | |
font.add.google("Noto Sans") | |
# q1에서 차용했습니다. 유용한 코드 공유 감사합니다! | |
format.percent <- function(x) paste(floor(x),'%',se1p='') |
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(rvest) | |
root<-"http://www.ts-hikaku.com/clist/a0/v1s22t0p" | |
tail<-".html" | |
options(stringsAsFactors = F) | |
dat<-c() | |
for(i in 1:34){ | |
print(i) | |
tar<-read_html(paste0(root,i,tail)) | |
company <- |
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
# loading packages | |
library(dplyr) | |
library(tidyr) | |
library(igraph) | |
# set sample data set | |
options(stringsAsFactors = F) | |
exd<-data.frame(comp=sample(LETTERS), | |
partner1=sample(LETTERS), |
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
install.packages("data.table") | |
library(data.table) |
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
# 샘플 데이터를 만듬 | |
testData <- data.frame(LET=sample(LETTERS,1000,replace = T), | |
NUM=sample(1:10,1000,replace = T), | |
stringsAsFactors = F) | |
# 데이터를 확인함 | |
head(testData,100) | |
# 정렬된 데이터를 확인함 |