-1

I have a data frame created within the R console called lungdata. It has six separate variables. I need to create a frequency table from the variable Smoke. Smokers and NonSmokers relative frequency. What would be the correct syntax to create the table. The variables are input as Yes/No.

Jerome
  • 9
  • 1
  • 5

1 Answers1

1

If you want relative frequencies, just do

prop.table(table(lungdata$smoke))

and that should do the trick. If you want counts, not percentages, just use

table(lungdata$smoke)
Jan Sila
  • 1,554
  • 3
  • 17
  • 36