Html 从网页下载原始文本

Html 从网页下载原始文本,html,r,download,Html,R,Download,我希望从该网页下载所有数据: 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 由于页面几乎立即对我没有响应,我无法做我通常会做的事情 有什么想法吗?你可以使用curl(l

我希望从该网页下载所有数据:

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
由于页面几乎立即对我没有响应,我无法做我通常会做的事情


有什么想法吗?

你可以使用
curl
(linux)

curlhttps://download.bls.gov/pub/time.series/la/la.data.64.County -o data.txt
如果你在windows上,也许其中一个对你有用

  • 检查当前页面


  • 编写
    document.getElementsByTagName(“pre”)[0].innerHTML


  • 3.点击“复制”




    现在将其粘贴到记事本或其他地方。

    如果您想在R中处理此数据,可以使用
    fread
    from
    data.table

    library(data.table)
    df <- fread('https://download.bls.gov/pub/time.series/la/la.data.64.County')
    head(df)
    
    #              series_id year period value footnote_codes
    #1: LAUCN010010000000003 1990    M01   6.4               
    #2: LAUCN010010000000003 1990    M02   6.6               
    #3: LAUCN010010000000003 1990    M03   5.8               
    #4: LAUCN010010000000003 1990    M04   6.6               
    #5: LAUCN010010000000003 1990    M05   6.0               
    #6: LAUCN010010000000003 1990    M06   7.0      
    
    库(data.table)
    
    df数据非常大,但似乎与
    fread
    df一起工作