After importing a file, I always try try to remove spaces from the column names to make referral to column names easier.
Is there a better way to do this other then
If you use read.csv() to import your data (which replaces all spaces " " with ".") you can replace these instead with an underscore "_" using:
names(df) <- gsub("\\.", "_", names(df))