"I suspect akshay is (or was? Not sure) unclear about what braces do.
They are not closures... they create an expression that wraps multiple
expressions into one expression... they are a little more like
parentheses than closures. They are not **intrinsically associated**
with creation of environme
I suspect akshay is (or was? Not sure) unclear about what braces do. They are
not closures... they create an expression that wraps multiple expressions into
one expression... they are a little more like parentheses than closures. They
are not intrinsically associated with creation of environment
Akshay,
Your question seems a tad mysterious to me as you are complaining about
NOTHING.
R was designed to return single values. The last statement executed in a
function body, for example, is the value returned even when not at the end.
Scoping is another issue entirely. What is visible is anot
Dear Andrew,
Nice point.
THanking you,
Yours sincerely,
AKSHAY M KULKARNI
From: Andrew Simmons
Sent: Monday, January 9, 2023 10:52 PM
To: akshay kulkarni
Cc: Valentin Petzel ; R help Mailing list
Subject: Re: [R] return value of {.
Returning the last value of { is the basis of functions not needing a
return statement. Before R invokes a function (specifically a closure), it
creates a new context. When R evaluates a call to return, it looks for a
context to return from and finds the context of function, ending the
context and
Dear Valentin,
But why should {} "return" a value? It could just
as well evaluate all the expressions and store the resulting objects in
whatever environment the interpreter chooses, and then it would be left to the
user to manipulate any object he chooses. Don't yo
dear Rui,
Thanks a lot
Thanking you,
Yours sincerely,
AKSHAY M KULKARNI
From: Rui Barradas
Sent: Monday, January 9, 2023 9:48 PM
To: akshay kulkarni ; R help Mailing list
Subject: Re: [R] return value of {}
�s 14:47 de 09/01/2023, aksha
Perhaps the following may be of use to you.
Consider:
> f <- function(){ x <- 3; function(y) x+y}
> x <- 5
##What does this give?
> f()
## Why?
## How about this?
>f()(10)
## Why?
## If you remove "x <- 3" from the above, what will you get when you repeat
the exercise?
-- Bert
On Mon, Jan 9,
dear Bert,
Thanks a lot...
Thanking you,
Yours sincerely,
AKSHAY M KULKARNI
From: Bert Gunter
Sent: Monday, January 9, 2023 9:59 PM
To: akshay kulkarni
Cc: R help Mailing list
Subject: Re: [R] return value of {}
Unless you do something sp
Unless you do something special within a function, only the value(s)
returned are available to the caller. That is the essence of
functional-type programming languages.
You need to read up on (function) environments in R . You can search on
this. ?function and its links also contain useful informa
Às 14:47 de 09/01/2023, akshay kulkarni escreveu:
Dear members,
I have the following code:
TB <- {x <- 3;y <- 5}
TB
[1] 5
It is consistent with the documentation: For {, the result of the last
expression evaluated. This has the visibility of the last evaluation.
Dear members,
I have the following code:
> TB <- {x <- 3;y <- 5}
> TB
[1] 5
It is consistent with the documentation: For {, the result of the last
expression evaluated. This has the visibility of the last evaluation.
But both x AND y are created, but the "return val
Dear all,
What I want to create is an interactive 3D plot from a data frame like this:
#: number
TLD: Countrycode
Date: date
String: a label
Because plot3d can only deal with numbers I converted Date to Year and
TLD as well as String to a numeric value like this:
numTLD <- as.numeric(factor(df
On Sat, 07 Jan 2023, Sigbert Klinke writes:
> Hi,
>
> has someone experience which routine should be used for
> creating fractional numbers? The two conversion
> routines deliver different results
>
>> x <- (0:7)/7
>
>> MASS::fractions(x)
>
> [1] 0 1/7 2/7 3/7 4/7 5/7 6/7 1
>
>> gmp::as.bigq(x
Dear all,
I am pleased to announce that CRAN now hosts my package gRaven.
This provides wrappers for functions in the 'gRain' package to emulate
some 'RHugin' functionality, allowing the building of Bayesian networks
consisting of discrete chance nodes incrementally - through adding
nodes, ed
15 matches
Mail list logo