How to run a mult. Linear regression in R, after importing the data.

rstudio
#1

*I imported the data from excel no problem.
*In the data set, one column is a list of names, and then there is 1 dependent variable, and 4 independent variables.
*My first and simple task is to rename the data set, then set up the regression equation through R.
*Every time I rename the data set, or do anything with it for that matter, i look to the left, in the envrionment section, and every time it automatically reduces the number of variables I have to 2-- theres a total of 5! This thus does not allow me to name my 4 indepen. variables and move forward with the simple task of mult. lin. regression, because it thinks there is only two variables-- why is it doing this? that doesnt even make sense.

  • i make sure to say "skip" on the column that has just names. What am I missing?
0 Likes

#2

Can you provide a reprex?

I don't there should be any problem. I just read a .xlsx file using readxl and renamed the columns using colnames without any problem.

0 Likes

#3

here is the error code:

Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied

only to factors with 2 or more levels

i provided an image of the data set

im just suppose to lin. reg. this,

I know its an error on my part I just dont know what to do

0 Likes

closed #5

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

0 Likes