search for: drop_unused_levels

Displaying 9 results from an estimated 9 matches for "drop_unused_levels".

2005 Nov 07
1
reduce levels
Hi all: I have an example that shows my problem: > test <- data.frame(c("a", "b", "c")) > colnames(test) <- "mm" > sub <- subset(test, mm=="b") > sub$mm [1] b Levels: a b c > levels(sub$mm) [1] "a" "b" "c" How can I reduce the levels to exclusively those which
2009 Jul 24
3
str(data.frame) after subsetting reflects original structure, not subsetted structure?
I find that after subsetting (you may prefer "conditional selection") a data frame and assigning it to a new object, the str(new object) reflects the original data frame, not the new one: A <- rnorm(20) B <- factor(rep(c("t", "g"), 10)) C <- factor(rep(c("h", "l"), 10)) D <- data.frame(A, B, C) str(D) # reports correctly E <-
2008 Apr 01
1
Subset: data frames and factor levels
Hi! I'm doing: etni <- subset(etni, NAMECOM!="Maniquisito") where etni is a data.frame, NAMECOM a factor and "Maniquisito" labels a row that I want to delete. The problem is that while the row is deleted, the factor level is still there (I can see "Maniquisito" if I do levels(etni$NAMECOM) ). I know I can get the appropriate levels by:
2007 Dec 09
2
adjusting "levels" after subset a table
Um texto embutido e sem conjunto de caracteres especificado associado... Nome: n?o dispon?vel Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071208/5409f1a7/attachment.pl
2009 Aug 07
3
bug with subset and plot?
Hi! I have the following problem that I beleive is a bug: I have a dataframe with one categorical and one numerical vector. The categorical vector has three levels (uc, up and vc). A plot of the vectors with the categorical vector on the x-axis gives a boxplot with three boxes - exactly as expected. If I then use the subset function to make a dataset that only includes two of the levels of
2009 May 27
2
Factor level with no cases shows up in a plot
Consider this data structure (df1) ... Group Year PctProf FullYr 1 Never RF 2004 87 88 2 Cohort 1 2004 83 84 3 Cohort 2 2004 84 86 4 Cohort 3 2004 87 87 5 Cohort 4 2004 73 74 6 Never RF 2005 85 86 7 Cohort 1 2005 81 82 8 Cohort 2 2005 81 81 9 Cohort 3 2005 78 79 10 Cohort 4 2005 72 74 11
2009 Nov 10
3
drop unused levels in subset.data.frame
Dear list, subset has a 'drop' argument that I had often mistaken for the one in [.factor which removes unused levels. Clearly it doesn't work that way, as shown below, d <- data.frame(x = factor(letters[1:15]), y = factor(LETTERS[1:3])) s <- subset(d, y=="A", drop=TRUE) str(s) 'data.frame': 5 obs. of 2 variables: $ x: Factor w/ 15 levels
2009 Jul 30
4
edit.row.names taking row names from the edited dataframe
Hi all, I am struggling to work out how to use the rownames from an edited dataframe rather than the row names from the original dataframe. In my data set i'm trying to extract several rows of data on particular individuals, i don't doubt i'm using the long way round but what i have in the way of a script is this: ##selecting the IDs from the dataframe individually
2009 Jun 01
1
installing sn package
...rote: >  > ...  I get the four lines that I expected but the legend includes the > Group level "cohort 4" . >  > How can I get rid of "cohort 4" in Group? >  This link might be of interest for you: http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:drop_unused_levels hth Stefan ------------------------------ Message: 108 Date: Wed, 27 May 2009 22:59:39 +0200 From: <mauede@alice.it> Subject: [R] R:  Harmonic Analysis To: "stephen sefick" <ssefick@gmail.com>, <r-help@stat.math.ethz.ch> Message-ID:     <6B32C438581E5D4C8A34C377C...