similar to: [bug] droplevels() also drop object attributes (comment…)

Displaying 20 results from an estimated 10000 matches similar to: "[bug] droplevels() also drop object attributes (comment…)"

2017 Jun 14
1
[bug] droplevels() also drop object attributes (comment…)
In R devel r72789, the added part in 'factor' documentation (factor.Rd) is the following. Undocumentedly for a long time, \code{factor(x)} loses all \code{\link{attributes}(x)} but \code{"names"}, and resets \code{"levels"} and \code{"class"}. In the code of function 'factor', names(x) is copied to the result. As I mentioned before, names(x) is _not_
2017 May 16
0
[bug] droplevels() also drop object attributes (comment…)
>>>>> Serge Bibauw <sbibauw at gmail.com> >>>>> on Mon, 15 May 2017 11:59:32 -0400 writes: > Hi, > Just reporting a small bug? not really a big deal, but I don?t think that is intended: droplevels()?also drops all object?s attributes. Yes. The help page for droplevels (or the simple definition of 'droplevels.factor') clearly
2017 Jun 06
1
[bug] droplevels() also drop object attributes (comment…)
>>>>> Martin Maechler <maechler at stat.math.ethz.ch> >>>>> on Tue, 16 May 2017 11:01:23 +0200 writes: >>>>> Serge Bibauw <sbibauw at gmail.com> >>>>> on Mon, 15 May 2017 11:59:32 -0400 writes: >> Hi, >> Just reporting a small bug? not really a big deal, but I >> don?t think that is
2017 May 15
2
[bug] droplevels() also drop object attributes (comment…)
Hi, Just reporting a small bug? not really a big deal, but I don?t think that is intended: droplevels()?also drops all object?s attributes. Example: > > test <- c("hello", "something", "hi") > > test <- factor(test) > > comment(test) <- "this is a test" > > attr(test, "description") <- "this is another
2011 Oct 21
1
droplevels: drops contrasts as well
Dear all, Today I figured out that there is a neat function called droplevels, which, well, drops unused levels in a data frame. I tried the function with some of my data sets and it turned out that not only the unused levels were dropped but also the contrasts I set via "C". I had a look into the code, and this behaviour arises from the fact that droplevels uses simply factor to drop
2017 Apr 12
0
"table(droplevels(aq)$Month)" in manual page of droplevels
(Let's keep the discussion on-list -- I've added back R-devel.) On 2017-04-12 16:39, Ulrich Windl wrote: >>>> Henric Winell <nilsson.henric at gmail.com> schrieb am 12.04.2017 >>>> um 15:35 in > Nachricht <b66fe849-bb8d-f00d-87e5-553f866d57e0 at gmail.com>: >> On 2017-04-12 14:40, Ulrich Windl wrote: >> >>> The last line of the
2017 Apr 13
0
"table(droplevels(aq)$Month)" in manual page of droplevels
>>>>> Rui Barradas <ruipbarradas at sapo.pt> >>>>> on Wed, 12 Apr 2017 17:07:45 +0100 writes: > Hello, Inline. > Em 12-04-2017 16:40, Henric Winell escreveu: >> (Let's keep the discussion on-list -- I've added back >> R-devel.) >> >> On 2017-04-12 16:39, Ulrich Windl wrote: >>
2017 Apr 12
2
"table(droplevels(aq)$Month)" in manual page of droplevels
Hello, Inline. Em 12-04-2017 16:40, Henric Winell escreveu: > (Let's keep the discussion on-list -- I've added back R-devel.) > > On 2017-04-12 16:39, Ulrich Windl wrote: > >>>>> Henric Winell <nilsson.henric at gmail.com> schrieb am 12.04.2017 >>>>> um 15:35 in >> Nachricht <b66fe849-bb8d-f00d-87e5-553f866d57e0 at gmail.com>:
2017 Apr 12
3
"table(droplevels(aq)$Month)" in manual page of droplevels
The last line of the example in droplevels' manual page seems to be incorrect to me. I think it should read: "table(droplevels(aq$Month))". Amazingly (I don't understand) both variants seem to produce the same result (R 3.3.3): --- > aq <- transform(airquality, Month = factor(Month, labels = month.abb[5:9])) > aq <- subset(aq, Month != "Jul") >
2016 Aug 21
1
'droplevels' inappropriate change
In R devel r71124, if 'x' is a factor, droplevels(x) gives factor(x, exclude = NULL) . In R 3.3.1, it gives factor(x) . If a factor 'x' has NA and levels of 'x' doesn't contain NA, factor(x) gives the expected result for droplevels(x) , but factor(x, exclude = NULL) doesn't. As I said in https://stat.ethz.ch/pipermail/r-devel/2016-May/072796.html , factor(x,
2016 Aug 27
0
'droplevels' inappropriate change
>>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel at r-project.org> >>>>> on Sat, 27 Aug 2016 03:17:32 +0000 writes: > In R devel r71157, 'droplevels' documentation, in "Arguments" section, says this about argument 'exclude'. > passed to factor(); factor levels which should be excluded from the result even if
2016 Sep 13
0
Coercion of 'exclude' in function 'factor' (was 'droplevels' inappropriate change)
>>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel at r-project.org> >>>>> on Fri, 2 Sep 2016 16:10:00 +0000 writes: > I am basically fine with the change. > How about using just the following? > if(!is.character(exclude)) > exclude <- as.vector(exclude, typeof(x)) # may result in NA > x <- as.character(x)
2012 Apr 16
2
Problems with subset, droplevels and lm: variable lengths differ
[Env: R 2.14.2 / Win Xp] In the script below, I want to select some variables from rrcov::OsloTransect, delete cases with any missing data, and subset the data frame Oslo to remove cases for two levels of the factor litho that occur with low frequency. The checks I run on my new data frame Oslo look OK, but I when I try to fit a multivariate linear model with lm(), I am getting an error:
2016 Aug 27
2
'droplevels' inappropriate change
In R devel r71157, 'droplevels' documentation, in "Arguments" section, says this about argument 'exclude'. passed to factor(); factor levels which should be excluded from the result even if present. Note that this was implicitly NA in R <= 3.3.1 which did drop NA levels even when present in x, contrary to the documentation. The current default is compatible with x[ ,
2016 Sep 02
2
Coercion of 'exclude' in function 'factor' (was 'droplevels' inappropriate change)
I am basically fine with the change. How about using just the following? if(!is.character(exclude)) exclude <- as.vector(exclude, typeof(x)) # may result in NA x <- as.character(x) It looks simpler and is, more or less, equivalent. In factor.Rd, in description of argument 'exclude', "(when \code{x} is a \code{factor} already)" can be removed. A larger
2012 Feb 13
1
Overwrite S3 methond from base package
Dear all, I am developing a package, which bundles my most frequently used functions. One of those is a modified version of droplevels from the base package (basically, it preserves any contrast function which was used to create the factor, contrast matrices are not kept, for they could be wrong if a level is dropped). In my NAMESPACE file I've the following directives, which should export
2012 Sep 19
2
drop zero slots from table?
I find myself doing --8<---------------cut here---------------start------------->8--- tab <- table(...) tab <- tab[tab > 0] tab <- sort(tab,decreasing=TRUE) --8<---------------cut here---------------end--------------->8--- all the time. I am wondering if the "drop 0" (and maybe even sort?) can be effected by some magic argument to table() which I fail to discover
2013 Apr 24
1
Trouble Computing Type III SS in a Cox Regression using drop1 and Anova
Hello All, Am having some trouble computing Type III SS in a Cox Regression using either drop1 or Anova from the car package. Am hoping that people will take a look to see if they can tell what's going on. Here is my R code: cox3grp <- subset(survData, Treatment %in% c("DC", "DA", "DO"), c("PTNO", "Treatment", "PFS_CENSORED",
2017 Oct 16
1
Download data from NASA for multiple locations - RCurl
I have done the following using readLines directory <- "~/" files <- list.files(directory) data_frames <- vector("list", length(files)) for (i in seq_along(files)) { df <- readLines(file.path(directory, files[i])) df <- df[-(1:13)] df <- data.frame(year = substr(df,1,4), month = substr(df, 6,7), day =
2001 Jun 29
0
interaction() -- problem with drop (PR#1003)
(R-1.3.0 on linux, alpha and intel; also tested on R-1.1.1 on irix.) Below is a program that creates some random data (n, x, and y), creates a factor out of x and y and then creates a factor z out of their interaction (corresponding, with the default nf = 2, to quadrants, which is how I came upon this). It then runs an analysis of variance. f.test.problem <- function(n = 100, nf = 2){ t1