Displaying 20 results from an estimated 46 matches for "usena".
2010 Jan 07
2
table() and setting useNA to be there by default?
Good morning,
Is there a way to get table() to default to including NAs - as in...
table(..., useNA='ifany') or table(..., useNA='always') or table(...,
exclude=NULL) ?
I can't see a way under table() or options() or searching the archives
(probably using the wrong keyword?).
> t1 <- c(1,2,3,3,3,2,NA,NA,NA,NA)
> table(t1)
t1
1 2 3
1 2 3
I keep forgetting to allow...
2016 Aug 11
2
table(exclude = NULL) always includes NA
I stand corrected. The part "If set to 'NULL', it implies 'useNA="always"'." is even in the documentation in R 2.8.0. It was my fault not to check carefully.
I wonder, why "always" was chosen for 'useNA' for exclude = NULL.
Why exclude = NULL is so special? What about another 'exclude' of length zero, like character...
2016 Aug 14
2
table(exclude = NULL) always includes NA
useNA <- if (missing(useNA) && !missing(exclude) && !(NA %in% exclude)) "ifany"
An example where it change 'table' result for non-factor input, from https://stat.ethz.ch/pipermail/r-help/2005-April/069053.html :
x <- c(1,2,3,3,NA)
table(as.integer(x), exclude=NaN)...
2016 Aug 12
0
table(exclude = NULL) always includes NA
>>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel at r-project.org>
>>>>> on Thu, 11 Aug 2016 16:19:49 +0000 writes:
> I stand corrected. The part "If set to 'NULL', it implies
> 'useNA="always"'." is even in the documentation in R
> 2.8.0. It was my fault not to check carefully. I wonder,
> why "always" was chosen for 'useNA' for exclude = NULL.
me too. "ifany" would seem more logical, and I am considering
changing t...
2016 Aug 07
2
table(exclude = NULL) always includes NA
...)
b
a 1 2
1 1 1
2 2 0
3 1 0
<NA> 1 0
With R 3.3.1:
> a <- c(1, 1, 2, 2, NA, 3); b <- c(2, 1, 1, 1, 1, 1)
> table(a, b, exclude = NULL)
b
a 1 2 <NA>
1 1 1 0
2 2 0 0
3 1 0 0
<NA> 1 0 0
> table(a, b, useNA = "ifany")
b
a 1 2
1 1 1
2 2 0
3 1 0
<NA> 1 0
> table(a, b, exclude = NULL, useNA = "ifany")
b
a 1 2 <NA>
1 1 1 0
2 2 0 0
3 1 0 0
<NA> 1 0 0
For the example, in R 3.3.1, the result of '...
2016 Aug 17
1
table(exclude = NULL) always includes NA
The quirk as in table(1:3, exclude = 1, useNA = "ifany") is actually somewhat documented, and still in R devel r71104. In R help on 'table', in "Details" section:
It is best to supply factors rather than rely on coercion. In particular, ?exclude? will be used in coercion to a factor, and so values (not levels) whic...
2016 Aug 15
1
table(exclude = NULL) always includes NA
...> Martin Maechler <maechler at stat.math.ethz.ch>
>>>>> on Mon, 15 Aug 2016 11:07:43 +0200 writes:
>>>>> Suharto Anggono Suharto Anggono <suharto_anggono at yahoo.com>
>>>>> on Sun, 14 Aug 2016 03:42:08 +0000 writes:
>> useNA <- if (missing(useNA) && !missing(exclude) && !(NA %in% exclude)) "ifany"
>> An example where it change 'table' result for non-factor input, from https://stat.ethz.ch/pipermail/r-help/2005-April/069053.html :
>> x <- c(1,2,3,3,NA)
>...
2013 Aug 09
1
a fast table() for the 1D case
Hi,
table1D() below can be up to 60x faster than base::table() for the 1D
case. Here are the detailed speedups compared to base::table().
o With a logical vector of length 5M: 11x faster
(or more if 'useNA="always"')
o With factor/integer/numeric/character of length 1M and 9 levels
(or 9 distinct values for non-factors):
- factor: 60x faster
- integer/numeric vector: 12x faster
- character vector: 2.4...
2016 Aug 09
0
table(exclude = NULL) always includes NA
...gt; <NA> 1 0
> With R 3.3.1:
> > a <- c(1, 1, 2, 2, NA, 3); b <- c(2, 1, 1, 1, 1, 1)
> > table(a, b, exclude = NULL)
> b
> a 1 2 <NA>
> 1 1 1 0
> 2 2 0 0
> 3 1 0 0
> <NA> 1 0 0
> > table(a, b, useNA = "ifany")
> b
> a 1 2
> 1 1 1
> 2 2 0
> 3 1 0
> <NA> 1 0
> > table(a, b, exclude = NULL, useNA = "ifany")
> b
> a 1 2 <NA>
> 1 1 1 0
> 2 2 0 0
> 3 1 0 0
> <...
2016 Sep 10
1
table(exclude = NULL) always includes NA
...de,NA), nomatch=0L) > 0L
or
is.na(a) <- as.logical(match(a0, c(exclude,NA), nomatch=0L)) .
The parallel code
is.na(a) <- match(a0, exclude, nomatch=0L)
is to be treated similarly.
Example that gives wrong result in R devel r71225:
table(3:1, exclude = 1)
table(3:1, exclude = 1, useNA = "always")
--------------------------------------------
On Tue, 16/8/16, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
Subject: Re: [Rd] table(exclude = NULL) always includes NA
Cc: "Martin Maechler" <maechler at stat.math.ethz.ch>
Date: Tuesday, 16 Au...
2012 Mar 19
1
Problem with table
R version 2.14.0, started with --vanilla
> table(c(1,2,3,4,NA), exclude=2, useNA='ifany')
1 3 4 <NA>
1 1 1 2
This came from a local user who wanted to remove one particular response
from some tables, but also wants to have NA always reported for data
checking purposes.
I don't think the above is what anyone would want.
PS.
This is...
2016 Apr 28
4
Interdependencies of variable types, logical expressions and NA
...Check_U_0__Kd_1_2012 from Umsatz_2012 and Kunde01_2012
Creating Check_U_0__Kd_1_2013 from Umsatz_2013 and Kunde01_2013
Creating Check_U_0__Kd_1_2014 from Umsatz_2014 and Kunde01_2014
Creating Check_U_0__Kd_1_2015 from Umsatz_2015 and Kunde01_2015
>
> table(Kunden01$Check_U_0__Kd_1_2011, useNA = "ifany")
Check 0 OK <NA>
1 16 13
> table(Kunden01$Check_U_0__Kd_1_2012, useNA = "ifany")
Check 0 OK <NA>
1 17 12
> table(Kunden01$Check_U_0__Kd_1_2013, useNA = "ifany")
Check 0 OK <NA...
2009 Jun 17
1
nearZeroVar in caret fails
...lem with executing nearZeroVar function in the package caret.
I am using the latest release of caret v4.17.
I have a matrix X with 266 rows and 4 columns and when implementing nearZeroVar function from caret package I get following error message.
> C <- nearZeroVar(X);
Error in table(data, useNA = "no") :
all arguments must have the same length
Calls: nearZeroVar -> apply -> FUN -> table
I have executed step by step commands in the function nearZeroVar and found that it fails when it tries
> t<- table(X,useNa = "no")
Error in table(X, useNa = "no&...
2010 Sep 09
1
Emacs function argument hints
...standard R text editor
for Mac OS. In the Mac OS editor when you start typing a function, the
possible arguments for that function appear at the bottom of the window.
E.g. if you type "table( " before you finish typing you can see at the
bottom of the window:
table(..., exclude = if (useNA == "no") c(NA, NaN), useNA = c("no",
"ifany", "always"), dnn = list.names(...), deparse.level = 1)
I think this feature may be called "function argument hints" but I'm not
sure and searching the archive with that term has not produced...
2016 Apr 28
0
Interdependencies of variable types, logical expressions and NA
...2 from Umsatz_2012 and Kunde01_2012
> Creating Check_U_0__Kd_1_2013 from Umsatz_2013 and Kunde01_2013
> Creating Check_U_0__Kd_1_2014 from Umsatz_2014 and Kunde01_2014
> Creating Check_U_0__Kd_1_2015 from Umsatz_2015 and Kunde01_2015
> >
> > table(Kunden01$Check_U_0__Kd_1_2011, useNA = "ifany")
>
> Check 0 OK <NA>
> 1 16 13
> > table(Kunden01$Check_U_0__Kd_1_2012, useNA = "ifany")
>
> Check 0 OK <NA>
> 1 17 12
> > table(Kunden01$Check_U_0__Kd_1_2013, useNA = "ifany...
2015 Feb 09
3
xtabs and NA
...ues 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" parameter, which I think is necessary to make
NAs show up in the result.
Am I missing anything? If this a bug -- would a patch be welcome? Do we
need compatibility with the current behavior?
I'm aware of workarounds, I just prefer xtabs() over table() for its
interface.
Thanks.
Be...
2013 Jan 21
4
missing values are not allowed in subscripted assignments of data frames
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130121/317d3f7b/attachment.pl>
2012 Aug 15
3
Subsetting with missing data
...'a' where 'y=0'.
> a <- as.data.frame(cbind(x=1:10, y=c(1,0,NA,1,0,NA,NA,1,1,0)))
> a
x y
1 1 1
2 2 0
3 3 NA
4 4 1
5 5 0
6 6 NA
7 7 NA
8 8 1
9 9 1
10 10 0
> names(a)
[1] "x" "y"
> table(a$y)
0 1
3 4
> table(a$y, useNA="always")
0 1 <NA>
3 4 3
> b <- a[a$y==0,]
> b
x y
2 2 0
NA NA NA
5 5 0
NA.1 NA NA
NA.2 NA NA
10 10 0
> is(a$y)
[1] "numeric" "vector"
Instead of only pulling the rows where a$y==0, i'm getting where they...
2010 Jul 22
3
how to force a table to be square?
...ot;A" "A" "B" "B"
[2,] "B" "B" "B" "B"
[3,] "C" "C" "C" "C"
When I build a contingency table for the first and second row using:
tb <- table(myData[1, ], myData[2, ], useNA="ifany")
I get:
B
A 2
B 2
But - I would like to also see "C" there (with a zero).
Actually, I would like to give a list of n characters that would be used to
build an n*n table and the data for this table should then come from myData
(and if there are characters in my list...
2016 Apr 28
0
Antwort: RE: Interdependencies of variable types, logical expressions and NA
...Creating Check_U_0__Kd_1_2013 from Umsatz_2013 and Kunde01_2013
> > > Creating Check_U_0__Kd_1_2014 from Umsatz_2014 and Kunde01_2014
> > > Creating Check_U_0__Kd_1_2015 from Umsatz_2015 and Kunde01_2015
> > > >
> > > > table(Kunden01$Check_U_0__Kd_1_2011, useNA = "ifany")
> > >
> > > Check 0 OK <NA>
> > > 1 16 13
> > > > table(Kunden01$Check_U_0__Kd_1_2012, useNA = "ifany")
> > >
> > > Check 0 OK <NA>
> > > 1 17...