similar to: FIX for old and new problems with order(): order fails with na.last=NA (PR#1981)

Displaying 20 results from an estimated 50000 matches similar to: "FIX for old and new problems with order(): order fails with na.last=NA (PR#1981)"

2019 May 10
0
[R] approx with NAs --> new argument 'na.rm=TRUE' ?!
I have now committed a version "fulfilling" your wish, partly at least, to R-devel . In the new approx(*, na.rm=FALSE) cases, the result of how NA's are treated does depend on the 4 different extrapolation rules {1, 2, 1:2, 2:1} The main reason was that I kept the low level code in C to do +- what it did before which automatically was using 'rule' to determine these
2012 Nov 08
0
mirt vs. eRm vs. ltm vs. winsteps
Dear R-List, I tried to fit a partial credit model using the "pcmdat" from eRm-package comparing the results of mirt, eRm, ltm and winsteps. The results where quite different, though. I cannot figure out what went wrong and I do not know which result I can rely on. This is what I did in R library(mirt) #load(file="u3.RData")
2005 Jun 28
1
Index (which) of last non-NA data in dataframe
Hello, In a dataframe, I want the index if the last non-NA data. Example: d<-data.frame(matrix(c(1,3,4,2,7,8,1,NA,2),3,3,byrow=TRUE)) gives: > d X1 X2 X3 1 1 3 4 2 2 7 8 3 1 NA 2 I want a vector that gives me 3 2 3 I know about tail and which, but I don't know how not to consider the NA e.g.: last<-tail(d,1,na.rm=TRUE) still gives me a NA
2011 Sep 12
1
plot 3 lines with ggplot2
Hi, I am trying to learn to use ggplot2 for what I had hoped would be a fairly simple task. I have a relatively small data.frame (100 by 4). The first column contains symbols. The 2nd, 3rd and 4th columns represent percentage weightings for each symbol using 3 different methodologies. For example: sym <- make.unique(replicate(100, paste(sample(LETTERS, 3, replace = TRUE), collapse =
2008 Mar 29
1
Tabulating Sparse Contingency Table
I have a sparse contingency table (most cells are 0): > xtabs(~.,data[,idx:(idx+4)]) , , x3 = 1, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 31 2 0 0 112 3 0 0 94 , , x3 = 2, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 3, x4 = 1, x5 = 1 x2 x1 1 2 3 1 0 0 0 2 0 0 0 3 0 0 0 , , x3 = 1, x4
2013 Mar 18
2
Loop or some other way to parse by data generated values when it is not linear
I'm sorry for the really vague subject line but I am not sure how to succinctly describe what I am doing and what the problem is. But, here goes: 1. I have data with two-way data with frequencies. Below is an example, though in reality I am looking at about 10 different variables that I am crossing so the values of X1 and X2 change. X1 and X2 are place holders. Here's the dataset
2008 Sep 22
4
sort a data matrix by all the values and keep the names
Dear all, If I have a data frame x<-data.frame(x1=c(1,7),x2=c(4,6),x3=c(8,2)): x1 x2 x3 1 4 8 7 6 2 I want to sort the whole data and get this: x1 1 x3 2 x2 4 x2 6 x1 7 x3 8 If I do sort(X), R reports: Error in order(list(x1 = c(1, 7), x2 = c(4, 6), x3 = c(8, 2)), decreasing = FALSE) : unimplemented type 'list' in 'orderVector1' The only way
2017 Oct 15
0
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
I think it is not a bug. It is a general property of interactions. This property is best observed if all variables are factors (qualitative). For example, you have three variables (factors). You ask for as many interactions as possible, except an interaction term between two particular variables. When this interaction is not a constant, it is different for different values of the remaining
2020 May 23
1
base::order breaking change in R-devel
Hi R developers, There seems to be breaking change in base::order on Windows in R-devel. Code below yields different results on R 4.0.0 and R-devel (2020-05-22 r78545). I haven't found any info about that change in NEWS. Was the change intentional? Sys.setlocale("LC_CTYPE","C") Sys.setlocale("LC_COLLATE","C") x1 = "fa\xE7ile" Encoding(x1) =
2002 Dec 19
0
Ongoing unhappiness with NA and factor behavior of distributed lm/predict.lm
Hi all, I''m still not quite happy with the NA and factor handling of lm and predict.lm in R1.6.1 (forcing me to use my not very skillfully crafted patches). Here is the problem 1: >
2011 Jan 26
2
a problem with is.na
Hello, I have observed the following odd behavior of "is.na( )" and hope someone can give me an explanation Example: X1=rep(1:2,5)[-1] X2=rep(1:5,rep(2,5))[-1] y= runif(9) y[3]=NA xtabs(y~x1+x2) Now xtabs(is.na(y)~x1+x2) says that cell 2,2 is NA x2 x1 1 2 1 0 0 2 0 1 3 0 0 4 0 0 5 0 0 Whereas xtabs(!is.na(y)~x1+x2) says that all but cell 1,1 and 2,2 are not NA x2
2006 Oct 27
2
all.names() and all.vars(): sorting order of functions' return vector
Dear list-subscriber, in the process of writing a general code snippet to extract coefficients in an expression (in the example below: 0.5 and -0.7), I stumbled over the following peculiar (at least peculiar to me:-) ) sorting behaviour of the function all.names(): > expr1 <- expression(x3 = 0.5 * x1 - 0.7 * x2) > all.names(expr1) [1] "-" "*" "x1"
2012 Mar 19
2
Save File after order
Hello, ??? I'm trying to write the sorted data in a file of a data.frame, My question and my problem is that when I record in file adds a new column row.name, which apparently is the original position in the file. ??? I wanted to write to the file without this column x<-data.frame(name="x1",Time=20) x<-rbind(x,data.frame(name="x2",Time=25))
2017 Oct 31
0
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
Hi Arie, Thank you for your further research into the issue. Regarding Stata: On the other hand, JMP gives model matrices that use the main effects contrasts in computing the higher order interactions, without the dummy variable encoding. I verified this both by analyzing the linear model given in my first example and noting that JMP has one more degree of freedom than R for the same model, as
2017 Nov 02
0
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
Hi Arie, The book out of which this behavior is based does not use factor (in this section) to refer to categorical factor. I will again point to this sentence, from page 40, in the same section and referring to the behavior under question, that shows F_j is not limited to categorical factors: "Numeric variables appear in the computations as themselves, uncoded. Therefore, the rule does not
2017 Nov 04
0
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
Hi Arie, I understand what you're saying. The following excerpt out of the book shows that F_j does not refer exclusively to categorical factors: "...the rule does not do anything special for them, and it remains valid, in a trivial sense, whenever any of the F_j is numeric rather than categorical." Since F_j refers to both categorical and numeric variables, the behavior of
2017 Nov 06
0
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
Hi Arie, Given the heuristic, in all of my examples with a missing two-factor interaction the three-factor interaction should be coded with dummy variables. In reality, it is encoded by dummy variables only when the numeric:numeric interaction is missing, and by contrasts for the other two. The heuristic does not specify separate behavior for numeric vs categorical factors (When the author of
2017 Oct 12
2
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
Hi, I recently ran into an inconsistency in the way model.matrix.default handles factor encoding for higher level interactions with categorical variables when the full hierarchy of effects is not present. Depending on which lower level interactions are specified, the factor encoding changes for a higher level interaction. Consider the following minimal reproducible example: -------------- >
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):
2011 Mar 12
1
Column order in stacking/unstacking
Dear R users, I'm having some problems with the stack() and unstack() functions, and wondered if you could help. I have a large data frame (400 rows x 2000 columns), which I need to reduce to a single column of values (and therefore 800000 rows), so that I can use it in other operations (e.g., generating predictions from a GLM object). However, the problem I'm having can be reproduced