[R] use mathematics formula

hadley wickham h.wickham at gmail.com
Wed May 16 12:02:05 CEST 2007


Perhaps you could step back and try and explain to the list what your
overall goal is.  From looking at your code, it looks like you are
trying to take some SAS code and turn it in to the equivalent R code
automatically.  Is that correct?  What is the problem you are trying
to solve?

Hadley

On 5/16/07, elyakhlifi mustapha <elyakhlifi_mustapha at yahoo.fr> wrote:
> hello,
> I wanna use some mathematics formula and to do this I tried several way in paricular using
> strsplit
> textconnection
> scan
> setdiff
> but I think that it's a lil hard
> the data frame that I'm working on is as follow
>
> > donCalcara2
>    Id_Cara                                                                                                      Form_C
> 1      743                                              if C325=. then C743=(C152/C103)*100| else C743=(C152/C325)*100
> 2      627 if C137=. Then C627=.| else do| if C109=. Then C627=(C138/S138)*(100-C137)| else C627=(C138/S138)*C109| end
> 3      638                                                                                          C638 = C103 / S103
> 4      740                                              if C325=. then C740=(C346/C103)*100| else C740=(C346/C325)*100
> 5      739                                         if C155=. then C739=(C570/C103)*100| else C739=C155/(C155+C103)*100
> 6      628                                              if C325=. then C628=(C455/C103)*100| else C628=(C455/C325)*100
> 7      747                                                if C325=. then C747=(C27/C103)*100| else C747=(C27/C325)*100
> 8      629                                              if C325=. then C629=(C454/C103)*100| else C629=(C454/C325)*100
> 9      737                                              if C325=. then C737=(C457/C103)*100| else C737=(C457/C325)*100
> 10     750                                              if C325=. then C750=(C431/C103)*100| else C750=(C431/C325)*100
> 11     754                                       if C325=. then C754=(C894/C103)*100| else C754=(C894/(C325+C894))*100
> 12     760                                                                                           C760= C627 / 0.89
> 13     761                                                                                          C761 = C177 * 0.89
> 14     586                                                                         if C325=. then C586=(C588/C103)*100
> 15     896                                                                         if C325=. then C896=(C895/C103)*100
> 16     751                                              if C325=. then C751=(C433/C103)*100| else C751=(C433/C325)*100
> 17     738                                              if C325=. then C738=(C151/C103)*100| else C738=(C151/C325)*100
> 18     744                                                                                        C744=(C627*C177)/100
> 19     633                                              if C325=. then C633=(C130/C103)*100| else C633=(C130/C325)*100
> 20     732                                              if C325=. then C732=(C585/C103)*100| else C732=(C585/C325)*100
> 21     898                                                                         if C325=. then C898=(C897/C103)*100
>
> Can you help me please?
> I'm French so if you can speak French it's better for me because of my English level
>
>
>       _____________________________________________________________________________
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list