[R] long character string problem

2007-03-10 Thread toby909
Hi All

I am having 2 very long character strings (550chars) and I want to put them as 
expressions together with c(). The problem is that I also get these 
double-quotes, as seen below in 'fct'. How can I remove these double-quotes? I 
tried as.name() but it did not work (because of size?). These are creating 
trouble with subsequent programs, which I tested with strings that for some 
reason do not have these double quotes (see very bottom).

Thanks Toby




 > cum1
[1] 
"A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)"
 > cum2
[1] 
"A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)"
 > fct = c(as.expression(cum1), as.expression(cum2))
 > fct
expression("A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)",
 

 
"A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)")
 >








 > fct = c(expression(2*x1^3-7*x2^2-9), expression(x1^2-x2^3+1))
 > fct
expression(2 * x1^3 - 7 * x2^2 - 9, x1^2 - x2^3 + 1)

__
[email protected] 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.


Re: [R] long character string problem

2007-03-09 Thread toby909
Yes parse(text=) is what I was looking for. thanks. (I also fixed the missing 
operator).

I will feed this entire expression to the deriv() function.

T


Stephen Tucker wrote:
> I think you are looking for 
> fct <- c(parse(text=cum1),parse(text=cum2))
> 
> although you need to include operators before your A coefficients (for
> example,
> 
> ...C11)A12*...
> 
> 
> 
> 
> --- [EMAIL PROTECTED] wrote:
> 
> 
>>Hi All
>>
>>I am having 2 very long character strings (550chars) and I want to put them
>>as 
>>expressions together with c(). The problem is that I also get these 
>>double-quotes, as seen below in 'fct'. How can I remove these
>>double-quotes? I 
>>tried as.name() but it did not work (because of size?). These are creating 
>>trouble with subsequent programs, which I tested with strings that for some
>>
>>reason do not have these double quotes (see very bottom).
>>
>>
>>
>>
>>
>> > cum1
>>[1] 
>>
> 
> "A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)"
> 
>> > cum2
>>[1] 
>>
> 
> "A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)"
> 
>> > fct = c(as.expression(cum1), as.expression(cum2))
>> > fct
>>
> 
> expression("A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)",
> 
>>
>> 
>>
> 
> "A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)")
> 
>> >
>>
>>
>>
>>
>>
>>
>>
>>
>> > fct = c(expression(2*x1^3-7*x2^2-9), expression(x1^2-x2^3+1))
>> > fct
>>expression(2 * x1^3 - 7 * x2^2 - 9, x1^2 - x2^3 + 1)
>>
>>__
>>[email protected] 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.
>>
> 
> 
> 
> 
> 
>  
> 
> Need Mail bonding?
> 
> __
> [email protected] 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.
>

__
[email protected] 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.


Re: [R] long character string problem

2007-03-09 Thread jim holtman
first of all, your expressions are not legal.  For example

sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)

should be

sqrt(B11*(X11*x1+X21*x2)^2+C11)*A12*(X12*x1+X22*x2)

Here is a rewrite of your first equation that seems to present the correct
results:

> x <- expression(A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)*A12*
+ (X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)*A13*(X13*x1+X23*x2)+
+
-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)*A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+
+
C14)*A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)*A16*(X16*x1+X26*x2)+
+
1*sqrt(B16*(X16*x1+X26*x2)^2+C16)*A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)*A18*
+
(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)*A19*(X19*x1+X29*x2)+-1*
+
sqrt(B19*(X19*x1+X29*x2)^2+C19)*A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110))
>
> x
expression(A11 * (X11 * x1 + X21 * x2) + 1 * sqrt(B11 * (X11 *
x1 + X21 * x2)^2 + C11) * A12 * (X12 * x1 + X22 * x2) + 1 *
sqrt(B12 * (X12 * x1 + X22 * x2)^2 + C12) * A13 * (X13 *
x1 + X23 * x2) + -1 * sqrt(B13 * (X13 * x1 + X23 * x2)^2 +
C13) * A14 * (X14 * x1 + X24 * x2) + -1 * sqrt(B14 * (X14 *
x1 + X24 * x2)^2 + C14) * A15 * (X15 * x1 + X25 * x2) + 1 *
sqrt(B15 * (X15 * x1 + X25 * x2)^2 + C15) * A16 * (X16 *
x1 + X26 * x2) + 1 * sqrt(B16 * (X16 * x1 + X26 * x2)^2 +
C16) * A17 * (X17 * x1 + X27 * x2) + 1 * sqrt(B17 * (X17 *
x1 + X27 * x2)^2 + C17) * A18 * (X18 * x1 + X28 * x2) + 1 *
sqrt(B18 * (X18 * x1 + X28 * x2)^2 + C18) * A19 * (X19 *
x1 + X29 * x2) + -1 * sqrt(B19 * (X19 * x1 + X29 * x2)^2 +
C19) * A110 * (X110 * x1 + X210 * x2) + 1 * sqrt(B110 * (X110 *
x1 + X210 * x2)^2 + C110))
>



