After reading my .CSV
file in R, I have a lot of extra spaces in between. How do I eliminate these?
file = read.csv("filename.csv")
After reading the file, I get lot of spaces in between, how to remove in R?
a = data.frame(Answer = c("who doesn't like some appreciation now and then all employees can give receive non monetary awards in the form of e cards please use the recognition awards and follow instructions there to send an e card want to send some appreciation my way ")
In another situation, I have used below code to remove apostrophe such as doesn't
so that I get doesnt
but I am getting doesn t
:
a$Answer=gsub('[[:punct:] ]+',' ',a$Answer)
Which is the correct way to remove apostrophe without getting a space?