similar to: Interdependencies of variable types, logical expressions and NA

Displaying 20 results from an estimated 200 matches similar to: "Interdependencies of variable types, logical expressions and NA"

2016 Apr 28
0
Interdependencies of variable types, logical expressions and NA
Hi Your script is not reproducible. Creating Check_U_0__Kd_1_2011 from Umsatz_2011 and Kunde01_2011 Error in ifelse(Kunden01[[Umsatz]] == 0 & Kunden01[[Kunde]] == 1, 1, 0) : object 'Kunden01' not found > This is interesting x <- c(NA, FALSE, TRUE) names(x) <- as.character(x) outer(x, x, "&") ## AND table <NA> FALSE TRUE <NA> NA FALSE
2016 Apr 28
0
Antwort: RE: Interdependencies of variable types, logical expressions and NA
Hi your initial ds > str(ds) 'data.frame': 2 obs. of 3 variables: $ var1: num 1 1 $ var2: logi TRUE FALSE $ var3: logi NA NA first result > str(ds) 'data.frame': 2 obs. of 6 variables: $ var1 : num 1 1 $ var2 : logi TRUE FALSE $ var3 : logi NA NA $ value_and_logical: logi TRUE TRUE $ logical_and_na : logi TRUE NA
2016 Apr 26
0
Antwort: Fw: Re: Creating variables on the fly (SOLVED)
Hi Don, Hi to all readers, many thanks for all your answers and all your help. I adapted Don's code to my data and Don's code does the trick: str(Kunden01) for (year in 2011:2015) { Reeller_Kunde <- paste0("Reeller_Kunde_", year) Umsatz <- paste0("Umsatz_", year) cat('Creating', Reeller_Kunde,'from', Umsatz,'\n') Kunden01[[
2016 Apr 27
0
R Script Template
The subject of your email is missing. Perhaps you need to read the Posting Guide (again?) about attachments. Embedding your example directly in the body of the email is generally more accessible in archives than attaching it. -- Sent from my phone. Please excuse my brevity. On April 27, 2016 1:14:17 PM GMT+01:00, G.Maubach at gmx.de wrote: >Hi All, > >I am addressing this post to all
2016 Apr 27
2
R Script Template
Hi All, I am addressing this post to all who are new to R. When learing R in the last weeks I took some notes for myself to have code snippets ready for the data analysis process. I put these snippets together as a script template for future use. Almost all of the given command prototypes are tested. The template script contains snippets for best practices and leaves out the commands that
2004 May 17
3
Accessing data
Hello, I would like to access my data frame without one variable. E.g.: > colnames(x) [1] "Besch" "Ang.m" "Arb.m" "i10" "Umsatz" "arbstd" I can try x[,-1], but this variable must be called by it??s name. x[,-"Besch"] x[,!"Besch"] attach(x) x[-Besch] ... ... does not work. I could not found a solution of
2016 Apr 22
4
Creating variables on the fly
Hi all, I would like to use a loop for tasks that occurs repeatedly: # Groups # Umsatz <= 0: 1 (NICHT kaufend) # Umsatz > 0: 2 (kaufend) for (year in c("2011", "2012", "2013", "2014", "2015")) { paste0("Kunden$Kunde_real_", year) <- (paste0("Kunden$Umsatz_", year) <= 0) * 1 +
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
2016 Aug 07
2
table(exclude = NULL) always includes NA
This is an example from https://stat.ethz.ch/pipermail/r-help/2007-May/132573.html . With R 2.7.2: > 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 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
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 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 ?exclude? before coercion will be mapped to
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(0) (not c(),
2016 Jan 12
2
Failed to modify entry for user in samba with tdb backend
Hi Samba List I have the problem to modify an entry for a user in samba with tdb backend. My OS is OpenSuSE 13.1, Samba 4.1.21. Samba NT'Style, no AD, no LDAP, passdb backend = tdbsam I managed to delete a User in my NIS/passwd File before I deleted it in my Samba tdb. No the problem is, I can't modify the user because he does not exists, but can not add, because he exists. The problem
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%
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,
2016 Aug 09
0
table(exclude = NULL) always includes NA
>>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel at r-project.org> >>>>> on Sun, 7 Aug 2016 15:32:19 +0000 writes: > This is an example from https://stat.ethz.ch/pipermail/r-help/2007-May/132573.html . > With R 2.7.2: > > a <- c(1, 1, 2, 2, NA, 3); b <- c(2, 1, 1, 1, 1, 1) > > table(a, b, exclude = NULL) > b >
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
2016 Sep 10
1
table(exclude = NULL) always includes NA
Looking at the code of function 'table' in R devel r71227, I see that the part "remove NA level if it was added only for excluded in factor(a, exclude=.)" is not quite right. In is.na(a) <- match(a0, c(exclude,NA), nomatch=0L) , I think that what is intended is a[a0 %in% c(exclude,NA)] <- NA . So, it should be is.na(a) <- match(a0, c(exclude,NA),
2010 Jul 22
3
how to force a table to be square?
Hi guys, I hope you can help me with this. Here is the problem: I have some data (myData) that looks similar to this: [,1] [,2] [,3] [,4] [1,] "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
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):