read.csv doesn't load data properly

25 Views Asked by At

I am trying to replicate R syntax (https://r.qcbs.ca/workshop08/book-en/introduction-to-gams.html) that starts like this:

isit <- read.csv("data/ISIT.csv")
head(isit)
> SampleDepth Sources Station Time Latitude Longitude     Xkm    Ykm Month Year
> 1         517   28.73       1    3  50.1508  -14.4792 -34.106 16.779     4 2001
> 2         582   27.90       1    3  50.1508  -14.4792 -34.106 16.779     4 2001
> 3         547   23.44       1    3  50.1508  -14.4792 -34.106 16.779     4 2001
> 4         614   18.33       1    3  50.1508  -14.4792 -34.106 16.779     4 2001
> 5        1068   12.38       1    3  50.1508  -14.4792 -34.106 16.779     4 2001
> 6        1005   11.23       1    3  50.1508  -14.4792 -34.106 16.779     4 2001
> BottomDepth Season Discovery RelativeDepth
> 1        3939      1       252          3422
> 2        3939      1       252          3357
> 3        3939      1       252          3392
> 4        3939      1       252          3325
> 5        3939      1       252          2871
> 6        3939      1       252          2934

Pretty basic, and until today I've had no problems

However, today when I type this (I used a slightly different file path):

isit <- read.csv("ISIT.csv")
head(visit)

I instead get this:

> SampleDepth..Sources...Station...Time...Latitude...Longitude...Xkm...Ykm...Month...Year...BottomDepth...Season...Discovery...RelativeDepth.
> 1                                                                      517,28.73,1,3,50.1508,-14.4792,-34.106,16.779,4,2001,3939,"1",252,3422
> 2                                                                       582,27.9,1,3,50.1508,-14.4792,-34.106,16.779,4,2001,3939,"1",252,3357
> 3                                                                      547,23.44,1,3,50.1508,-14.4792,-34.106,16.779,4,2001,3939,"1",252,3392
> 4                                                                      614,18.33,1,3,50.1508,-14.4792,-34.106,16.779,4,2001,3939,"1",252,3325
> 5                                                                     1068,12.38,1,3,50.1508,-14.4792,-34.106,16.779,4,2001,3939,"1",252,2871
> 6                                                                     1005,11.23,1,3,50.1508,-14.4792,-34.106,16.779,4,2001,3939,"1",252,2934
> 

Am I missing something really basic?

I tried converting this to excel (using text to columns), updating R to 4.3.2, and re-installing the packages, I got the same result

0

There are 0 best solutions below