[R] R and .asc file extension

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Fri May 20 16:15:04 CEST 2022

R has no restrictions regarding file name extensions. Seriously.

What you are probably asking is whether there are functions available that can transform such a file into a usable R data object. Unfortunately, a file named with an ASC file extension could contain any kind of data, and even among "common" formats such files contain easily thousands of different formats. So deciding whether R can sensibly parse data based only on that information is impossible.

POSIX-conformant operating systems often have a utility program called "file" that looks in the file data and uses heuristics to guess what format is being used. But even that output may not be sufficient to answer that question.

Try opening it in a text editor, and if that works you might see some clues that you can google for. Or if you know from where you obtained the data what type of information it should contain, you may be able to use a search engine to find clues about it.

Don't be surprised if it is a one-of-a-kind format... it was not uncommon 30 years ago to re-direct output prepared for sending to a line printer into a file with an asc extension (short for "ASCII format"), with no defined format for other computers to recognize at all. You would have to use the readLines function and string search functions like grep or sub to extract information from it in that case, based on your ability to see patterns in a text viewer.

On May 20, 2022 6:27:20 AM PDT, Thomas Subia via R-help <r-help using r-project.org> wrote:
>I have data which has a .asc file extension.
>Can R read that file extension?
>All the best,
>Thomas Subia
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

Sent from my phone. Please excuse my brevity.

More information about the R-help mailing list