Data downloaded from Kaggle
https://www.kaggle.com/datasets/utsavdey1410/food-nutrition-dataset
remove(list=ls())
?read.csv
FOOD.DATA.GROUP1 <- read.csv(file = "~/Downloads/FOOD-DATA-GROUP1.csv") # you need to indentify the key argument in the command
FOOD.DATA.GROUP2 <- read.csv(file = "~/Downloads/FOOD-DATA-GROUP1.csv", header = TRUE) # explicitly specifying the default argument does not chnage anything, but might be a good practice when you are new
FOOD.DATA.GROUP2 <- read.csv(file = "~/Downloads/FOOD-DATA-GROUP1.csv")
remove(FOOD.DATA.GROUP2)
FOOD.DATA.GROUP1$X <- NULL
FOOD.DATA.GROUP1$healthy <- FOOD.DATA.GROUP1$Nutrition.Density > 10
df_healthy <-FOOD.DATA.GROUP1[FOOD.DATA.GROUP1$healthy, ]
df_unhealthy <- FOOD.DATA.GROUP1[!FOOD.DATA.GROUP1$healthy, ]
FOOD.DATA.GROUP2 <- read.csv(file = "~/Downloads/FOOD-DATA-GROUP1.csv",
header = T,
nrows = 10
)
?read.csv
?read.table
# install.packages("psych") #installation - only once
library(psych)
describe(df_unhealthy)
## Warning in FUN(newX[, i], ...): no non-missing arguments to min; returning Inf
## Warning in FUN(newX[, i], ...): no non-missing arguments to max; returning -Inf
## vars n mean sd median trimmed mad min max
## Unnamed..0 1 33 335.70 176.69 410.00 350.52 170.50 0.00 543.00
## food* 2 33 17.00 9.67 17.00 17.00 11.86 1.00 33.00
## Caloric.Value 3 33 46.67 70.58 27.00 31.00 25.20 3.00 370.00
## Fat 4 33 1.61 2.13 0.60 1.21 0.75 0.02 8.00
## Saturated.Fats 5 33 2.02 7.46 0.10 0.38 0.15 0.00 42.00
## Monounsaturated.Fats 6 33 3.24 8.57 0.10 0.76 0.15 0.00 34.00
## Polyunsaturated.Fats 7 33 0.43 1.12 0.09 0.15 0.13 0.00 5.50
## Carbohydrates 8 33 0.94 1.44 0.50 0.63 0.74 0.00 5.50
## Sugars 9 33 0.24 0.69 0.00 0.07 0.00 0.00 3.40
## Protein 10 33 2.11 2.10 1.40 1.82 1.63 0.00 8.20
## Dietary.Fiber 11 33 0.01 0.05 0.00 0.00 0.00 0.00 0.30
## Cholesterol 12 33 9.15 16.19 4.30 5.59 6.38 0.00 81.50
## Sodium 13 33 0.25 0.99 0.02 0.03 0.03 0.00 5.60
## Water 14 33 9.24 10.18 7.00 8.14 10.38 0.00 39.40
## Vitamin.A 15 33 0.04 0.05 0.02 0.04 0.04 0.00 0.20
## Vitamin.B1 16 33 0.04 0.04 0.03 0.03 0.04 0.00 0.09
## Vitamin.B11 17 33 0.04 0.04 0.04 0.04 0.05 0.00 0.10
## Vitamin.B12 18 33 0.04 0.04 0.04 0.04 0.05 0.00 0.10
## Vitamin.B2 19 33 0.04 0.04 0.02 0.03 0.04 0.00 0.10
## Vitamin.B3 20 33 0.53 1.40 0.09 0.14 0.13 0.00 6.20
## Vitamin.B5 21 33 0.08 0.21 0.05 0.04 0.05 0.00 1.20
## Vitamin.B6 22 33 0.06 0.08 0.04 0.04 0.05 0.00 0.30
## Vitamin.C 23 33 0.13 0.41 0.00 0.03 0.00 0.00 2.20
## Vitamin.D 24 33 0.01 0.04 0.00 0.00 0.00 0.00 0.20
## Vitamin.E 25 33 0.07 0.18 0.00 0.02 0.00 0.00 1.00
## Vitamin.K 26 33 0.02 0.04 0.00 0.01 0.00 0.00 0.20
## Calcium 27 33 1.64 2.04 1.00 1.29 1.48 0.00 7.50
## Copper 28 33 3.45 10.43 0.03 0.59 0.05 0.00 42.70
## Iron 29 33 0.15 0.28 0.06 0.08 0.06 0.00 1.30
## Magnesium 30 33 3.00 4.03 1.20 2.33 1.78 0.00 12.20
## Manganese 31 33 0.52 1.16 0.04 0.21 0.05 0.00 4.00
## Phosphorus 32 33 22.96 30.71 8.70 18.66 12.90 0.00 94.20
## Potassium 33 33 32.66 42.26 16.10 24.40 23.13 0.00 149.10
## Selenium 34 33 5.20 12.26 0.05 2.08 0.07 0.00 43.80
## Zinc 35 33 0.34 1.17 0.04 0.05 0.06 0.00 5.30
## Nutrition.Density 36 33 6.62 2.62 7.07 6.81 3.11 1.02 9.86
## healthy 37 33 NaN NA NA NaN NA Inf -Inf
## range skew kurtosis se
## Unnamed..0 543.00 -0.68 -0.86 30.76
## food* 32.00 0.00 -1.31 1.68
## Caloric.Value 367.00 3.16 10.87 12.29
## Fat 7.98 1.53 1.42 0.37
## Saturated.Fats 42.00 4.71 22.02 1.30
## Monounsaturated.Fats 34.00 2.83 6.78 1.49
## Polyunsaturated.Fats 5.50 3.48 11.74 0.19
## Carbohydrates 5.50 1.97 3.33 0.25
## Sugars 3.40 3.43 11.60 0.12
## Protein 8.20 1.13 0.56 0.37
## Dietary.Fiber 0.30 4.58 20.75 0.01
## Cholesterol 81.50 3.23 10.67 2.82
## Sodium 5.60 4.84 23.20 0.17
## Water 39.40 0.94 0.11 1.77
## Vitamin.A 0.20 1.12 1.42 0.01
## Vitamin.B1 0.09 0.42 -1.56 0.01
## Vitamin.B11 0.10 0.21 -1.64 0.01
## Vitamin.B12 0.10 0.28 -1.64 0.01
## Vitamin.B2 0.10 0.38 -1.55 0.01
## Vitamin.B3 6.20 3.16 8.95 0.24
## Vitamin.B5 1.20 4.85 23.46 0.04
## Vitamin.B6 0.30 2.11 3.54 0.01
## Vitamin.C 2.20 4.07 17.32 0.07
## Vitamin.D 0.20 3.97 16.21 0.01
## Vitamin.E 1.00 4.29 19.11 0.03
## Vitamin.K 0.20 2.74 8.02 0.01
## Calcium 7.50 1.23 0.65 0.36
## Copper 42.70 3.07 8.34 1.82
## Iron 1.30 2.72 7.01 0.05
## Magnesium 12.20 1.23 0.07 0.70
## Manganese 4.00 2.16 3.29 0.20
## Phosphorus 94.20 1.03 -0.57 5.35
## Potassium 149.10 1.62 1.52 7.36
## Selenium 43.80 2.11 3.02 2.13
## Zinc 5.30 3.56 11.20 0.20
## Nutrition.Density 8.84 -0.44 -1.12 0.46
## healthy -Inf NA NA NA