I have the following dataset named fish_data
> structure(list(Species = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Bream", "Parkki", "Perch", "Pike", "Roach", "Smelt", "Whitefish"), class = "factor"),
> WeightGRAM = c(242, 290, 340, 363, 430, 450), VertLengthCM = c(23.2, 24, 23.9, 26.3, 26.5, 26.8)
> DiagLengthCM = c(25.4, 26.3, 26.5, 29, 29, 29.7),
> CrossLengthCM = c(30, 31.2, 31.1, 33.5, 34, 34.7),
> HeightCM = c(11.52, 12.48, 12.3778, 12.73, 12.444, 13.6024),
> WidthCM = c(4.02, 4.3056, 4.6961, 4.4555, 5.134, 4.9274)),
> row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"), na.action = structure(c(`41` = 41L), class = "omit"))
It look something like this:
How can i Build a linear regression model named m1 with WeightGRAM as a function of Species and all the measurement variables i.e. VertLengthCM, DiaLengthCM, CrossLengthCM, HeightCM, WidthCM?
i have the linear regression code as below:
m1 <- lm(WeightGRAM~.,data = fish_data )
summary(m1)
But i want to exclude the "species" as it is a factor