Importing csv, columns are not seperated

Hi all!

I'm new to R and trying to get some practice before I have to analyse my thesis data. I did some basic training and am now ready to upload a first practice version of my data.

My data set consist of 8 columns. I converted it from Excel to csv. However, when I import it into R, the dim() and str() functions say it has only 1 variable. Does anyone know why R does not see my columns and seperates them? And how to fix this? See below for the codes I used.

Thanks so much in advance!

PS I took a look at this question but it doesn't seem like we have the same problem: [Beginner Problem] When importing a .csv file, data frame does not separate columns

The code that I used:

setwd("C:/Users/Sarah/Documents/Universiteit/Master/R leren/Mijn data oefenen")

# reads the data file into R and gives it a name
EGonvol <- read.csv("EG onvolledig 2.csv")

names(EGonvol)
#tells nr of rows and columns. Why does my data have only one column?!
dim(EGonvol)
str(EGonvol)```

The output that I got: 
```> names(EGonvol)
[1] "Species.ghnr.Location.mother.Soil.treatment.Date..nrleaves.longest.leave"
> #tells nr of rows and columns. Why does my data have only one column?!
> dim(EGonvol)
[1] 726   1
> str(EGonvol)
'data.frame':	726 obs. of  1 variable:
 $ Species.ghnr.Location.mother.Soil.treatment.Date..nrleaves.longest.leave: chr  "EG;161;Brum;1;EE;21-dec;2;6" "EG;162;Brum;1;EE;21-dec;4;12" "EG;163;Brum;2;EE;21-dec;3;14" "EG;164;Brum;2;EE;21-dec;2;5" ...```

The first lines of the csv file when I open it in a Notebook:
``` Species;ghnr;Location;mother;Soil treatment;Date ;nrleaves;longest leave
EG;161;Brum;1;EE;21-dec;2;6
EG;162;Brum;1;EE;21-dec;4;12
EG;163;Brum;2;EE;21-dec;3;14 ```

csv stands for 'comma separated values'.
Your example is not comma separated, rather semicolon separated.

You can override the default separator for read.csv by using the sep argument like

EGonvol <- read.csv("EG onvolledig 2.csv",
                    sep = ";")

@nirgrahamuk Thank you so much! I thought the semicolon would also work, but it makes a lot of sense now :slight_smile: