It's a plausible use-case. For example, in the example section of a help file.
if(require(aPackage))
{
# Do computations.
# Show beginning of first result vector.
# Show beginning of second result vector.
}
__
R-help@r-project.org mailing list
On 17/07/2014, 10:00 PM, Dario Strbenac wrote:
The example in the question was not inside a user function.
The explanations you were given were slightly inaccurate. The usual
rule is that results returned at the top level are printed unless they
are marked as invisible. (There are a few cases
On Jul 20, 2014, at 6:30 AM, Duncan Murdoch wrote:
On 17/07/2014, 10:00 PM, Dario Strbenac wrote:
The example in the question was not inside a user function.
The explanations you were given were slightly inaccurate. The usual
rule is that results returned at the top level are printed
On 20/07/2014, 5:46 PM, David Winsemius wrote:
On Jul 20, 2014, at 6:30 AM, Duncan Murdoch wrote:
On 17/07/2014, 10:00 PM, Dario Strbenac wrote:
The example in the question was not inside a user function.
The explanations you were given were slightly inaccurate. The usual
rule is that
On 18/07/14 15:00, Dario Strbenac wrote:
The example in the question was not inside a user function.
Don't be silly.
cheers,
Rolf Turner
--
Rolf Turner
Technical Editor ANZJS
__
R-help@r-project.org mailing list
Hello,
I have a block of code that has two head calls at the end, but only the second
is shown on screen. If I manually execute the statement which is not showing,
it works. I thought that if statements are not functions. It is behaving as one.
if(1 2)
+ {
+ x-rnorm(100)
+ y - rpois(10,
Hi,
You can get the behaviour you want using the print() command:
if(1 2)
{
x-rnorm(100)
y - rpois(10, 5)
print(head(x))
print(head(y))
}
Sarah
On Thu, Jul 17, 2014 at 2:00 AM, Dario Strbenac
dstr7...@uni.sydney.edu.au wrote:
Hello,
I have a block of code that has two head calls
Hello,
Also, unlike what the op says, if statements are functions, explaining
the behavior he got.
Hope this helps,
Rui Barradas
Em 17-07-2014 16:53, Sarah Goslee escreveu:
Hi,
You can get the behaviour you want using the print() command:
if(1 2)
{
x-rnorm(100)
y - rpois(10, 5)
This question is related to FAQ 7.16, which you should look up.
In general, whenever you just type a variable or function directly at the
command line, R prints the result for you. Inside code blocks of any kind,
it does not do that, so you need to use the print function yourself.
On Thu, 17
On Jul 17, 2014, at 9:27 AM, Rui Barradas wrote:
Hello,
Also, unlike what the op says, if statements are functions, explaining the
behavior he got.
I'm not sure that is correct. The help page says if() is a control-construct. I
think the function is actually {
{rnorm(10); rpois(10, 3)}
On 18/07/14 11:32, David Winsemius wrote:
On Jul 17, 2014, at 9:27 AM, Rui Barradas wrote:
Hello,
Also, unlike what the op says, if statements are functions, explaining the
behavior he got.
I'm not sure that is correct. The help page says if() is a control-construct. I think the
function
Rolf et.al
I have not followed this thread closely and so have nothing to say
about whose or what explanation is correct.
However, the following statement is misleading, if not wrong:
---
foo - function(){
x - 17
x
y - 42
y
}
If you type foo() you get
[1] 42
which is
The example in the question was not inside a user function.
__
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,
13 matches
Mail list logo