This fixed it: paste(errs, collapse="\\n")

Since that fixed it, I did not try anything else.

Thanks again,

Ben


On Wed, Sep 14, 2011 at 10:04 AM, Steve Lianoglou <
mailinglist.honey...@gmail.com> wrote:

> Hi,
>
> On Wed, Sep 14, 2011 at 12:01 PM, Ben qant <ccqu...@gmail.com> wrote:
> > That fixed it!! Thank you very much! I should have thought of that.
>
> For the sake of others that might stumble on this thread -- what fixed
> it, exactly?
>
> Doing paste(errs, collapse="\\n"), or the writing to a tmp file thing, or?
>
> -steve
>
> >
> > Thanks again,
> >
> > Ben
> >
> > On Wed, Sep 14, 2011 at 9:57 AM, Steve Lianoglou
> > <mailinglist.honey...@gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> On Wed, Sep 14, 2011 at 11:44 AM, Ben qant <ccqu...@gmail.com> wrote:
> >> > Hello,
> >> >
> >> > I've posted something similar under a different subject and never
> >> > received a
> >> > solution. Trying again with (hopefully) a better description.
> >> >
> >> > Objective: Send a matrix of string data in an email message. The
> message
> >> > must have authentication and be sent via an R script.
> >> >
> >> > I'm almost there!
> >> >
> >> > Here is where I am at:
> >> > I collect long error message lines in 'errs', which is a matrix.
> >>
> >> (I might collect this into a list, but that's just a matter of style)
> >>
> >>
> >> > Then I collapse them into a character vector via:
> >> >
> >> > errs = paste(errs, collapse = "")
> >> >
> >> > Then I send that in a email via rJython. The message is sent to an
> >> > Microsoft
> >> > Outlook address like this:
> >> >
> >> > mail = c(  ....etc...
> >> > paste("msg = MIMEText('",errs,"')",sep=""),
> >> > ...etc....)
> >> >
> >> > ...etc... [the rest of the rJython stuff to send a message omitted
> here]
> >> >
> >> > jython.exec(rJython,mail)
> >> >
> >> > The problem: The issue is that the message wraps the text in the body
> of
> >> > the
> >> > message so that the message just looks like one big line of text which
> >> > makes
> >> > it very difficult to read (aka is not acceptable).
> >> >
> >> > Notes:
> >> > 1) The message must have authentication; therefore, I am using
> rJython.
> >> > (My
> >> > understanding is that there is no R way to send an email message with
> >> > authentication.)
> >> > 2) I have to receive the message in Outlook.
> >> > 3) When I do errs = paste(errs, collapse = "\n"), and pass that as the
> >> > message text, rJython gives me an error:
> >> > Error in ls(envir = envir, all.names = private) :
> >> >  invalid 'envir' argument
> >>
> >> It's hard to imagine why this would happen. using `paste(errs,
> >> collapse="")` vs. `paste(errs, collapse="\n")` will provide you with
> >> one character vector/string, so I've got to believe the problem is
> >> somewhere else.
> >>
> >> Just a stab in the dark, but does `paste(errs, collapse="\\n")` give
> >> you problems?
> >>
> >> What if you take your `errs = paste(errs, collapse="\n")` and call
> >> `writeLines` on `errs` to a tmp file that you provide the path for to
> >> rJython, which then reads the file and append into a message.
> >>
> >> Also -- if you want to be reading the file "normally" on windows,
> >> shouldn't you be using windows line endings (I think "\r\n"), or does
> >> outlook recognize "\n" as a new line (I'm imagining if you do get the
> >> whole thing to work, outlook might still just show you one long line
> >> since "\n" alone isn't recognized as a newline command on windows
> >> (last time I checked)).
> >>
> >> -steve
> >>
> >> --
> >> Steve Lianoglou
> >> Graduate Student: Computational Systems Biology
> >>  | Memorial Sloan-Kettering Cancer Center
> >>  | Weill Medical College of Cornell University
> >> Contact Info: http://cbio.mskcc.org/~lianos/contact
> >
> >
>
>
>
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
>

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