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

2008-11-16 Thread Oliver Bandel
Philipp Pagel wzw.tum.de> writes: [...] > > foo$bar <- factor(foo$bar) This was my first attemot, before posting here, and it somehow did not worked... ...now it works so I maybe was too tired, when trying it and messed something up. :( [...] > > x <- factor(c(0,1,3,4,5,7)) > > x > [1]

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

2008-11-16 Thread Oliver Bandel
Philipp Pagel wzw.tum.de> writes: [...] > 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. [...] Hey, I tried this colClasses-option. It's really fine! :) C

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

Re: [R] Changing values

2008-08-03 Thread J Dougherty
On Sunday 03 August 2008 01:54:43 pm Andrew Ramsey wrote: > Hello-- > > I am a relatively new user to R and I cannot find the information I > need. Please help. > > I have a very large data set with values including letters, numbers, > and symbols (sometimes within the same vector value [ie X9-]. >

Re: [R] Changing values

2008-08-03 Thread jim holtman
Exactly how is the translation of "X9-" -> 00911 done? Are there unique mappings of character sequences to numbers? How many different ones might there be? Why do you have leading zeros on the result? If they are changed to numeric, then the default printing results in '911'. Can you provide a

[R] Changing values

2008-08-03 Thread Andrew Ramsey
Hello-- I am a relatively new user to R and I cannot find the information I need. Please help. I have a very large data set with values including letters, numbers, and symbols (sometimes within the same vector value [ie X9-]. I've imported the data using read.fwp and it arrives in list fo