0

I've followed a couple of these posts here and here but am still struggling with loading an ASCII file.

I'm trying to pull down the county-level Area Health Resources File but it's not loading correctly. I've now tried:

> df <- read.table("DATA/ahrf2018.asc")
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  : 
  line 1 did not have 312 elements
> dim(df)
[1] 3350    5
> df <- read.delim("DATA/ahrf2018.asc")
> dim(df)
[1] 3229    1
> df <- read.csv("DATA/ahrf2018.asc")
> dim(df)
[1] 3350    5
> df <- read.csv("DATA/ahrf2018.asc", header = FALSE, skip = 1)
> dim(df)
[1] 3350    6

And I looked into the LaF package, but don't know the column types which are required.

Is there something painfully simple I am overlooking?

EDIT: Example of output, where columns not getting created:

    V1
1  01001AHRF 01001               20181821232435Alabama            ALAutauga                  Autauga
2  01003AHRF 01003               20181821232435Alabama            ALBaldwin                  Baldwin
3  01005AHRF 01005               20181821232435Alabama            ALBarbour                  Barbour
4     01007AHRF 01007               20181821232435Alabama            ALBibb                     Bibb
Jebediah15
  • 754
  • 3
  • 18
  • 39
  • 1
    You should provide the first several lines of your data, or give a direct link to it. The link at the top of your message points to a site with tons of data, and we are not going to search for a file called ahrf2018.asc at the site. – user31264 Aug 20 '19 at 16:02
  • 2
    This is not a complete question, because we can't see what your ASCII looks like. Please include a sample from that file, including the header and a few rows. Most likely, you just need to slightly alter your call to `read.table` or `read.csv`. – Tim Biegeleisen Aug 20 '19 at 16:02
  • @joran the documentation is related to the methodology for data elements and not for using the files. – Jebediah15 Aug 20 '19 at 16:15

0 Answers0