0

I am trying to run a linear regression on a data set that has 20 groups, 392 observations per group and three variable (Time_Seconds, Age, Grp). The twenty groups are a combination Grp and Age variables. The objective is to graph y=Time_Seconds, x=Age & regression lines for each of the 5 groups. The groups were not evenly distributed at first so additional variables were added with NA in Time_Seconds category. Here is the code being used along with the error.

time = Stats.Data.2$Time_Second
age = Stats.Data.2$Age
grp = Stats.Data.2$Grp

grp.list = unique(grp)

gl.model = gl(40, 392, length = 15680, labels = grp.list, order = FALSE)

time.age = c(time, age)

lm.time = lm(time.age ~ gl.model)

I get the following error returned:

Error in unique.default(x[!is.na(x)]) : hash table is full

Any help would be greatly appreciated.

I attempted to correct the problem by eliminating the NA values but I get the following error:

Error in model.frame.default(formula = time.age ~ gl.model, drop.unused.levels = TRUE) : 
  variable lengths differ (found for 'gl.model')

I also tried to correct that data and set up levels with NA to help prevent issues with NA. Here is the code:

levels(Stats.Data.2$Time_Second) = c(levels(Stats.Data.2$Time_Second),'(NA)')

Stats.Data.2$Time_Second[is.na(Stats.Data.2$Time_Second)] = '(NA)'

This still returned the following error:

Error in unique.default(x[!is.na(x)]) : hash table is full

0 Answers0