Skip to content
Back to formatted view

Raw Message

Message-ID: <CA+8X3fVFKqQ+KX9PtCLQB3QK=+Ti0WzE8p9AKDw4A0BDo-Yw6A@mail.gmail.com>
Date: 2016-06-02T03:03:01Z
From: Jim Lemon
Subject: Making an if condition variable ?
In-Reply-To: <20160601223029.1880@web003.roc2.bluetie.com>

Hi ce,

a<-10
condition<-expression("a>0")
if(eval(parse(text=condition))) cat("a>0\n")

Jim

On Thu, Jun 2, 2016 at 12:30 PM, ce <zadig_1 at excite.com> wrote:
>
> Dear all,
>
> I want to make an if condition variable like :
>
> a = 10
> CONDITION = " a > 0 "
>
> if ( CONDITION ) print(" a is bigger" )
>
> I tried get , getElement , eval without success ?
>
> Thanks
>
> ______________________________________________
> 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.