从网页下载原始文本

我正在寻找从此网页下载所有数据:


https://download.bls.gov/pub/time.series/la/la.data.64.County

如果您打开它,如您所见,会弹出一堆文本数据,但页面很快就会冻结。我这样做的正常方法是:


1: ctrl+a

2: ctrl+c

3: ctrl+v into a text editor or excel

4: import that file into R

由于该页面几乎立即变得没有响应,因此我无法执行我通常会做的事情。


有任何想法吗?


慕斯王
浏览 80回答 3
3回答

临摹微笑

如果你想在 R 中使用这些数据,你可以使用freadfromdata.tablelibrary(data.table)df <- fread('https://download.bls.gov/pub/time.series/la/la.data.64.County')head(df)#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; series_id year period value footnote_codes#1: LAUCN010010000000003 1990&nbsp; &nbsp; M01&nbsp; &nbsp;6.4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#2: LAUCN010010000000003 1990&nbsp; &nbsp; M02&nbsp; &nbsp;6.6&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#3: LAUCN010010000000003 1990&nbsp; &nbsp; M03&nbsp; &nbsp;5.8&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#4: LAUCN010010000000003 1990&nbsp; &nbsp; M04&nbsp; &nbsp;6.6&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#5: LAUCN010010000000003 1990&nbsp; &nbsp; M05&nbsp; &nbsp;6.0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#6: LAUCN010010000000003 1990&nbsp; &nbsp; M06&nbsp; &nbsp;7.0&nbsp; &nbsp; &nbsp;&nbsp;数据很大,但似乎直接导入到 R 会话中。

狐的传说

你可以使用curl(Linux)curl https://download.bls.gov/pub/time.series/la/la.data.64.County -o data.txt

元芳怎么了

检查当前页面写document.getElementsByTagName("pre")[0].innerHTML;3.点击“复制”现在将其粘贴到记事本或其他东西中。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5