Displaying 20 results from an estimated 5000 matches similar to: "weighted ftable"
2007 May 31
3
Problem with Weighted Variance in Hmisc
The function wtd.var(x,w) in Hmisc calculates the weighted variance of x
where w are the weights. It appears to me that wtd.var(x,w) = var(x) if all
of the weights are equal, but this does not appear to be the case. Can
someone point out to me where I am going wrong here? Thanks.
Tom La Bone
[[alternative HTML version deleted]]
2006 Jul 15
1
Some problems with latex(ftable)
The ftable structure is not an ordinary matrix. Instead, it has the
body of the table with several cbind- and rbind-ed rows and columns of
label information. The example in ?ftable has two row factors and two
column factors.
Continuing with the example in ?ftable, enter
tmp <- ftable(mtcars$cyl, mtcars$vs, mtcars$am, mtcars$gear, row.vars = c(2, 4),
dnn =
2006 Mar 17
1
Wishlist: 'append' argument for write.ftable()
I would like to suggest that an 'append' argument be added to
write.ftable(). This would allow, for example, the user to
append ftable() output to a text report.
I have attached an svn patch to ftable.R that makes the proposed
change to write.ftable(). [A very trivial change since 'append'
is simply passed to cat().]
I have also attached a patch to read.ftable.Rd which documents
2008 Jul 02
1
exporting ftable
How can I export an ftable object in the same format that appears in R
command window?
For testing that i was using this example that is in help of this function.
## Start with a contingency table.
ftable(Titanic, row.vars = 1:3)
ftable(Titanic, row.vars = 1:2, col.vars = "Survived")
ftable(Titanic, row.vars = 2:1, col.vars = "Survived")
## Start with a data frame.
x <-
2009 Jan 19
1
conditional weighted quintiles
Dear All,
I am economist and working on poverty / income inequality. I need descriptive
statitics like the ratio of education expentitures between different income
quintiles where each household has a different weight. After a bit of
google search I found 'Hmisc' and 'quantreg' libraries for weighted quantiles.
The problem is that these packages give me only weighted quintiles;
2012 Dec 17
2
Suggestion: 'method' slot for format.ftable()
Dear R-developers,
I would like to suggest a 'method' slot for format.ftable() (see an adjusted
'format.ftable()' below, taken from the source of R-2.15.2).
At the moment, format.ftable() contains several empty cells due to the way the
row and column labels are printed. This creates problems (= unwanted empty
columns/rows) when converting an ftable to a LaTeX table; see an
2011 May 27
1
How to convert an ftable object to a matrix including the row names?
Dear expeRts,
What's the easiest way to convert an ftable object to a matrix such that the
row names of the ftable object are shown in the first couple of columns of the
matrix? This is (typically) required, for example, when the final goal is to print
the matrix via xtable.
Below is a rather complicated example of how to do it...
Cheers,
Marius
## Goal: convert an ftable() to a
2012 Jan 26
1
ftable.formula
I apologize in advance if this is the wrong forum for this
report/request, and for the fact that I have not read the code for
ftable.formula in any detail.
>From reading the documentation for ftable.formula, I expected that the
following two calls to ftable would produce the same results:
data(UCBAdmissions)
ftable(UCBAdmissions, row.vars = "Dept", col.vars = c("Gender",
2011 Apr 20
2
survexp with weights
Hello,
I probably have a syntax error in trying to generate an expected
survival curve from a weighted cox model, but I can't see it. I used
the help sample code to generate a weighted model, with the addition
of a "weights=albumin" argument (I only chose albumin because it had
no missing values, not because of any real relevance). Below are my
code with the resulting error
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 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
2007 Jun 23
2
latex of ftable (Hmisc?)
Dear latexRs,
I tried to make a latex printout of a simple categorial ftable. It should
look like the output of print.ftable. Any ideas how to get the syntax of
summary.formula right. Or some alternative? As far I see, xtable does not
have method for ftable.
Dieter
library(Hmisc)
n=500
sex <- factor(sample(c("m","f"), n, rep=TRUE))
treatment <-
2004 Feb 04
3
Scoping bug in ftable() (PR#6541)
This bug shows up in ftable() in both r-patched and r-devel:
> x <- c(1,2)
> y <- c(1,2)
> z <- c(1,1)
> ftable(z,y)
y 1 2
z
1 1 1
> ftable(z,x)
x 1
z
1 2
Since x and y are identical, the two ftable results should be the
same, but they are not.
I've only been able to see this when the column variable is named "x",
so it looks like a
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
2007 Nov 26
2
ftable as latex (with Hmisc?)
Dear List, possibly called Frank,
I tried to create an ftable lookalike of the following data set in LaTeX/Sweave
with summary(formula,..), but I could not get it to work for count tables;
numeric tables work fine.
summary(formula,...,fun="table") does not give the full cross breakdown.
Other suggestions welcome. Note that in the output there should be empty fields
on repeated
2006 Jan 12
2
tapply and weighted means
I' m trying to compute weighted mean on different
groups but it only returns NA. If I use the following
data.frame truc:
x y w
1 1 1
1 2 2
1 3 1
1 4 2
0 2 1
0 3 2
0 4 1
0 5 1
where x is a factor, and then use the command :
tapply(truc$y,list(truc$x),wtd.mean, weights=truc$w)
I just get NA. What's the problem ? What can I do ?
2010 Jun 22
2
constructing a data frame from ftable
Dear R People:
I have the following data set with the columns DATE, GENDER, and Co.
Co has 8 possible options.
> a.df[1:10,]
DATE GENDER Co
1 2009-04-16 F Rash
2 2009-04-16 F Other
3 2009-04-16 M Botulinic
4 2009-04-16 M Other
5 2009-04-16 M Constitutional
6 2009-04-16 F Other
7 2009-04-16
2017 Jul 09
2
Help with ftable.svyby
Hi all,
When I try the following with pkg Survey it returns the error below:
ftable(svyby(~INCOME, ~AGECL+RACECL, svymean, design=q50),
rownames=list(AGECL=c("<35", "35-44", "45-54", "55-64",
"65-74", ">=75"),
RACECL=c("white non hispanic", "non white or
2010 Jun 08
2
constructing a contingency table (ftable, table)
Dear all,
an hopefully quick table question.
I have the following data:
Two objects that are 2*9 matrix with nine column names (Dis1, ...,
Dis9) and the row names (2010,2020). The content are frequencies
(numeric).
In want to create a table that is along the lines of
ftable(UCBAdmissions) and should looks like this:
Dis1 | ...| Dis9
2010|2020|....|2010|2020
(first row,first column is the value