[R] Help with a function and text

Eliano Marques eliano.m.marques at gmail.com
Wed Mar 6 20:25:48 CET 2013


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

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.
>



More information about the R-help mailing list