R is not recognizing csv file tabs

Asked

Viewed 139 times

5

I have some files to work on in R, with data in decimal numbers. Files that are with tabs like ; are being read correctly, but one of them is with , as boundary between cells. I don’t know how to fix this problem on Linux Ubuntu. Is there any other way than in the regional settings for the file to be in the correct format?

1 answer

9


In function read.csv separator options exist. In the case of the file with , specify within the function

dados <- read.csv("arquivo.csv", sep = ",")
  • Even though I have a few commas in my data as decimal place, wouldn’t that disfigure everything? Wouldn’t make a mess?

  • 1

    as this is the case, you should not even be able to read the file, it will probably give an error of type: more columns than column names. In that case, I suggest you take a look at the function read.fwf where will specify the length of each column

  • Got it! I’ll do it! Thank you so much

Browser other questions tagged

You are not signed in. Login or sign up in order to post.