read_jma: read csv data from jma web site

Description Usage Arguments Value Examples

View source: R/read_jma.R

Description

read csv data from jma web site

Usage

1
read_jma(from, to, phpsessid, wait = 30)

Arguments

from

Date

to

Date

phpsessid

php session id obtained by 'get_phpsessionid()'

wait

wait for given time after POST

Value

list of csv data (character), each csv can be processed with 'readr::read_csv()'

Examples

 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
library("lubridate")
library("readr")
library("purrr")
library("dplyr")

phpsessid <- get_phpsessionid()

# Site: Fukuchiyama, Kyoto
# Interval: from 2018-01-01 to 2018-12-31
# Data: Temperature and Precipitation

f <- read_jma(ymd("2018-01-01"), ymd("2018-12-31"), phpsessid)

# parse csv using readr
col_names <- c("Datetime", "Temp", "Temp_exists",
"Temp_quality", "Rain", "Rain_exists", "Rain_qality")
col_types <- cols(col_datetime("%Y/%m/%d %H:%M:%S"),
col_double(), col_integer(), col_integer(),
col_double(), col_integer(), col_integer())
d <- f %>%
  map(function(x){
    read_csv(x, col_names=col_names, col_types=, skip=5)
    }) %>%
    bind_rows()
head(d)

whatalnk/readjma documentation built on June 10, 2020, 10:28 a.m.