Menu

frequency table

Help
Mark Baas
2008-02-04
2013-01-15
  • Mark Baas

    Mark Baas - 2008-02-04

    Under SPSS you have under descriptive statics a frequency table, where is that in Rkward.
    Greetings

     
    • fsando

      fsando - 2008-02-08

      As of 0.4 this feature seems not to be implemented.
      You can use the code table(x) where 'x' is your variable or if it's a data.frame: table(data[["varname"]]) where 'data' is your data.frame.

       
    • Mark Baas

      Mark Baas - 2008-02-19

      Hey ive got the code

      data.frame(age=sample(table(var)),percent=sample(prop.table(table(var))))

      Now i want to make a plugin... I can't get it done. This is what i have it works like sh*t:

      <?
      function preprocess () {
      }

      function calculate () {
      ?>
      <? $vars = "substitute (" . str_replace ("\n", "), substitute (", trim (getRK_val ("x"))) . ")"; ?>
      vars <- list(<? echo ($vars); ?>)
      result <- vector(mode = "list")
      for(var in vars){
          result <- data.frame(age=sample(table(var)),percent=sample(prop.table(table(var))))
      }
      <?
      }

      function printout () {
      ?>

      rk.header ("Frequency Table")
      rk.print (result)
      <?
      }
      ?>