On 3/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi All
>
> I am having 2 very long character strings (550chars) and I want to put
> them as
> expressions together with c(). The problem is that I also get these
> double-quotes, as seen below in 'fct'. How can I remove these
> double-quotes? I
> tried as.name() but it did not work (because of size?). These are creating
> trouble with subsequent programs, which I tested with strings that for
> some
> reason do not have these double quotes (see very bottom).
>
>
>
>
>
> > cum1
> [1]
>
> "A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)"
> > cum2
> [1]
>
> "A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)"
> > fct = c(as.expression(cum1), as.expression(cum2))
> > fct
>
> expression("A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)",
>
>
>
> "A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)")
> >
>
>
>
>
>
>
>
>
> > fct = c(expression(2*x1^3-7*x2^2-9), expression(x1^2-x2^3+1))
> > fct
> expression(2 * x1^3 - 7 * x2^2 - 9, x1^2 - x2^3 + 1)
>
> __
> [email protected] 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.
>



-- 
Jim Holtm

Re: [R] long character string problem

2007-03-09 Thread Stephen Tucker
I think you are looking for 
fct <- c(parse(text=cum1),parse(text=cum2))

although you need to include operators before your A coefficients (for
example,

...C11)A12*...




--- [EMAIL PROTECTED] wrote:

> Hi All
> 
> I am having 2 very long character strings (550chars) and I want to put them
> as 
> expressions together with c(). The problem is that I also get these 
> double-quotes, as seen below in 'fct'. How can I remove these
> double-quotes? I 
> tried as.name() but it did not work (because of size?). These are creating 
> trouble with subsequent programs, which I tested with strings that for some
> 
> reason do not have these double quotes (see very bottom).
> 
> 
> 
> 
> 
>  > cum1
> [1] 
>
"A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)"
>  > cum2
> [1] 
>
"A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)"
>  > fct = c(as.expression(cum1), as.expression(cum2))
>  > fct
>
expression("A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)",
> 
> 
>  
>
"A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)")
>  >
> 
> 
> 
> 
> 
> 
> 
> 
>  > fct = c(expression(2*x1^3-7*x2^2-9), expression(x1^2-x2^3+1))
>  > fct
> expression(2 * x1^3 - 7 * x2^2 - 9, x1^2 - x2^3 + 1)
> 
> __
> [email protected] 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.
> 




 

Need Mail bonding?

__
[email protected] 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.


[R] long character string problem

2007-03-09 Thread toby909
Hi All

I am having 2 very long character strings (550chars) and I want to put them as 
expressions together with c(). The problem is that I also get these 
double-quotes, as seen below in 'fct'. How can I remove these double-quotes? I 
tried as.name() but it did not work (because of size?). These are creating 
trouble with subsequent programs, which I tested with strings that for some 
reason do not have these double quotes (see very bottom).





 > cum1
[1] 
"A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)"
 > cum2
[1] 
"A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)"
 > fct = c(as.expression(cum1), as.expression(cum2))
 > fct
expression("A11*(X11*x1+X21*x2)+1*sqrt(B11*(X11*x1+X21*x2)^2+C11)A12*(X12*x1+X22*x2)+1*sqrt(B12*(X12*x1+X22*x2)^2+C12)A13*(X13*x1+X23*x2)+-1*sqrt(B13*(X13*x1+X23*x2)^2+C13)A14*(X14*x1+X24*x2)+-1*sqrt(B14*(X14*x1+X24*x2)^2+C14)A15*(X15*x1+X25*x2)+1*sqrt(B15*(X15*x1+X25*x2)^2+C15)A16*(X16*x1+X26*x2)+1*sqrt(B16*(X16*x1+X26*x2)^2+C16)A17*(X17*x1+X27*x2)+1*sqrt(B17*(X17*x1+X27*x2)^2+C17)A18*(X18*x1+X28*x2)+1*sqrt(B18*(X18*x1+X28*x2)^2+C18)A19*(X19*x1+X29*x2)+-1*sqrt(B19*(X19*x1+X29*x2)^2+C19)A110*(X110*x1+X210*x2)+1*sqrt(B110*(X110*x1+X210*x2)^2+C110)",
 

 
"A21*(X11*x1+X21*x2)+1*sqrt(B21*(X11*x1+X21*x2)^2+C21)A22*(X12*x1+X22*x2)+1*sqrt(B22*(X12*x1+X22*x2)^2+C22)A23*(X13*x1+X23*x2)+-1*sqrt(B23*(X13*x1+X23*x2)^2+C23)A24*(X14*x1+X24*x2)+-1*sqrt(B24*(X14*x1+X24*x2)^2+C24)A25*(X15*x1+X25*x2)+1*sqrt(B25*(X15*x1+X25*x2)^2+C25)A26*(X16*x1+X26*x2)+1*sqrt(B26*(X16*x1+X26*x2)^2+C26)A27*(X17*x1+X27*x2)+1*sqrt(B27*(X17*x1+X27*x2)^2+C27)A28*(X18*x1+X28*x2)+1*sqrt(B28*(X18*x1+X28*x2)^2+C28)A29*(X19*x1+X29*x2)+-1*sqrt(B29*(X19*x1+X29*x2)^2+C29)A210*(X110*x1+X210*x2)+1*sqrt(B210*(X110*x1+X210*x2)^2+C210)")
 >








 > fct = c(expression(2*x1^3-7*x2^2-9), expression(x1^2-x2^3+1))
 > fct
expression(2 * x1^3 - 7 * x2^2 - 9, x1^2 - x2^3 + 1)

__
[email protected] 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.