Home > database >  How do I download this pipe delimited file?
How do I download this pipe delimited file?

Time:07-08

How do I download this pipe delimited file?

It is in this link: https://www.deadiversion.usdoj.gov/drug_disposal/takeback/

When you click on "Download For Pipe Delimited Year Round Pharmaceutical Disposal Locations" it just takes me to a new page like I'm opening a pdf with the following web address: https://apps.deadiversion.usdoj.gov/pubdisp/pub_disposal_sites.txt

I just want to download the .txt file, but I can't figure out how to as it just opens it up as a web page! I've tried searching the internet and stackoverflow, but I have found no answers (I'm pretty new to R and working with data).

Is there a way to download the .txt file?

CodePudding user response:

A better way to do it is to read it directly into R, e.g.

library(tidyverse)
df <- read_delim("https://apps.deadiversion.usdoj.gov/pubdisp/pub_disposal_sites.txt", delim = "|")
df
#> Rows: 12979 Columns: 9
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: "|"
#> chr (7): NAME, ADDL CO INFO, ADDRESS 1, ADDRESS 2, CITY, STATE, ZIP
#> dbl (2): LATITUDE, LONGITUDE
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> # A tibble: 12,979 × 9
#>    NAME        `ADDL CO INFO` `ADDRESS 1` `ADDRESS 2` CITY  STATE ZIP   LATITUDE
#>    <chr>       <chr>          <chr>       <chr>       <chr> <chr> <chr>    <dbl>
#>  1 WOODWARD D… DBA: CVS/PHAR… 4995 HIGHL… <NA>        WATE… MI    48328     42.7
#>  2 WOODWARD D… DBA: CVS/PHAR… 1715 COOLI… <NA>        BERK… MI    48072     42.5
#>  3 WOODWARD D… DBA: CVS/PHAR… 1625 KING … <NA>        TREN… MI    48183     42.2
#>  4 WOODWARD D… DBA: CVS/PHAR… 67181 S MA… <NA>        RICH… MI    48062     42.8
#>  5 WOODWARD D… DBA: CVS/PHAR… 31411 CHER… <NA>        WEST… MI    48186     42.3
#>  6 WOODWARD D… DBA: CVS/PHAR… 20460 MACK… <NA>        GROS… MI    48236     42.4
#>  7 WOODWARD D… DBA: CVS/PHAR… 19818 KELL… <NA>        HARP… MI    48225     42.4
#>  8 WAKEMED     <NA>           ATTN: INPA… 3000 NEW B… RALE… NC    27610     35.8
#>  9 GARFIELD B… DBA: CVS/PHAR… 318 W EL N… <NA>        ESCO… CA    92026     33.1
#> 10 WOODWARD D… DBA: CVS/PHAR… 8710 N. BE… <NA>        DEAR… MI    48127     42.4
#> # … with 12,969 more rows, and 1 more variable: LONGITUDE <dbl>

Created on 2022-07-08 by the reprex package (v2.0.1)

CodePudding user response:

Jk, I am dumb.

You can Download the file by below steps:

Open the Web page from which you want to extract text. Click the “Right Click” menu. Click the “Save as”, then in the “Filename” 1Mints.txt comes. Then select “Save as Type” as “Text Document” and then Okay. It will Download 1Mints.txt at the specified location.

  • Related