> Thank you very much Jorge, Phil  and  David: I was finally able to  
> perform the operations I needed. I changed the function in order to  
> adapt it to the simplest form like the following:
> ali <- function(Abase) {
>       alitemp  <- ((Abase/llmcc$Clase)*PClase)+(((1/llmcc 
> $Categoria)*Abase)*PCategoria)+((Abase*llmcc$Phi)*PPhi)+((Abase*llmcc 
> $Rf)*PRf)
>         # Subtotal para redondeo
>       sumaformula <- sum(alitemp)
>         # Fragmentacion de la matriz segun clases...
>         llmcc2 <- llmcc
>         llmcc2$Alitmp  <- alitemp
>         llmcc2$newExpression <- with(llmcc2,ifelse(Clase<10,  
> Alitmp*100/sumaformula, Alitmp*100/sumaformula)/PAnclas)
>       return (llmcc2)
>       }
> There are a couple of things I have to work out first though: The  
> scope of an external variable (Abase) that I'd like to use it as a  
> default so I dont have to bother in identifiying it everytime i run  
> the function, and the possibility of creating many dataframes until  
> they reach a certain stage.
> At any rate, thank you all for your kind help.
>
> Guillermo
>
> El 09/02/2009, a las 05:59 p.m., Jorge Ivan Velez escribió:
>>
>> If I understand correctly, one option would be using ifelse() as  
>> follows:
>>
>> lmcc$newExpression<-with(lmcc,ifelse(Clase<10,  
>> your.formula.goes.here, an.option.goes.here))
>>
>> being the options above the two different expression you already  
>> have.
>>

La limpieza es algo casi imposible. Ley de la cocina de O'Reilly.
------------------------------
Jesús Guillermo Andrade (Abg.)
Gerente de Litigios y Corporativo. EDM. AC. API.
Andrade & Moreno S.C. (http://amlegal.wordpress.com/)


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to