'Opening csv file correctly

I am trying to use this dataset: wine_quality_dataset

I am running the following function:

data2 <- read.table("C:/Users/Magda/Downloads/winewhite.csv") 

And here is what I got:

head(data2)
 V1
1 fixed acidity;volatile acidity;citric acid;residual sugar;chlorides;free sulfur dioxide;total sulfur dioxide;density;pH;sulphates;alcohol;quality
2                                                                                                  7;0.27;0.36;20.7;0.045;45;170;1.001;3;0.45;8.8;6
3                                                                                                6.3;0.3;0.34;1.6;0.049;14;132;0.994;3.3;0.49;9.5;6
4                                                                                               8.1;0.28;0.4;6.9;0.05;30;97;0.9951;3.26;0.44;10.1;6
5                                                                                              7.2;0.23;0.32;8.5;0.058;47;186;0.9956;3.19;0.4;9.9;6
6                                                                                              7.2;0.23;0.32;8.5;0.058;47;186;0.9956;3.19;0.4;9.9;6

enter image description here

What command should I use to read csv file correctly?



Solution 1:[1]

Try

readr::read_csv("C:/Users/Magda/Downloads/winewhite.csv")

readr is part of tidyverse a collection of libraries that help you tidying up data.

If you are using European format CSV with a semicolon ; separator, use

readr::read_csv2("C:/Users/Magda/Downloads/winewhite.csv")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user438383