-1

I am importing a table with the following code:

data <- read.csv("E:/test_division/division_finale2009/file_list_months_weeks/scope_ais_april.csv", nrows=1000, sep=",")
t<-subset(data,data$mmsi==211330370)

When I have a look to my data, it seems that there is a mistake in the column dimBow: enter image description here

The sign "\" here is prohibiting the separator "," to take effect.

I have tried to remove the "\" from the column dimBow, but without sucess with

   t$dimBow<-gsub("\", "", t$dimBow)

I don't see why this command is not doing anything. I can remove all the other special characters, but not "\"

This file was generated by me, so if I find a way to remove all of the "\" in this sample, I could create in the future other files without the "\".

Cath
  • 23,906
  • 5
  • 52
  • 86
Floni
  • 475
  • 2
  • 13

1 Answers1

0

"\" need to be escaped,try this

t$dimBow<-gsub("\\\\", "", t$dimBow)

or

t$dimBow<-gsub("[\\]", "", t$dimBow)

more can be found here

Community
  • 1
  • 1
Samuelliyi
  • 68
  • 1
  • 7