similar to: Dropping unused levels of a factor that has "NA" as a level

Displaying 20 results from an estimated 10000 matches similar to: "Dropping unused levels of a factor that has "NA" as a level"

2006 Apr 28
1
as.character.factor when the factor contains "NA"
as.character.factor contains this line (where cx=levels(x)[x]): if ("NA" %in% levels(x)) cx[is.na(x)] <- "<NA>" Is it possible that this is no longer the desired behavior? These two results don't seem very consistent: > as.character(as.factor(c("AB", "CD", NA))) [1] "AB" "CD" NA > is.na(.Last.value)[3] [1] TRUE
2003 Oct 14
3
NA %*% 0 == 0 (PR#4582)
Full_Name: J . R. M. Hosking Version: 1.8.0 OS: Windows 2000 Submission from: (NULL) (129.34.20.23) On R 1.8.0 (and on R 1.5.1), Windows binary: > NA %*% 0 [,1] [1,] 0 This is surprising. Is it a bug? Note that > 0 %*% NA [,1] [1,] NA > NA %*% 1 [,1] [1,] NA > NA * 0 [1] NA as expected.
2001 Nov 09
1
Installing packages
Hello, I have upgraded from Mandrake Linux 8.0 to Mandrake 8.1 and try to reinstall my favourite R... Everything is OK for the base software but I have trouble to get some packages installed. Specifically, for some packages, a "collect2" binary seems to be necessary during the compilation/linking process of the library, and LD complains about not finding it : Installing source
2004 Apr 16
2
type.convert (PR#6781)
Full_Name: J. R. M. Hosking Version: 1.9.0 OS: Windows 2000 Submission from: (NULL) (129.34.20.23) Two problems, perhaps related: (1) na.strings is not honored when x is non-numeric and as.is=T > type.convert( c("abc","-"), as.is=T, na.strings="-" ) [1] "abc" "-" ... unless x consists only of NAs > type.convert(
2012 Nov 17
0
[LLVMdev] Purdue LLVM Social: GreyHouse 12/6 @ 8:30pm
Dr Hosking, interested in coming to this? Michael Goldfarb, interested in coming to this? -- Sean Silva On Sat, Nov 17, 2012 at 12:53 AM, Joe Abbey <jabbey at arxan.com> wrote: > First LLVM Social in West Lafayette, IN. > > When: > Thursday, Dec 6th @ 8:30pm > > Where: > GreyHouse Coffee > 100 Northwestern Avenue > West Lafayette, IN 47906 >
2001 Sep 19
1
missing() (PR#1096)
Full_Name: J. R. M. Hosking Version: 1.3.0 OS: Windows 2000 Submission from: (NULL) (198.81.209.16) R documentation suggests that if a function argument x is omitted, missing(x) should return TRUE even if x is subsequently assigned a value. This happens in S-plus. But in R: > test function(x){ print(missing(x)) if(missing(x)) x<-0 print(missing(x)) invisible() } > test() [1] TRUE [1]
2004 Apr 16
1
as.data.frame.list (PR#6782)
Full_Name: J. R. M. Hosking Version: 1.9.0 OS: Windows 2000 Submission from: (NULL) (129.34.20.23) Browsing the code of as.data.frame.list, I see cn[m] <- paste("..adfl.", cn[m], sep = "") and 5 lines later names(x) <- sub("^..adfl.", "", names(x)) It looks as though the latter should be names(x) <- sub("^\\.\\.adfl\\.",
2008 Jul 19
1
axis() ignores supplied value of argument mgp[3]?
It seems that when an argument 'mgp' is supplied to axis(), the mgp[2] value (position of tick mark labels) is honoured but the mgp[3] value (position of axis line) is ignored. Example: plot(1:5, xaxt='n', ann=FALSE) par(mgp=c(0,2,1)) axis(1, at=2:4, mgp=c(0,-2,-3)) Axis line is plotted at margin line 1, tick mark labels at line -3. Is this a bug? J. R. M. Hosking
2007 Feb 25
2
RFA
Dear Sir in the following example,is the vector lmom a l-moment ratios vector? What is meant by size = northCascades[,1]? And what are the values in c(0.0104,0.0399,0.0405)? Please help me I am unable to understand these from help manual. Best Regards AMINA data(northCascades) lmom <- c(1, 0.1103, 0.0279, 0.1366) kappaParam <- kappalmom(lmom) heterogeneity(500, 19, size =
2002 Aug 15
1
order(1, na.last=NA) fails (PR#1913)
R> order(1, na.last=NA) Error in apply(sapply(z, is.na), 1, any) : dim(X) must have a positive length This bug appears unrelated to PR#1906, and so the fix of 8/15 doesn't help. It comes from the line inside order(): ok <- !apply(sapply(z, is.na), 1, any) where z=list(1) in my example. sapply() returns a single-element vector, not a matrix, making apply() unhappy. This might
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
2005 Sep 02
2
Superassignment (<<-) and indexing
In a clean environment under R-2.1.0 on Linux: > x <- 1:5 > x[3] <<- 9 Error: Object "x" not found Isn't that odd? (Note x <<- 9 works just fine.) Why am I doing this? Because I'm stepping through code that normally lives inside a function, where "<<-" is appropriate. -- David Brahm (brahm at alum.mit.edu)
2001 Oct 04
2
Characters subsetted with NA (was: Several R vs S-Plus issues)
Hello, R-devel! I posted to R-help, and (inappropriately) to R-bugs, this R/S-Plus difference: > LETTERS[c(NA,2)] in S is c("","B"), but in R is c("NA","B") Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> wrote: > I think we do not want to change this. ... > R> is.na(LETTERS[c(NA,2)]) [1] TRUE FALSE > so we really have NA but it is
2004 Feb 03
5
creating a factor
Hi list, I'd like to make a factor with seven 1s and three 2s using the factor() function. That is, 1 1 1 1 1 1 1 2 2 2 I will then bind this factor to the matrix below using cbind.data.frame(). 0.56 0.48 0.22 0.59 0.32 0.64 0.26 0.60 0.25 0.38 0.24 0.45 0.56 0.67 0.78 0.97 0.87 0.79 0.82 0.85 I am new to R and have been using various manuals and have made many attempts without
2006 Feb 14
1
addmargins
> addmargins(UCBAdmissions, FUN = list(Total=sum)) works with no problems, but consider: > myFUN <- list(Total=sum) > addmargins(UCBAdmissions, FUN = myFUN) Error in "names<-.default"(`*tmp*`, value = "") : names() applied to a non-vector Is this a bug? > R.version _ platform i386-pc-mingw32 arch i386 os mingw32 system
2007 Sep 16
1
Factorial, L-moments, and overflows
Hi everyone, In the package POT, there is a function that computes the L-moments of a given sample (samlmu). However, to compute those L-moments, one needs to obtain the total number of combinations between two numbers, which, by the way, requires the use of a factorial. See, for example, Hosking (1990 , p. 113). How does the function "samlmu" in the package POT avoids overflows? I
2012 Nov 02
4
[PATCH] ACPI/cpuidle: remove unused "power" field from Cx state data
It has never been used for anything, and Linux 3.7 doesn''t propagate this information anymore. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- Konrad, on the pv-ops side it may be better to pass zero rather than leaving the field completely uninitialized. --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -935,7 +935,6 @@ static void set_cx( }
2002 Feb 25
1
DOS3
Hi folks! Running a dictionary program I get the following message before I get to the interesting part of the win program: err:int21:DOS3Call int21: unknown/not implemented parameters: int21: AX 5001, BX 01d7, CX 0437, DX 0000, SI 01e0, DI 03e7, DS 03af, ES 0437 wine: Unhandled exception, starting debugger err:seh:EXC_DefaultHandling Unhandled exception code c0000005 flags 0 addr 0x402a4c37
2012 Apr 21
2
using "factor" to eliminate unused levels without dropping other variables
Hello, I have been banging my head against the wall trying to figure out this seemingly simple problem with no success. I'm hoping that one or some of you can help. Here is the code I am trying to use: #importing data data.file <-read.csv("/file/location", header=TRUE, sep = ",") #selecting a subset of data based on variable "Sample" data.subset1 <-
2006 Oct 16
6
NULL or NA for missing function arguments?
Hi, I am troubled by the use of NULL or NA to indicate missing/non-specified function arguments. In the R code that I have looked at, it seems that both forms are used (NULL seems to be used more often though). Sometimes both variants are in the same declaration, e.g. format.default <- function(x, trim = FALSE, digits = NULL, nsmall = 0, justify = c("left",