[R] Help with a function and text

David Winsemius dwinsemius at comcast.net
Thu Mar 7 00:39:14 CET 2013


On Mar 6, 2013, at 11:25 AM, Eliano Marques wrote:

> Hi, can I understand why this message was rejected ?
> Thanks,
> Eliano

First hit on a Markmail search:

http://markmail.org/message/5xog3ayx4amprsdx?q=list:org%2Er-project%2Er-help+nabble+rejected

-- 
David.

> 
> Sent from my iPhone
> 
> On 6 Mar 2013, at 19:18, Eliano <eliano.m.marques at gmail.com> wrote:
> 
>> Hi everyone,
>> 
>> I am writing some code to generate a function. I am passing that code to a
>> dataset which i'm importing in R, e.g.
>> Test=read.table('C:/test.txt', header=F, sep='\t', na.strings='NA', dec='.',
>> strip.white=TRUE)
>> Test
>> 
>> V1
>> (if(nclusters>0){OptmizationInputs[3,3]*beta[1]}else{0})+"
>> (if(nclusters>1){OptmizationInputs[3,3]*beta[1]}else{0})+"
>> V1 has inside a code for a function.
>> 
>> I'm having problems with 2 things:
>> 
>> 1 - I need to take out from V1 all " that appears in the text, i tried a
>> replace but did not work.
>> Test=replace(Test,' " ', ' ')  , did not work.
>> 
>> 2 - Writing a function like this :
>> 
>> nlog=function(par)
>>       {
>>       beta=par[1:n]
>>       Measure=Test[1]  # would this read the text?
>>       return(Measure)
>>       }
>> 
>> So i need to use that code inside the function as above.
>> Any suggestion on how you would do this?
>> 
>> Kind Regards,
>> Eliano
>> 
>> 
>> 
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Help-with-a-function-and-text-tp4660523.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
> 
> ______________________________________________
> R-help at 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list