我的代码如下:
read.csv("http://asic.gov.au/Reports/YTD/2018/RR20180420-001-SSDailyYTD.csv", skip=1, fileEncoding = "UTF-16", sep = "\t", header = FALSE)
Error in read.table(file = file, header = header, sep = sep, quote = quote, : no lines available in input
@hrbrmstr - 会话信息读数
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] stringr_1.3.0 RCurl_1.95-4.10 bitops_1.0-6 tidyr_0.8.0 lubridate_1.7.4
[6] zoo_1.8-1 ggplot2_2.2.1.9000 data.table_1.10.5 magrittr_1.5 dplyr_0.7.4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 bindr_0.1.1 munsell_0.4.3 colorspace_1.3-2 lattice_0.20-35
[6] R6_2.2.2 rlang_0.2.0 plyr_1.8.4 tools_3.5.0 grid_3.5.0
[11] gtable_0.2.0 withr_2.1.2 yaml_2.1.18 lazyeval_0.2.1 assertthat_0.2.0
[16] tibble_1.4.2 bindrcpp_0.2.2 purrr_0.2.4 glue_1.2.0 stringi_1.1.7
[21] compiler_3.5.0 pillar_1.2.2 scales_0.5.0.9000 pkgconfig_2.0.1
请帮助我!
答案 0 :(得分:5)
我也收到了错误。然而,这有效:
csv_url <- "http://asic.gov.au/Reports/YTD/2018/RR20180420-001-SSDailyYTD.csv"
download.file(csv_url, basename(csv_url))
read.csv(
basename(csv_url), skip = 1, fileEncoding = "UTF-16", sep = "\t", header = FALSE
)
如果您在https://bugs.r-project.org/bugzilla/上没有帐户,或者它不会让您创建一个帐户,请告诉我,我会在linux系统上测试后为您提交错误报告(我正在macOS以及是否可以将sessionInfo()
的输出添加到您的问题
我会注意到即使readr::read_tsv()
也存在此文件的问题,因此可能存在合法的编码问题,旧的R版本不那么严格。