Generate a dummy-variable

前端 未结 17 1505
遇见更好的自我
遇见更好的自我 2020-11-21 11:41

I have trouble generating the following dummy-variables in R:

I\'m analyzing yearly time series data (time period 1948-2009). I have two questions:

  1. <
17条回答
  •  天命终不由人
    2020-11-21 12:03

    If you want to get K dummy variables, instead of K-1, try:

    dummies = table(1:length(year),as.factor(year))  
    

    Best,

提交回复
热议问题