Displaying 20 results from an estimated 90000 matches similar to: "Surprising behavior of letters[c(NA, NA)]"
2015 Feb 09
3
xtabs and NA
Hi
I haven't found a way to produce a tabulation from factor data with NA
values using xtabs. Please find a minimal example below, it's also on
R-pubs [1]. Tested with R 3.1.2 and R-devel r67720.
It doesn't seem to be documented explicitly that it's not supported.
From reading the code [2] it looks like the relevant call to table()
doesn't set the "useNA"
2003 May 20
1
surprising behaviour of "bgroup": sets all in greek letters
Dear R user community
I wanted to use "bgroup" for plotting a math formula with
a big "{" on the left, and nothing on the right.
i used
text( 10, 10, pos=4, cex=1.8, expression(F(x) == bgroup("{", x, "")), ...)
on a 40 x 20 plot.
surprisingly,
bgroup sets "Phi(xi) = { xi"
i.e. replaces alphabetic characters with greek letters in the entire
2007 May 03
3
Filling array: No recycling
Hello,
is it possible to fill an array with no using of the recycling rule?
My problem. I want to fill an array but my values have not always
the same length.
My aim. I want to fill the array only ONE TIME. All vacent places
should be written with NA.
Thank's a lot.
Felix
Example:
--------
#Write 1 to 3 only one time. The last
#5 place should be NA.
dim(as.array(letters))
array(1:3,
2008 Nov 28
1
NA and logical indexes
Hi,
I vaguely remember this issue being discussed at some length in the
past, but am having trouble relocating the proper thread (defining an
adequate search string to do so):
---<---------------cut here---------------start-------------->---
R> foo <- data.frame(A=gl(2, 5, labels=letters[1:2]), X=runif(10))
R> foo$A[1] <- NA
R> foo$A == "b"
[1] NA FALSE FALSE
2017 Jan 26
3
RFC: tapply(*, ..., init.value = NA)
Last week, we've talked here about "xtabs(), factors and NAs",
-> https://stat.ethz.ch/pipermail/r-devel/2017-January/073621.html
In the mean time, I've spent several hours on the issue
and also committed changes to R-devel "in two iterations".
In the case there is a *Left* hand side part to xtabs() formula,
see the help page example using 'esoph',
it
2008 Mar 26
5
S4 slot with NA default
Hi
How do I specify an S4 class with a slot that is potentially numeric,
but NA
by default? I want the slot to be NA until I calculate its value
(an expensive operation, not needed for all applications). When
its value is
known, I will create a new object with the correct value inserted in
the slot.
I want "NA" to signify "not known".
My attempt fails because
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
I think you should be more suspicious of yourself, Dimitri. A letter T variable can easily arise in the problem domain when you are not thinking of logical values at all, at which point your cavalier use of T as a synonym for TRUE can suddenly become a bug.
--
Sent from my phone. Please excuse my brevity.
On July 27, 2017 8:18:03 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at
2017 Jul 27
2
na.rm = T treatment by ggplot2's geom_bar
Just a thought:
Did you try na.rm = TRUE in case you have an object named "T" in scope?
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Jul 27, 2017 at 7:49 AM, Dimitri Liakhovitski
<dimitri.liakhovitski at
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
Thank you, Bert!
I do NOT have an object named "T" in scope (I checked - and besides, it
would never occur to me to use this name).
TRUE or T results in the same unexpected behavior:
ggplot(data = md, mapping = aes(x = a)) +
geom_bar(na.rm = TRUE)
On Thu, Jul 27, 2017 at 10:57 AM, Bert Gunter <bgunter.4567 at gmail.com>
wrote:
> Just a thought:
>
> Did you try
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
?hanks for the advice, Jeff. Will keep it in mind.
But I am anal - I shy away from using letters and words that "look
familiar" to me in R (such as mean, sd, T, etc.)
But still, it's a good advice.
On Thu, Jul 27, 2017 at 11:53 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us>
wrote:
> I think you should be more suspicious of yourself, Dimitri. A letter T
> variable can
2011 Jan 06
5
How to join matrices of different row length from a list
Hi,
I have several matrix in a list, for example:
e
[[1]]
[,1] [,2]
[1,] 1 3
[2,] 2 4
[[2]]
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
[[3]]
[,1] [,2]
[1,] 2 1
I would like to join them by column i.e.
[,1] [,2] [,3] [,4][,5] [,6]
[1,] 1 3 1 4 2 1
[2,] 2 4 2 5 NA NA
[3,] NA NA 3 6 NA NA
I have tried
2003 May 25
0
surprising behaviour of "bgroup": sets all in greek letters (PR#3099)
Let me summarize the bug reported by Ulf Martin on R-help with the same
subject line.
The code
plot(1:10)
text(1, 9, expression(F == bgroup("{", x, "")))
results in greek letters, which is not expected here.
That happens if the user tries to set only a left delimeter, the same with:
text(2, 8, expression(F == bgroup("{", x, ".")))
or
2017 Jul 27
3
na.rm = T treatment by ggplot2's geom_bar
Hello!
I am trying to understand how ggplot2's geom_bar treats NAs.
The help file says:
library(ggplot2)
?geom_bar
na.rm: If FALSE, the default, missing values are removed with a warning. If
TRUE, missing values are silently removed.
I am trying it out:
md <- data.frame(a = c(letters[1:5], letters[1:4], letters[1:3], rep(NA,
3)))
str(md); levels(md$a)
ggplot(data = md, mapping = aes(x =
2011 Jun 23
3
problem (and solution) to rle on vector with NA values
Hello there R-help,
I'm not sure if this should be posted here - so apologies if this is the case.
I've found a problem while using rle and am proposing a solution to the issue.
Description:
I ran into a niggle with rle today when working with vectors with NA values
(using R 2.31.0 on Windows 7 x64). It transpires that a run of NA values
is not encoded in the same way as a run of other
2017 Jul 27
0
na.rm = T treatment by ggplot2's geom_bar
To clarify: my question is not about "who could I exclude NAs from being
counted" - I know how to do that.
My question is: Why na.rm = T is not working for geom_bar in this case?
On Thu, Jul 27, 2017 at 8:24 AM, Dimitri Liakhovitski <
dimitri.liakhovitski at gmail.com> wrote:
> Hello!
>
> I am trying to understand how ggplot2's geom_bar treats NAs.
> The help file
2008 Dec 07
5
How to force aggregate to exclude NA ?
The aggregate function does "almost" all that I need to summarize a datasets, except that I can't specify exclusion of NAs without a little bit of hassle.
> set.seed(143)
> m <- data.frame(A=sample(LETTERS[1:5], 20, T), B=sample(LETTERS[1:10], 20, T), C=sample(c(NA, 1:4), 20, T), D=sample(c(NA,1:4), 20, T))
> m
A B C D
1 E I 1 NA
2 A C NA NA
3 D I NA 3
4 C I
2017 Jul 27
1
na.rm = T treatment by ggplot2's geom_bar
I suspect this is by design. Questions about "why" should probably cc the contributed package maintainer(s).
--
Sent from my phone. Please excuse my brevity.
On July 27, 2017 7:49:47 AM PDT, Dimitri Liakhovitski <dimitri.liakhovitski at gmail.com> wrote:
>To clarify: my question is not about "who could I exclude NAs from
>being
>counted" - I know how to do
2007 Jun 20
2
Expected behavior from: all(c(NA, NA, NA) < NA, na.rm = TRUE)?
Hi all,
Came across this curious behavior in:
R version 2.5.0 Patched (2007-06-05 r41831)
A simplified example is:
> all(c(NA, NA, NA) > NA, na.rm = TRUE)
[1] TRUE
Is this expected by definition?
If one reduces this to individual comparisons, such as :
> NA > NA
[1] NA
> all(NA > NA)
[1] NA
> all(NA > NA, na.rm = TRUE)
[1] TRUE
the initial comparison on the 3
2002 Aug 13
2
Misalignment of <NA> in rownames (PR#1905)
An NA in the rownames of a matrix (or dataframe) causes misalignment when the
matrix is printed:
R> x <- matrix(1:12, 3,4, dimnames=list(letters[1:3], LETTERS[1:4]))
R> rownames(x)[2] <- NA
R> x
A B C D
a 1 4 7 10
<NA> 2 5 8 11
c 3 6 9 12
The bug is in function Rstrlen, in src/main/printutils.c. MatrixRowLabel and
MatrixColumnLabel (same file) rely on Rstrlen
2004 Jul 10
1
read.table, read.fwf, and na.strings (PR#7075)
# Your mailer is set to "none" (default on Windows),
# hence we cannot send the bug report directly from R.
# Please copy the bug report (after finishing it) to
# your favorite email program and send it to
#
# r-bugs@r-project.org
#
######################################################
Is this intended behavior for the read.fwf(na.strings="-999")?
I anticipated that