vendredi 5 août 2016

If statement in R error

if(df$tfp_count > 50){

  mdlds <- lm(ltfp_sd~factor(country)+factor(year)+factor(sector),data=df)
  mdliqr<- lm(ltfp_iqr~factor(country)+factor(year)+factor(sector),data=df)
  sumds <- summary(mdlds)$coefficients
  sumdiqr <- summary(mdliqr)$coefficients
  }

I get this error:

In if (df$tfp_count > 50) { :
  the condition has length > 1 and only the first element will be used

Why doesn't my if-statement work? What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire