1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
library(tidyverse)
library(xlsx)
setwd('C:/Users/bunga/Desktop/Tableau/data')
data <- read.table('seoul_park_raw.txt', header=TRUE, sep='\t')
data <- as.tibble(data)
data <- data %>%
mutate(ym = (ym*100)%%100)
data <- data %>% select(-total)
data <- data[data['region'] != '합계',]
data <- data %>%
mutate(ord = as.numeric(gsub(',', '', ord)),
health = as.numeric(gsub(',', '', health)),
bicycle = as.numeric(gsub(',', '', bicycle)),
event = as.numeric(gsub(',', '', event)),
special = as.numeric(gsub(',', '', special)),
etc = as.numeric(gsub(',', '', etc))) %>%
mutate_all(~ifelse(is.na(.), 0, .))
write.table(data, file = "seoul_park.txt", sep = "\t", row.names = FALSE)
write.xlsx(data,file='seoul_park.xlsx', sheetName = 'Sheet1')
|