Creating a count of a string variable by a categorical variable

Hi all,

Trying to create a count of two categorical variables (total cases) for a linear model- dataset looks like below:

var1 weeks
positive week1
positive week1
positive week1
negative week1
positive week2
positive week2
positive week2
positive week3

I want to eventually create a linear regression of positives/ negatives by week, so

model <- lm(weeks ~ totalcases (sum of all var1), data = df)

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.