-1

please let me know how to calculate percentage from row wise in R.As i'm using prop.table function but it is not giving me solution

empid        presentdays        empid      absentdays
  1              5                1             10
  2              2                2              4
  3              6                3             12

I want to calculate percentage with respect to each empid as their performance

empid         presentdays       empid      absentdays    perfom%
  1                 5             1          10            50
  2                 2             2           4            50

how to do it in R as i've tried prop.table() function also but it doesn't work

sam
  • 229
  • 1
  • 4
  • 8
  • 1
    Welcome to Stack Overflow. When asking questions please supply your code and if at all possible make it reproducible. Obviously your code does not work at this point, but you should include it in your question anyway so that we can understand where you are going wrong. Read [this post](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for guidance. – SlowLearner Aug 16 '13 at 09:39

1 Answers1

1

Assuming your dataframe is called df:

df$perform <- df$presentdays/df$absentdays*100
beginneR
  • 3,207
  • 5
  • 30
  • 52