I am not able to understand the output of the following lines of code.
*if(TRUE)(print("A"))*
Versus
*if(TRUE){print("A"))*
*In first case I get the ooutput as *
*>[1] "A"*
*>[1] "A"*
*Why does the first case print "A" twice *
*Why does it not happen with the statement **if(TRUE){print("A
In the code below
*ff <- function(n){ for(i in 1:n) (i+1)}*
*n<-3;ff(n)->op;print(op)*
Why doesnt *print(op) * print 4 and instead prints NULL.
Isnt the last line of code executed is *i+1 * and therefore that should be
returned instead of NULL
instead if I say
*ff <- function(n){ (n+1) }*
The
returned, not even NULL
> >> for(i in 1:3) i
> > ## Ditto
> >
> >> z <- NULL
> >> z <- for(i in 1:3)i
> >> z
> > NULL ## still
> >
> > Cheers,
> > Bert
> >
> >
> >
> >
> > Cheers,
> > Ber
Hi,
I need to understand the inconsistent behaviour of & and I operators when
used with NA.
The code below explains this inconsistency
> TRUE & NA
[1] NA
> FALSE & NA
[1] FALSE
> TRUE & NA
[1] NA
> FALSE | NA
[1] NA
> TRUE | NA
[1] TRUE
> TRUE == NA
[1] NA
> FALSE == NA
[1] NA
[[a
Taking this question further.
If I use a complex number or a numeric as an operand in logical
operations, to me it APPEARS that these two types are first coerced to
LOGICAL internally and then THIS logical output is further used as the
operand.
For eg.
> x <- 4+5i; c(x & F, x & T, x | F, x | T)
[
017 at 4:15 PM, Rolf Turner wrote:
> On 20/05/17 22:42, Duncan Murdoch wrote:
>>
>> On 20/05/2017 6:39 AM, Rolf Turner wrote:
>>>
>>> On 20/05/17 22:18, Duncan Murdoch wrote:
>>>>
>>>> On 20/05/2017 5:53 AM, Martin Maechler wrote:
>>&g
What is the cause of the error below ?
> y <- 1
> y[1] <- NULL
Error in y[1] <- NULL : replacement has length zero
Thanks,
Ramnik
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https:/
I have been trying to understand how the argument 'nmax' works in
'factor' function. R-Documentation states - "Since factors typically
have quite a small number of levels, for large vectors x it is helpful
to supply nmax as an upper bound on the number of unique values."
In the code below what is
Hi,
I installed R 3.4.1 on Mac OSX 10.12.6 version.
On opening Preferences and trying to change the editor font by
clicking the select button I get following error message in R.
2017-08-28 11:57:41.551 R[809:11355] *** RController: caught ObjC
exception while processing system events. Update to
Getting following error in using help.search
>utils::help.search("linear models")
Error in help(db[i, "topic"], package = db[i, "Package"], lib.loc = lib, :
'topic' should be a name, length-one character vector or reserved word
> example(help.search)
hlp.sr> help.search("linear models")#
Thanks. But it seems to be an R 3.2.0 specific problem.
On Sun, Jun 14, 2015 at 8:42 AM, David Winsemius
wrote:
>
> On Jun 13, 2015, at 7:41 AM, Ramnik Bansal wrote:
>
> > Getting following error in using help.search
> >
> >> utils::help.search("linear mode
Hi,
I am trying to understand under which specific conditions does explicit
coercion produce warnings.
> as.numeric(c(1, F, "b"))
[1] 1 NA NA
Warning message:
NAs introduced by coercion
> as.logical(c(1, F, "b"))
[1]NA FALSENA
In above examples, as.numeric produces warning but as.logi
Hi,
The help file for function read.table mentions the default value for the
argument numerals as
c("allow.loss", "warn.loss", "no.loss")
How are the three values used as default values ?
Thanks
Ramnik
[[alternative HTML version deleted]]
__
13 matches
Mail list logo