-
Notifications
You must be signed in to change notification settings - Fork 0
/
12_3. 다양한형태의 데이터가져오기.R
55 lines (44 loc) · 1.37 KB
/
12_3. 다양한형태의 데이터가져오기.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#텍스트파일로 저장
write_tsv(r_excel,"C:/Users/jmlee/Desktop/easy_R/r_txt.txt")
#---------------------------------#
#open API
install.packages("XML")
library(XML)
#openAPI 인증키 발급받은 후 사용
url<-'http://openapi.seoul.go.kr:8088/7a4c6942446a6d6c3531746b657379/xml/SebcPublicEnterpriseKor/1/5/'
indata<-xmlToDataFrame(url)
View(indata)
#불필요한 정보 제거
indata<-indata[-1:-2,-1:-3]
View(indata)
#--------------------------------------#
#json파일
install.packages("jsonlite")
library(jsonlite)
#url에서 json데이터 가져오기
install.packages("curl")
library(curl)
data2<-fromJSON("https://api.github.com/users/hadley/orgs")
data2<-as.data.frame(data2)
View(data2)
#파일에서 json데이터 가져오기
data<-fromJSON("C:/Users/jmlee/Desktop/4학년 2학기/R기반빅데이터분석/easy_R/전국초등학교통학구역표준데이터.json")
names(data)
data<-as.data.frame(data$records)
View(data)
#---------------------------------------------#
#빅데이터 feather과 fst
install.packages("feather")
library(feather)
install.packages("fst")
library(fst)
#내장 데이터셋 확인
data()
View(mtcars)
#1억개의 난수생성->임의의 빅데이터 생성
data<-data.frame(number=rnorm(n=100000000))
dim(data)
#시간확인
system.time({
write.fst(data,"data.fst")
})