0

I've got stuck up while reading fwf files.

My issue is that I do not have uniform spacing with each column. It seems that each row has a different width. How can I correct this?

Example here:

NAME MARKS  
ABC  100  
BCA       90

I appreciate any comments that help me out. Thanks in advance

David
  • 3,166
  • 2
  • 30
  • 51
  • If there's different amounts of whitespace separating fields, then you don't have a fixed-width file. It looks like you have a whitespace-separated file. Did you try `read.table('file.txt',header=T)`? It should work, since the default separator is any amount of whitespace. – bgoldst Aug 11 '15 at 13:16
  • @bgoldst Its working.Thank you. – Ramprakash V Aug 11 '15 at 13:29

1 Answers1

1
read.table(text=c('NAME MARKS  ','ABC  100  ','BCA       90'),header=T);
##   NAME MARKS
## 1  ABC   100
## 2  BCA    90
bgoldst
  • 34,190
  • 6
  • 38
  • 64