Re: [R] Changing values (factors) does not change levels of that value?!

2008-11-16 Thread David Winsemius
On Nov 16, 2008, at 9:25 AM, Philipp Pagel wrote: snip As you are reading the data from a file anyway, the simplest solution would probably be to use the colClasses argument ot read.table in order to get numeric avlues in the first place. Or use stringsAsFactors = FALSE, If you have a num

Re: [R] Changing values (factors) does not change levels of that value?!

2008-11-16 Thread Philipp Pagel
On Sun, Nov 16, 2008 at 02:52:10PM +0100, Oliver Bandel wrote: > OK, but I thought, when touching the data, it will > recalculate the levels. Now I see, it does not. No it doesn't - for the reasons given in my explanation. > > >> x <- factor(c('A','B','C','A','C')) > > >> y <- x[x!='C'] > > >> y

Re: [R] Changing values (factors) does not change levels of that value?!

2008-11-16 Thread Oliver Bandel
Zitat von "Weiss, Bernd " <[EMAIL PROTECTED]>: > Philipp Pagel schrieb: > >> * when then looking at str(weblog), > >>the "-" will stay in the levels, mentioned for the variable > weblog$V8 > >>-> BAD! > >> > >> Is this snormal behaviour? > > > > Yes, it is. The idea is that a factor has a

Re: [R] Changing values (factors) does not change levels of that value?!

2008-11-16 Thread Weiss, Bernd
Philipp Pagel schrieb: * when then looking at str(weblog), the "-" will stay in the levels, mentioned for the variable weblog$V8 -> BAD! Is this snormal behaviour? Yes, it is. The idea is that a factor has a given set of levels independent of how often you find them in your data - inclu

Re: [R] Changing values (factors) does not change levels of that value?!

2008-11-16 Thread Philipp Pagel
> * when then looking at str(weblog), >the "-" will stay in the levels, mentioned for the variable weblog$V8 >-> BAD! > > Is this snormal behaviour? Yes, it is. The idea is that a factor has a given set of levels independent of how often you find them in your data - including the case th

[R] Changing values (factors) does not change levels of that value?!

2008-11-16 Thread Oliver Bandel
Hello, * I read in a server weblog with read.table. -> OK. * I look for the downloaded-size-values (filesize of the download) -> OK * I found "-" and wanted to substitute them with "0" and used: weblog$V8[ weblog$V8 == "-" ] <- 0 -> OK * checked the contents on "-" vs. "0" and