Re: [R] Still can't find missing data - How do I get NA in xtabs with factors?

2009-06-02 Thread hadley wickham
>> Let's see if I understand this.  Do I iterate through >>    x <- factor(x, levels(c(levels(x), NA), exclude=NULL) >> for each of the few hundred variables (x) in my data frame? > > > Yes, for all being factors. Wouldn't addNA() be the preferred method? To do it for all variables is pretty simp

Re: [R] Still can't find missing data - How do I get NA in xtabs with factors?

2009-06-02 Thread Rolf Turner
On 3/06/2009, at 12:03 PM, Farley, Robert wrote: The problem here is Table doesn't seem to have a way to weigh the data. ToyData Data1 Data2 Data3 Weight 101 Sam Red Banana1.1 102 Sam Green Banana2.1 103 Sam Blue Orange2.1 104 Fred Red Orange2.1 105 Fred G

Re: [R] Still can't find missing data - How do I get NA in xtabs with factors?

2009-06-02 Thread Farley, Robert
ot; and R does not? > > > Will this be a problem with read.dta as well? > > > > > Robert Farley > Metro > www.Metro.net > > > -Original Message- > From: William Dunlap [mailto:wdun...@tibco.com] > Sent: Thursday, May 28, 2009 20:39 >

Re: [R] Still can't find missing data - How do I get NA in xtabs with factors?

2009-05-30 Thread Uwe Ligges
TATA) allow "NA" as an "undeclared level" and R does not? Will this be a problem with read.dta as well? Robert Farley Metro www.Metro.net -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Thursday, May 28, 2009 20:39 To: Farley, Robert Subjec

Re: [R] Still can't find missing data - How do I get NA in xtabs with factors?

2009-05-29 Thread Farley, Robert
vel" and R does not? Will this be a problem with read.dta as well? Robert Farley Metro www.Metro.net -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Thursday, May 28, 2009 20:39 To: Farley, Robert Subject: RE: [R] Still can't find missing data In R

Re: [R] Still can't find missing data

2009-05-28 Thread Farley, Robert
arley Metro www.Metro.net -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Thursday, May 28, 2009 16:26 To: Farley, Robert Subject: RE: [R] Still can't find missing data Try reading it in with read.table's argument stringsAsFactors=FALSE. I think the underlyi

Re: [R] Still can't find missing data

2009-05-28 Thread Farley, Robert
bert Farley Metro www.Metro.net -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dieter Menne Sent: Thursday, May 28, 2009 05:46 To: r-help@r-project.org Subject: Re: [R] Still can't find missing data Farley, Robert wrote: > >

Re: [R] Still can't find missing data

2009-05-28 Thread Dieter Menne
Farley, Robert wrote: > > I can't get the syntax that will allow me to show NA values (rows) in the > xtabs. > > lengthy non-reproducible example removed > If you want a reproducible answer, prepare a reproducible result. And check that the syntax is na.action=na.pass Dieter -- View

Re: [R] Still can't find missing data

2009-05-27 Thread Farley, Robert
foreign_0.8-29 > Robert Farley Metro www.Metro.net -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dieter Menne Sent: Wednesday, May 27, 2009 02:52 To: r-h...@stat.math.ethz.ch Subject: Re: [R] Still can't find missing da

Re: [R] Still can't find missing data

2009-05-27 Thread Dieter Menne
Farley, Robert metro.net> writes: > > What is wrong? I've looked into the na commands and the ?xtabs entry, but I haven't found anything that works. > I never understood the logic that exclude=NULL needs na.action in addition. test <- c(1,2,3,1,2,3,NA,NA,1,2,3) xtabs(~test,exclude=NULL,na.a

[R] Still can't find missing data

2009-05-26 Thread Farley, Robert
I'm trying to prepare some cross tabs, looking at a number of variables against a variable "connector" which has 2 values: "OD Passenger" and " Connector". When I produce a xtabs one way I have observations under "Connector" but against a different variable "Connector" shows all 0 values. What