Displaying 20 results from an estimated 10000 matches similar to: "How to exclude a level from a factor"
2007 Mar 04
1
plot groupedData in nlme
Hi,
Does anyone know how to make the color of the lines all black when
plotting groupedData with an outer factor:
For example,
library(nlme)
plot(Dialyzer, outer=~QB, key=F)
This generated colored curves in R.2.4.1. How to make all the curves black ?
(or how to alter the color (type) of lines for the nlme groupedData
plotting function in general?)
Thanks
Qiong
2008 Sep 09
2
naive variance in GEE
Hi,
The standard error from logistic regression is slightly different
from the naive SE from GEE under independence working correlation structure.
Shouldn't they be identical? Anyone has insight about this?
Thanks,
Qiong
a<-rbinom(1000,1)
b<-rbinom(1000,2,0.1)
c<-rbinom(1000,10,0.5)
summary(gee(a~b, id=c,family="binomial",corstr="independence"))$coef
2006 Jan 13
1
Variance-covariance by factor
Dear all,
I have a data frame with one factor and four numeric variables and
wish to obtain the var-cor matrix separately by factor. I tried by() and
sapply() but getting nowhere. I understand this can be done by subsetting
the dataframe, but there should have some sleek ways of doing it.
Here is a simulated dataframe;
s <- rep(c("A","B","C"), c(25,22,18))
d
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
1999 Sep 02
1
trouble with the 'exclude' parameter of factor() (PR#265)
Full_Name: Laurent Gautier
Version: 0.65.0
OS: Irix 6.5
Submission from: (NULL) (195.110.4.98)
the following doesn't give what I expect
> test _ factor(ORGMORE[[1]],exclude=c(NA,"NOM"))
Warning message:
NAs introduced by coercion
> levels(test)
[1] "CYT" "EXC" "MEM" "NOM" "NUC" "SEC"
while this works...
>
2015 Apr 13
2
How to discern when like dir names exist in 2 places
Kevin Korb <kmk at sanitarium.net> writes:
> -/ /var/apache2/*
Thanks for the input, but unless I'm doing something else screwy, that
does not appear to work here.
I put your line verbatim into my exlcude file (near the top)
/pkg/*
/sadm/*
/cache/*
/opt/csw/cache/*
-/ /var/apache2/*
/tmp/*
------- ------- ---=--- ------- -------
My actual task
2003 Jul 29
2
Help using --exclude
I'm running rsync v2.5.5 on FreeBSD 4.6.2-RELEASE.
I'm using rsync to mirror the home directories of user's desktop
machines. I would like to
exclude the cache of browsers such as mozilla or netscape.
Unfortunately I have not been
able to find the right syntax for the --exclude option. I hope someone
can give me some
insight.
The command I'm using is:
rsync --archive
2010 Mar 28
1
New tutorial and script for rsync resources page
The rsync tutorial is for new rsync users. Three small backup examples thoroughly explain rsync --link-dest, --recursive, and --exlcude-from options.? http://sites.google.com/site/rsync2u/home/rsync-tutorial
rsync2u is a job-driven script that uses rsync to backup files to a
local USB device or harddrive.?
http://sites.google.com/site/rsync2u/home
Someone please post the above lines on the rsync
2006 Sep 15
2
missing data codes
Dear all,
I am new to R. I wish to use R's multiple imputation to deal with missing
data. I have a data set with the size around 300 observations and 150
variables. I checked the help function in R and could not locate how to
write the codes for this. can anyone give a hand?
Do appreciate your time and kindness!
Q.
[[alternative HTML version deleted]]
2006 Nov 15
1
Correlations not in sync with r2 from regression
I have two variables, minutereturnsa which can be thought of as my
independent variable and minutereturnsb which can be thought of as my
dependent variable. When I run correlations on the two variables,
depending on which of the three methods I use, I get values of between
-.15 through -.19.
Then, when I do a regression, I get an rsquared of .004 which is more in
line with my intuition. In other
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
2011 Feb 14
2
How to get warning about implicit factor to integer coercion?
Is there a way in R (12.x) to avoid the implicit coercion of factors to integers
in the context of subscripts?
If this is not possible, is there a way to get at least a warning, if any
coercion of this type happens, given that the action of this coercion is almost
never what is wanted?
Of course, in the rare case that as.integer() is applied explicitly onto a
factor, the warning is not needed,
2004 Aug 18
3
Revert a factor to its numeric values
I'm trying a recommendation on the help page for 'factor':
> x <- c(1, 2, 1, 2)
> x <- factor(x, labels = c("one", "two"))
> x
[1] one two one two
Levels: one two
> as.numeric(levels(x))[x]
[1] NA NA NA NA
Warning message:
NAs introduced by coercion
Also,
> as.numeric(as.character(x))
[1] NA NA NA NA
Warning message:
NAs introduced by
2011 Jul 29
2
converting factor to numeric gives "NAs introduced by coercion"
Hi,
I have a dataframe that I imported from a .txt file by:
skogTemp <- read.delim2("Skogaryd_shoot_data.txt", header=TRUE, fill=TRUE)
and the data are factors, how can avoid factors from the beginning? Although
the file contains both characters and numbers.
I tried to convert some of the columns from factor to numeric and as I
understood it you can not use only as.numeric but
2003 Aug 22
2
converting factor to numeric
Hola!
The R FAQ says:
7.12 How do I convert factors to numeric?
It may happen that when reading numeric data into R (usually, when
reading in a file), they come in as factors. If f is such a factor
object, you can use
as.numeric(as.character(f))
to get the numbers back. More efficient, but harder to remember, is
as.numeric(levels(f))[as.integer(f)]
In any case, do not call as.numeric()
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 Jun 07
1
factor coercion with read.csv or read.table
How do I fix this error ? I tried coercion to a vector but that didn't work.
msci <-read.csv("..MSCIexUS.csv", header=TRUE)
head(msci)
Date index
1 Dec 31, 1969 100
2 Jan 30, 1970 97.655
3 Feb 27, 1970 96.154
4 Mar 31, 1970 95.857
5 Apr 30, 1970 85.564
6 May 29, 1970 79.005
> str(msci)
'data.frame': 510 obs. of 2 variables:
$ Date : Factor w/ 510
2007 Feb 27
2
factor documentation issue
There is a warning in the documentation for ?factor (R version 2.3.0)
as follows:
" The interpretation of a factor depends on both the codes and the
'"levels"' attribute. Be careful only to compare factors with the
same set of levels (in the same order). In particular,
'as.numeric' applied to a factor is meaningless, and may happen by
implicit coercion.
2010 Aug 09
0
In Rsyncd not work options exclude, exlcude from and charset
Daemon was started and tested on two different OS.
FreeBSD 9.0-CURRENT:
# rsync --version
rsync version 3.0.7 protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 32-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append,
2005 Oct 13
1
Removing and restoring factor levels (TYPO CORRECTED)
Sorry, a typo in my previous message (parens in the wrong place in the
conversion).
Here it is corrected:
I'm doing a big slow computation, and profiling shows that it is
spending a lot of time in match(), apparently because I have code like
x %in% listofxvals
Both x and listofxvals are factors with the same levels, so I could
probably speed this up by stripping off the levels and just