问题
I am trying to read a file which has a column of +
and -
but apparently associated with a space after that. In anyway I read (read.csv
or read.table
or read_excel
that file I pick up the space after.
For example:
df = data.frame(x = c('a', 'b', 'c'), y = c('+ ', "- ", "+ "))
df
x y
1 a +
2 b -
3 c +
Now, is there a way to specifically instruct not to pick up space after the value in read.csv
or read_excel
Or is there a way to clean up the spaces after reading into a dataframe?
来源:https://stackoverflow.com/questions/43433491/how-to-avoid-space-while-reading-txt-file