I am working to parse some difficult data and need to remove just the single spaces. The rows of my data look like the example below
[1] "  Class                                Dist   Quantity    Market   Taxable/$                        "
[2] " 4-2101 THIS LAND                     28       108.85    216797     6352.00                        "
[3] "99-9084 FIRE PROTECTION               9084       0.00         0       26.95                        "
[4] "99-9093 COUNTY VALLEY SOIL            9093       0.00         0     6352.00                        "
If I could condense the hyphenated numbers and descriptions by removing the single-spaces, I could then read the text using read.table.
How could I iterate through the rows and replace just the single spaces with no-spaces? The resulting data would look like
[1] "  Class                                Dist   Quantity    Market   Taxable/$                        "
[2] " 4-2101THISLAND                     28       108.85    216797     6352.00                        "
[3] "99-9084FIREPROTECTION               9084       0.00         0       26.95                        "
[4] "99-9093COUNTYVALLEYSOIL            9093       0.00         0     6352.00                        "
				
                        
You can use the gsub command.
Edited as suggested by rawr.