0

I got my asc file into R. It is in one column. I need to separate into 375 columns. Having issues. I have the column widths and column names. Thank you.

  • Perhaps [this](https://stackoverflow.com/questions/20177581/reading-an-asc-file-into-r) helps – akrun Jun 13 '22 at 19:01
  • I am able to get the file in but its stuck in one column! The issue is parsing into 375 columns... Thanks for your response though. – user19332472 Jun 13 '22 at 20:06
  • 1
    Welcome to SO, still there are many open questions. How exactly should the values be split into columns? Does it depend on some properties of the data? Do we need a piece of the data to reproduce it or can we just use arbitrary numbers? If so, please provide it. – Jan Jun 13 '22 at 20:17
  • `read.fwf` **might** help you. – Ben Bolker Jun 13 '22 at 20:27
  • Hi Jan, thanks. I have the column widths. Its by spaces.. for example: colWidths <- c(3,3,4,5,7,2,8) – user19332472 Jun 13 '22 at 22:12
  • Have you tried `read.fwf("your_file.asc", widths = colWidths)` ? That *could* work (but without further details we're guessing, a bit). – Ben Bolker Jun 14 '22 at 00:54

0 Answers0