read_delim(filename, delim = "|")
intersect(
read_csv %>% args %>% as.list %>% names,
read_tsv %>% args %>% as.list %>% names
) %>% setdiff(c("file", "skip", "comment"))
## [1] "col_names" "col_types" "locale"
## [4] "na" "quoted_na" "quote"
## [7] "trim_ws" "n_max" "guess_max"
## [10] "progress" "skip_empty_rows" ""
col_positions
.
read_csv("x,y\n1,'a,b'", quote = "'")
## # A tibble: 1 x 2
## x y
## <dbl> <chr>
## 1 1 a,b
read_delim("x,y\n1,'a,b'", delim = ",", quote = "'")
## # A tibble: 1 x 2
## x y
## <dbl> <chr>
## 1 1 a,b
## col_namesが少ない
read_csv("a,b\n1,2,3\n4,5,6")
## Warning: 2 parsing failures.
## row col expected actual file
## 1 -- 2 columns 3 columns literal data
## 2 -- 2 columns 3 columns literal data
## # A tibble: 2 x 2
## a b
## <dbl> <dbl>
## 1 1 2
## 2 4 5
## データのcolumn数が合ってない
read_csv("a,b,c\n1,2\n1,2,3,4")
## Warning: 2 parsing failures.
## row col expected actual file
## 1 -- 3 columns 2 columns literal data
## 2 -- 3 columns 4 columns literal data
## # A tibble: 2 x 3
## a b c
## <dbl> <dbl> <dbl>
## 1 1 2 NA
## 2 1 2 3
## quoteの不整合
read_csv("a,b\n\"1")
## Warning: 2 parsing failures.
## row col expected actual file
## 1 a closing quote at end of file literal data
## 1 -- 2 columns 1 columns literal data
## # A tibble: 1 x 2
## a b
## <dbl> <chr>
## 1 1 <NA>
## 数字とchrが混在
read_csv("a,b\n1,2\na,b")
## # A tibble: 2 x 2
## a b
## <chr> <chr>
## 1 1 2
## 2 a b
## 多分csvではない `;`
read_csv("a;b\n1;3")
## # A tibble: 1 x 1
## `a;b`
## <chr>
## 1 1;3
tz
(timezone)な気がする。
同じだと怒られる。
parse_number("100.10.2,345", locale = locale(grouping_mark = ",", decimal_mark = ","))
## Error: `decimal_mark` and `grouping_mark` must be different
parse_number("100.10.2,345", locale = locale(grouping_mark = ".")) # ","がdecimal_marknに
## [1] 100102.3
parse_number("100.10.2,345", locale = locale(decimal_mark = ",")) # "."がgrouping_markに
## [1] 100102.3
読みとりとか?
shift_jis
‘read_csv2()’ uses ‘;’ for the field separator and ‘,’ for the decimal point. This is common in some European countries.
shift_jis
d1 <- "January 1, 2010"
parse_date(d1, "%B %d, %Y")
## [1] "2010-01-01"
d2 <- "2015-Mar-07"
parse_date(d2, "%Y-%b-%d")
## [1] "2015-03-07"
d3 <- "06-Jun-2017"
parse_date(d3, "%d-%b-%Y")
## [1] "2017-06-06"
d4 <- c("August 19 (2015)", "July 1 (2015)")
parse_date(d4, "%B %d (%Y)")
## [1] "2015-08-19" "2015-07-01"
d5 <- "12/30/14" # Dec 30, 2014
parse_date(d5, "%m/%d/%y")
## [1] "2014-12-30"
t1 <- "1705"
parse_time(t1, "%H%M")
## 17:05:00
t2 <- "11:15:10.12 PM"
parse_time(t2, "%I:%M:%OS %p")
## 23:15:10.12