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 is wrong? I've looked into the na commands and the ?xtabs entry, but I
haven't found anything that works.
#########################
>
> XTTable <- xtabs(wt_annual ~ time_strata + connector, LAWAData)
> XTTable ## List
connector
time_strata OD Passenger Connector
Morning Peak - 0550 to 0959 5605.140 1234.933
Late morning to Mid-Day - 1000 to 1359 4778.503 2516.943
Evening Peak - 1400 to 1959 5145.730 3171.348
Night - 2000 to 0235 (last flight) 2929.085 2567.790
>
> XTTable <- xtabs(wt_annual ~ Mode_orig_only + connector, exclude=NULL,
> LAWAData)
> XTTable ## List
connector
Mode_orig_only OD Passenger
Connector
Walked/Biked 17.814338
0.000000
I flew in from another a place/connected 0.000000
0.000000
Amtrak 49.128982
0.000000
Bus - Chartered bus or van 525.978899
0.000000
Bus - Hotel Courtesy van 913.295370
0.000000
Bus - MTA (Metro) or other public transit bus 114.302764
0.000000
Bus - Scheduled airport bus or van (e.g. Airport bus or Disn 298.151438
0.000000
Bus - Union Station Flyaway 93.088049
0.000000
Bus - Van Nuys Flyaway 233.794168
0.000000
Green line/light rail 20.764539
0.000000
Limousine/town car 424.120506
0.000000
Metrolink 8.054528
0.000000
Motorcycle 6.010790
0.000000
On-call shuttle/van (e.g. Super Shuttle, Prime Time) 1832.748525
0.000000
Car/truck/van - Private 10191.284139
0.000000
Car/truck/van - Rental 2099.771923
0.000000
Taxi 1630.148576
0.000000
..Refused 0.000000
0.000000
>
>
> XTTable <- xtabs(wt_annual ~ Mode_orig_only + connector, na.action(na.pass),
> LAWAData)
Error in eval(expr, envir, enclos) : object "wt_annual" not found
> XTTable ## List
connector
Mode_orig_only OD Passenger
Connector
Walked/Biked 17.814338
0.000000
I flew in from another a place/connected 0.000000
0.000000
Amtrak 49.128982
0.000000
Bus - Chartered bus or van 525.978899
0.000000
Bus - Hotel Courtesy van 913.295370
0.000000
Bus - MTA (Metro) or other public transit bus 114.302764
0.000000
Bus - Scheduled airport bus or van (e.g. Airport bus or Disn 298.151438
0.000000
Bus - Union Station Flyaway 93.088049
0.000000
Bus - Van Nuys Flyaway 233.794168
0.000000
Green line/light rail 20.764539
0.000000
Limousine/town car 424.120506
0.000000
Metrolink 8.054528
0.000000
Motorcycle 6.010790
0.000000
On-call shuttle/van (e.g. Super Shuttle, Prime Time) 1832.748525
0.000000
Car/truck/van - Private 10191.284139
0.000000
Car/truck/van - Rental 2099.771923
0.000000
Taxi 1630.148576
0.000000
..Refused 0.000000
0.000000
>
>
> XTTable <- xtabs(wt_annual ~ Mode_orig_only + connector, drop.unused.levels
> = FALSE, LAWAData)
> XTTable ## List
connector
Mode_orig_only OD Passenger
Connector
Walked/Biked 17.814338
0.000000
I flew in from another a place/connected 0.000000
0.000000
Amtrak 49.128982
0.000000
Bus - Chartered bus or van 525.978899
0.000000
Bus - Hotel Courtesy van 913.295370
0.000000
Bus - MTA (Metro) or other public transit bus 114.302764
0.000000
Bus - Scheduled airport bus or van (e.g. Airport bus or Disn 298.151438
0.000000
Bus - Union Station Flyaway 93.088049
0.000000
Bus - Van Nuys Flyaway 233.794168
0.000000
Green line/light rail 20.764539
0.000000
Limousine/town car 424.120506
0.000000
Metrolink 8.054528
0.000000
Motorcycle 6.010790
0.000000
On-call shuttle/van (e.g. Super Shuttle, Prime Time) 1832.748525
0.000000
Car/truck/van - Private 10191.284139
0.000000
Car/truck/van - Rental 2099.771923
0.000000
Taxi 1630.148576
0.000000
..Refused 0.000000
0.000000
>
>
########################
Robert Farley
Metro
1 Gateway Plaza
Mail Stop 99-23-7
Los Angeles, CA 90012-2952
Voice: (213)922-2532
Fax: (213)922-2868
www.Metro.net
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.