search for: ifany

Displaying 20 results from an estimated 27 matches for "ifany".

Did you mean: iany
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 for NAs an...
2016 Aug 07
2
table(exclude = NULL) always includes NA
...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 'table' wit...
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) which appear in ?e...
2016 Apr 28
4
Interdependencies of variable types, logical expressions and NA
..._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> 2...
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) I bring the example up, in case that the change in result is not intended. --------------------...
2016 Aug 15
1
table(exclude = NULL) always includes NA
...g 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) >> table(as.integer(x), exclude=NaN) >> I bring the example up, in case that the ch...
2016 Aug 11
2
table(exclude = NULL) always includes NA
...<- 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...
2016 Apr 28
0
Interdependencies of variable types, logical expressions and NA
...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") > &...
2016 Aug 09
0
table(exclude = NULL) always includes NA
...t; 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...
2016 Aug 12
0
table(exclude = NULL) always includes NA
...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 to that as a 2nd step (if the 1st step, below) shows to be feasible. > Why exclude = NULL is so special? What about another > 'exclude' of length zero, like character(0) (not c(), > because c() is NULL)? I th...
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 on a backg...
2010 Jul 22
3
how to force a table to be square?
..."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 that do not...
2016 Apr 28
0
Antwort: RE: Interdependencies of variable types, logical expressions and NA
...k_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 > >...
2016 Sep 10
1
table(exclude = NULL) always includes NA
...Maechler <maechler at stat.math.ethz.ch> >>>>> on Mon, 15 Aug 2016 11:07:43 +0200 writes: >>>>> 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) >>> table(as.integer(x), exclude=NaN) >>> I bring the example up, in...
2010 Sep 09
1
Emacs function argument hints
...ing 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 anything useful. Is this feature available in Emacs or any other windows...
2011 Sep 14
1
svytable including NAs
Dear all I'm creating two way tables based on weighted survey data using svytable and want to include NAs as a level in the table. For unweighted data I use table(..., useNA="ifany"). Is there any equivalent for svytable? If not, is there a solution using a different function? Thanks Tim -- Tim Elwell-Sutton The University of Hong Kong Office: 3906 2053 Mob: 6084 5654
2012 Dec 13
0
Suggestion of change to reduce overhead of 'table'
...86a90,91 >? ? ? ? ? ? ? ? ? ? ? ???else >? ? ? ? ? ? ? ? ? ? ? ? ? ???a Function 'table' calls function 'addNA' in some cases. I suggest to change 'addNA', too. This is diff against https://svn.r-project.org/R/trunk/src/library/base/R/factor.R. 336d335 <? ???if (ifany & !any(is.na(x))) return(x) 338c337,339 <? ???if (!any(is.na(ll))) ll <- c(ll, NA) --- >? ???hasNAlev <- any(is.na(ll)) >? ???if ((ifany || hasNAlev) && !any(is.na(x))) return(x) >? ???if (!hasNAlev) ll <- c(ll, NA) Instead of calling 'factor', 'addNA&...
2009 Feb 27
1
cross tabulation: convert frequencies to percentages
Hello, might be rather easy for R pros, but I've been searching to the dead end to ... twsource.area <- table(twsource, area, useNA="ifany") gives me a nice cross tabulation of frequencies of two factors, but now I want to convert to pecentages of those absolute values. In addition I'd like an extra column and an extra row with absolute sums. I know, Excel or the likes will produce it more easily, but how would the p...
2011 Apr 29
1
3-way contingency table
...ant to determine the the frequencies of every unique value in every column depending on the host column. It is quite easy to determine the frequencies in total with the following command: > dataH2 <- dataH[,c(2,3,4,5)] > table(as.matrix(dataH2), colnames(dataH2)[col(dataH2)], useNA="ifany") ms01 ms31 ms33 ms34 3 0 9 0 0 4 10 0 7 0 5 0 0 2 9 6 0 0 0 1 9 0 0 1 0 20 0 1 0 0 But I cannot manage to get it dependent on the host. I tried > xtabs(cbind(ms01, ms31, ms33, ms34) ~ ., dataH) and m...
2013 Aug 09
1
a fast table() for the 1D case
...lacing the '...' ## arg with 'x' and omitting the 'dnn' and 'deparse.level' arguments ## which are unrelated to performance). table1D <- function(x, exclude = if (useNA == "no") c(NA, NaN), useNA = c("no", "ifany", "always")) { if (!missing(exclude) && is.null(exclude)) { useNA <- "always" } else { useNA <- match.arg(useNA) } if (useNA == "always" && !missing(exclude)) exclude <- setdiff(exclude, NA...