-Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
>> Behalf
>> Of Liviu Andronic
>> Sent: Thursday, June 06, 2013 8:00 AM
>> To: r-help@r-project.org Help
>> Subject: Re: [R] generate simple function with
On Thu, Jun 6, 2013 at 9:05 AM, William Dunlap wrote:
>
> I said the force was 'required' in the sense that without it
> the function will fail to do what you want in some situations.
With the Force on your side, functions always do what you want.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdu
il.com]
> *Sent:* Thursday, June 06, 2013 8:57 AM
> *To:* William Dunlap
> *Cc:* Liviu Andronic; r-help@r-project.org Help
> *Subject:* Re: [R] generate simple function with pre-defined constants
>
> ** **
>
> hi bill: I understand what you're doing but, atleast for
TIBCO Software
wdunlap tibco.com
From: Mark Leeds [mailto:marklee...@gmail.com]
Sent: Thursday, June 06, 2013 8:57 AM
To: William Dunlap
Cc: Liviu Andronic; r-help@r-project.org Help
Subject: Re: [R] generate simple function with pre-defined constants
hi bill: I understand what you're do
boun...@r-project.org]
> On Behalf
> > Of Liviu Andronic
> > Sent: Thursday, June 06, 2013 8:00 AM
> > To: r-help@r-project.org Help
> > Subject: Re: [R] generate simple function with pre-defined constants
> >
> > On Thu, Jun 6, 2013 at 4:48 PM, Liviu Andronic
CO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Liviu Andronic
> Sent: Thursday, June 06, 2013 8:00 AM
> To: r-help@r-project.org Help
> Subject: Re: [R] generate simple func
Hi,
I am not sure what you are looking for. Here are some examples:
foo <- function(a,b,x) a + b*x
> foo
function(a,b,x) a + b*x
a <- 2
b <- 3
x <- 0:10
> foo(a,b,x)
[1] 2 5 8 11 14 17 20 23 26 29 32
Or
library(polynom)
p1 <- polynomial(c(a,b))
> p1
2 + 3*x
f1 <- as.function(p1)
> f1(
; loaded via a namespace (and not attached):
> [1] tools_3.0.0
>
>
> - Original Message -----
> From: Liviu Andronic
> To: "r-help@r-project.org Help"
> Cc:
> Sent: Thursday, June 6, 2013 10:48 AM
> Subject: [R] generate simple function with pre-defined constan
shape2_1.2.2
loaded via a namespace (and not attached):
[1] tools_3.0.0
- Original Message -
From: Liviu Andronic
To: "r-help@r-project.org Help"
Cc:
Sent: Thursday, June 6, 2013 10:48 AM
Subject: [R] generate simple function with pre-defined constants
Dear all,
Given:
a <- 2
b
On Thu, Jun 6, 2013 at 4:48 PM, Liviu Andronic wrote:
> Dear all,
> Given:
> a <- 2
> b <- 3
>
> I'd like to obtain the following function:
> f <- function(x) 2 + 3*x
>
> but when I do this:
> f <- function(x) a + b*x
> ##f
> ##function(x) a + b*x
>
> the 'a' and 'b' objects do not get evaluated t
Dear all,
Given:
a <- 2
b <- 3
I'd like to obtain the following function:
f <- function(x) 2 + 3*x
but when I do this:
f <- function(x) a + b*x
##f
##function(x) a + b*x
the 'a' and 'b' objects do not get evaluated to their constants. How
could I do that?
Thanks,
Liviu
--
Do you know how to
11 matches
Mail list logo