Displaying 20 results from an estimated 7000 matches similar to: "How to do more advanced cross tabulation in R?"
2006 Dec 31
3
tabulate: switching columns and rows
Hi all,
Please, is there any way of controlling factors in row/columns when using ftable/xtabs? As far as I can see, the last cross-clasifing variable in the formula will appear in columns. The previous ones, in rows. For instance, is it possible to make tension and replicate appear in columns?
ftable(xtabs(breaks ~ wool + tension + replicate, data = warpbreaks))
After some years using SAS
2002 Feb 26
1
Cross-tabulation of data from database
I am quite new to R, so please bear over with me if I have problems with the
R terminology.
I want to (try to) use R for some analyses within vegetation ecology, using
the vegan package. I have my data in a postgresql database, and I manage to
get them into R as a dataframe with columns for respectively: Name of the
analysed m2, Name of the species, coverage of species in the square in %. I
2008 Jan 06
1
aggregate.ts help
Hi,
I have a ts object with a frequency of 4, i.e., quarterly data, and I would
like to calculate the mean for each quarter. So for example:
> ts.data=ts(1:20,start=c(1984,2),frequency=4)
> ts.data
Qtr1 Qtr2 Qtr3 Qtr4
1984 1 2 3
1985 4 5 6 7
1986 8 9 10 11
1987 12 13 14 15
1988 16 17 18 19
1989 20
If I do this manually, the mean
2010 Sep 08
5
Newbie cross tabulation issue
hi, i'm new in R and i need some help. Please, ¿do you know a function how
can process cross tables for many variables and show the result in one table
who look like this?:
+----------------------------------------------------+
|------------------ | X variable |
|----------------- | Xop1 | Xop2 | Xop3|.....|
+----------------------------------------------------+
|Yvar1 |
2008 Mar 12
1
ftable and xtabs
Hoping someone can help me with xtabs and ftable. I'm trying to get a pair
of ftables (possibly more) next to each other. For example:
> dunhill_lights_xtab<-ftable(xtabs(grossedupobs ~ gender+age_group +
dunhill_lights, data = ciggs))
> dunhill_lights_xtab
dunhill_lights No Yes
gender age_group
Female
2002 Jul 12
2
Crosstabs in R
Before I reinvent the wheel, I have need for a relatively straightforward
crosstabulation (2 x n) function. I know that R has table(), ftable(),
xtabs(), and summary(xtabs()), but none of these produce a fully "tricked"
out cross-tabulation with marginal totals, expected cell frequencies, and
an array of statistics about the contingency table.
Is there a more complete (something
2009 Oct 10
2
Tabulation
Hi all,
I have a data set
x1 x2 x3
1 2 1
1 2 3
2 1 2
1 2 1
3 1 1
I want to tabulate in the following way.
1 2 3
x1 3 2 1
x2 2 3 0
x3 3 1 1
It is just like frequency distribution
Any help is highly appreciated
[[alternative HTML version deleted]]
2013 Nov 13
2
Implementing Samba 4 in multi site environment
hii all
i need some suggestion about implementing samba 4 in multisite environment
im still new in samba 4, i have finish install my first samba 4 DC in my
centos 6 machine without any problem.
i have plan to implement samba 4 in distribute / multisite environment, i
have one head quarter office and aroung 20 site office, in my head quarter
office i have not more than 50 PC client and in every
2008 Jun 05
7
Improving data processing efficiency
Hi everyone!
I have a question about data processing efficiency.
My data are as follows: I have a data set on quarterly institutional
ownership of equities; some of them have had recent IPOs, some have not
(I have a binary flag set). The total dataset size is 700k+ rows.
My goal is this: For every quarter since issue for each IPO, I need to
find a "matched" firm in the same
2006 Apr 26
3
Were to find appropriate functions for a given task in R
This is a generic request concerning were to look for finding
appropriate information on a precise procedure in R.
I’m using R for teaching introductory statistics and my students are
learning how to deal with it. However, I find it difficult to locate
some of the procedures. For instance, for basic crosstabulation, it is
obvious that basic functions as table, ftable, and prop.table can be
used.
2010 Jan 16
3
Comparing dates in dataframes
I have two data frames. One (arr) has all arrivals to an airport for a
year, and the other (gw) has the dates and quarter hour of the day when
the weather is good. arr has a Date and quarter hour column.
>names(arr)
[1] "Date" "weekday" "hour" "month" "minute"
[6] "quarter" "ICAO"
2011 Apr 30
1
More flexible aggregate / eval
Dear list,
I would like to do some calculation using different grouping variables.
My 'df' looks like this:
# Some data
set.seed(345)
id <- seq(200,400, by=10)
ids <- sample(substr(id,1,1))
group1 <- rep(1:3, each=7)
group2 <- rep(1:2, c(10,11))
group3 <- rep(1:4, c(5,5,5,6))
df <- data.frame(id, ids, group1, group2, group3)
df <- rbind(df, df, df)
df$time <-
2002 Dec 02
1
advanced tabulation
i make me thoughts about a "advanced tabulation" package similar to
commercial software products like Quantum or Wincross.
Before i'm beginning to fight with coding - is in the mailing-List anybody
doing something similar in the past and have a good starting point
and/or suggestions for me ?
My purpose ist to define for a dataset headers (i.e. sex,age-groupes..)
which should
2007 Dec 16
1
format numbers in a contingency table
Hi,
I am constructing a contingency table using xtabs. The function works great:
mo
yr Sep Oct Nov Dec
1950 -7.164486e-02 3.152674e-02 -1.283389e-02 1.570382e-01
1951 3.054293e-02 4.665234e-02 -2.445499e-04 8.720204e-02
1952 3.937034e-02 -4.790636e-02 5.022616e-02 1.180279e-01
but I wonder if there is an argument I can pass to xtabs
2006 Aug 30
4
Barplot
Dear all,
I have a dataset. I want to make barplot from this data.
Zero1 <- "
V1 V2 V3 V4 V5 V6 V7 V8 V9
1 1 0 0 0 1 0 0 0 Positive
2 0 0 1 0 1 0 1 1 Negative
3 0 0 1 0 0 0 1 1 Positive
4 0 1 0 1 1 1 0 1 Negative
5 0 0 1 0 1 1 0 0 Positive
6 0 1 0 0 1 1 1 1 Negative
7 1 0 1 1 1 1 1 1 Negative
8 0 0 0 0 1 0 0 1
2001 Sep 05
3
Bug in ftable?? (Was: Two-way tables of data, etc)
Further to the discussion between Murray Jorgensen and Brian Ripley,
it seems to me better to choose tabulations that will not come and bite
you. Suppose your data are sligtly irregular, e.g. (for the sake of
the argument):
data( warpbreaks )
warpbreaks$variant <- rep( 1:5, len=54 )
attach( warpbreaks )
tb <- table( wool, tension, variant )
tb
# in this case you would like to see:
tp
2001 Sep 05
3
Bug in ftable?? (Was: Two-way tables of data, etc)
Further to the discussion between Murray Jorgensen and Brian Ripley,
it seems to me better to choose tabulations that will not come and bite
you. Suppose your data are sligtly irregular, e.g. (for the sake of
the argument):
data( warpbreaks )
warpbreaks$variant <- rep( 1:5, len=54 )
attach( warpbreaks )
tb <- table( wool, tension, variant )
tb
# in this case you would like to see:
tp
2011 Apr 16
1
Matching Problem: Want to match to data.frame with inexact matching identifier (one identifier has to be in the range of the other).
Hello R-Community,
I have the following matching problem: I have two data.frames, one
with an observation every month (per company ID), and one with an
observation every quarter (per company ID; note that quarter means
fiscal quarter; therefore 1Q = Jan, Feb, Mar is not necessarily
correct and also, a fiscal quarter is not necessarily 3 month long).
For every month and company, I want to get the
2011 Jun 24
1
Converting an ftable (contingency table) to a dataframe in R
I am generating an ftable (by running ftable on the results of a xtabs command) and I am getting the following.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Var1? Var2
date ? ? ? ? ? ? ? ? group? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2007-01-01? ? ? ? ? q1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1? ? 9
? ? ? ? ? ? ? ? ? ? ?q2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2008 May 31
1
Representing 'Date' as 'Year - Quarter'
I have financial data on a a set of firms, with a quarterly period
(fundamental data). The data spans 10 years, and four quarters per
year. The present file (.csv) reads the Date columns as "200706" for
the second quarter of 2007; "199809" for the third quarter of 1997.
Is there a way I can convert it to something like "2007 Q2", "1998 Q3"?
I am aware of