factors rather than character strings, you can now
> change back:
>
> db1 <- within(db1, olditems <- factor(olditems)) ## use <- here!
>
> 6. check the difference
>
> > str(db1)
> 'data.frame': 5 obs. of 2 variables:
> $ olditems: Factor w/ 5 le
On 22/07/2009, at 1:21 PM, jim holtman wrote:
Notice that three items are returned where you thought one was:
[1] FALSE TRUE TRUE TRUE FALSE
db1$olditems[db1$olditems==''] #wait, only one item is returned?
[1]
Levels: nuts soup
db1[db1$olditems=='',] #somehow this works!
olditems p
: Factor w/ 5 levels "crackers","goatsmilk",..: 4 1 5 2 3
$ prices : num 4.45 3.25 4.42 2.25 3.98
>
Bill Venables
http://www.cmis.csiro.au/bill.venables/
-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of
Notice that three items are returned where you thought one was:
[1] FALSE TRUE TRUE TRUE FALSE
> db1$olditems[db1$olditems==''] #wait, only one item is returned?
[1]
Levels: nuts soup
> db1[db1$olditems=='',] #somehow this works!
olditems prices
23.25
34.42
4
On Tue, Jul 21, 2009 at 7:39 PM, Gene Leynes wrote:
> # Just when I thought I had the basic stuff mastered
> # This has been quite perplexing, thanks for any help
>
>
> ## Here's the example:
>
> db1=data.frame(
> olditems=c('soup','','','','nuts'),
> prices=c(4.45, 3.25, 4.42, 2.25, 3.98
# Just when I thought I had the basic stuff mastered
# This has been quite perplexing, thanks for any help
## Here's the example:
db1=data.frame(
olditems=c('soup','','','','nuts'),
prices=c(4.45, 3.25, 4.42, 2.25, 3.98))
db2=data.frame(
newitems=c('stew','crackers','tofu','goats
6 matches
Mail list logo