질문이 있습니다.
질문내용은 객체지향 프로그래밍과 조금이라도 관련된 질문이지 않을까 싶습니다.
(객체지향 프로그래밍 대단하면서도 참 어려운 것 같습니다. ㅜㅜ)
This file contains hidden or 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
adm_cd7 <- c(1111010, 1111011, 1111012, 1111013, 1111014, 1111015, 1111016, 1111017, 1111018, 1114010, 1114011, 1114012, 1114013, 1114014, 1114015, 1114016, 1114017, 1117010, 1117011, 1117012, 1117013, 1120010, 1120011, 1120012, 1121510, 1123010, 1123011, 1126010, 1129010, 1129011, 1129012, 1129013, 1130510, 1132010, 1135010, 1138010, 1138011, 1141010, 1141011, 1141012, 1144010, 1144011, 1144012, 1147010, 1150010, 1150011, 1153010, 1153011, 1154510, 1156010, 1156011, 1156012, 1156013, 1159010, 1162010, 1165010, 1165011, 1168010, 1168011, 1171010, 1171011, 1174010, 1174011, 2611010, 2611011, 2611012, 2611013, 2611014, 2614010, 2614011, 2614012, 2617010, 2620010, 2620011, 2620012, 2623010, 2623011, 2626010, 2629010, 2629011, 2632010, 2635010, 2638010, 2641010, 2641011, 2644010, 2644011, 2644012, 2647010, 2650010, 2653010, 2671025, 2671031, 2671033, 2711010, 2711011, 2711012, 2711013, 2711014, 2711015, 2714010, 2714011, 2714012, 2714013, 2714014, 2717010, 2720010, 2723010, 2723011, 2723012, 2723013, 2726010, 272 |
This file contains hidden or 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
# 관심 검색키워드 입력 | |
search_word <- "토트넘" | |
# 해당키워드의 다음 검색쿼리 URL 생성, 네이버 검색쿼리 URL 생성 | |
search_url_daum <- sprintf("https://search.daum.net/search?nil_suggest=btn&w=tot&DA=SBC&q=%s", search_word) | |
search_url_naver <- sprintf("https://search.naver.com/search.naver?sm=tab_hty.top&where=nexearch&query=%s", search_word) | |
# 작업디렉토리의 data 폴더에 금일자 해당키워드 다음 검색화면 PNG 파일 스냅샷 저장, 네이버 검색화면 PNG 파일 스냅샷 저장 | |
webshot(search_url_daum, file = sprintf("data/daum_%s_%s.png", search_word, Sys.Date()), delay = 0.5) | |
webshot(search_url_naver, file = sprintf("data/naver_%s_%s.png", search_word, Sys.Date()), delay = 0.5) |
This file contains hidden or 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
readr::read_tsv(pipe("pbpaste")) | |
read.table(pipe("pbpaste"), header = T, sep = "\t") |
This file contains hidden or 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("XML", lib = "/usr/lib/R/library", repos = "http://www.omegahat.net/R") |
This file contains hidden or 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
# pacman 패키지가 설치되어 있어야 Gist 코드가 R에서 동작합니다. pacman 설치되어 있지 않다면 바로 아래 주석의 코드를 실행시켜서 pacman 패키지를 설치하세요. (온라인 상태이어야 하며, 주석을 해제하고 직접 실행해야 합니다.) | |
# install.packages("pacman") | |
# 현 Gist 에 올려진 R코드를 바로 실행하고 싶으시다면 아래 주석의 코드를 실행시키세요. (온라인 상태이어야 하며, 주석을 해제하고 직접 실행해야 합니다.) | |
# source("https://gist.githubusercontent.com/lovetoken/16f862394a7f541faafde067cee0bf77/raw/4c5ec3ff8b1ea8d1eaa9a058a3e227ff8152c2a9/R_packages_install_for_myself") | |
pacman::p_load( | |
aws.s3, | |
bigrquery, | |
BiocManager, |
This file contains hidden or 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
>>> iam = 1234; print(iam) | |
1234 | |
>>> ist = str(iam); print(ist) | |
1234 | |
>>> iam | |
1234 | |
>>> ist | |
'1234' |
This file contains hidden or 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
myfun1 <- function(input){ | |
# 함수 실행 조건 | |
stopifnot(input %>% is.numeric) | |
stopifnot(attributes(input)$div %>% is.numeric) | |
# 함수 본문 | |
div <- attributes(input)$div | |
return(sum(input)/div) | |
} |
This file contains hidden or 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
x <- 1:5 | |
attr(x, "div") <- 2 |