Monday, March 25, 2013

Plotting data in with R - when data has hyphen(-) along with numbers

While I was plotting data with R, I encountered a weird issue today. I had hyphens along with numbers in my data file, and I was not getting expected results in the plot. This made me think and investigate the issue. I reduced my data size to a small file and found that R actually behaves unexpectedly when there are hyphens along with numbers in the data column. I am moving on by replacing all the hyphens by zeroes, for now. Here are the details of my experiment. I do not know the cause yet, and it could be a bug with R.
Data file (with zeros and hyphens)

R script
Output of the two files