Help! Can't get Data.Frame to work in R

I have running running a linear regression model because i have not created a data.frame .
this is what i have done, for the white wine quality dataset.

#create a dataframe of WineQ
data.frame(df, stringsAsFactors = TRUE)

#create variables from dataset
alcohol = c(8.8, 9.5, 20.2, 9.9, 9.9, 10.1)
fixed.acidity =c(7.0, 6.3, 8.1, 7.2, 7.2, 8.1)
free.sulfur.dioxide = c(45, 14, 30, 47, 47, 30)
total.sulfur.dioxide = c(170, 132, 97, 186, 186, 97)
residual.sugar = c(20.4, 1.6, 6.9, 8.5, 8.5, 6.9)
pH = c(3.00, 3.30, 3.26, 3.19, 3.19, 3.26)
quality =c(6, 6, 6, 6, 6, 6)

#join variable to create a dataframe
df = data.frame(alcohol,fixed.acidity,free.sulfur.dioxide,total.sulfur.dioxide,residual.sugar,pH,quality)
df

str(df)

normalize so that the range is good bad medium

normalize = function(x) (x - min(x))/(max(x) - min(x))

df_norm = data.frame(apply(df [, 1:6], 2, function(x) (x - min(x))/(max(x) - min(x) )))
df_norm$quality = df$quality
str(df_norm)

please if anyone can help me

This line of code is not correct or necessary so you can simply delete it, other than that I don't understand what your issue is, can you elaborate on that? ideally, Can you please turn this into a self-contained REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.