On Mar 5, 2015 8:32 PM, "Sarah Goslee" <sarah.goslee at
gmail.com> wrote:>
> Hi,
>
> On Thursday, March 5, 2015, JS Huang <js.huang at protective.com>
wrote:
>
> > Hi,
> >
> > There is a lot of if-else statement. r syntax rejects them. Here
is
an> > example of if-else example. In r we can code *ifelse(x>2,y <-
> > 1,ifelse(x>1,y <- 0.5, y <- 0))* for the following.
>
>
> I'm not sure what you are talking about: if-else is a valid construct
in
R,> and NOT synonymous with ifelse().
>
> Your construct below is wrong, though, because the curly brace on a line
> alne tells R that you're done. Instead you need
>
> if(x > 2) {
> y <- 1
> } else {
> y <- 0
> }
>
> and these can be nested at will. Note that else is on the same line as the
> curly brace ending the if statement.
>
> http://cran.r-project.org/doc/manuals/R-lang.html#if
>
>
> >
> > if (x > 2)
> > {
> > y = 1
> > }
> > else
> > {
> > if (x > 1)
> > {
> > y = 0.5
> > }
> > else
> > {
> > y = 0
> > }
> > }
> >
> >
> >
> >
> > -----
> > JS Huang
> > --
> > View this message in context:
> >
http://r.789695.n4.nabble.com/help-on-output-my-own-function-result-in-ddply-tp4704238p4704240.html> > Sent from the R help mailing list archive at Nabble.com.
>
>
> Nabble is not the R help mailing list archive, and if you don't include
> context in your post the real R help list will have little idea what
you're> talking about.
Yes, it has happened before and is really confusing to the r-help list. It
occurs when the original message is posted by a user on Nabble who is not
on the r-help list - then that message is held for moderation/discarded.
Then another Nabble user, who is on also the r-help list, respond via
Nabble and then we only see that reply over here at r-help. Second user
who reply is probably unaware of this (though the Nabble interface says
"This post has NOT been accepted by the mailing list yet.") and makes
it
look like s/he is posting random text/code.
It would be useful if our mailing list server could filter out/block such
threads, but that is probably not that easy to do.
Henrik
>
>
> >
> > ______________________________________________
> > R-help at r-project.org <javascript:;> mailing list -- To
UNSUBSCRIBE and
> > more, see
> > 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.
> >
>
> Instead, you could actually sign up for the mailing list.
>
> Sarah
>
>
>
> --
> Sarah Goslee
> http://www.stringpage.com
> http://www.sarahgoslee.com
> http://www.functionaldiversity.org
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
[[alternative HTML version deleted]]