similar to: generalizing expand.table: table -> data.frame

Displaying 20 results from an estimated 10000 matches similar to: "generalizing expand.table: table -> data.frame"

2011 Mar 27
2
Hmisc summary.formula formats for binary and continuous variables
Hello, I am using Hmisc summary.formula, latex and Sweave to produce tables for publication. Is it possible to change the formats for binary and continuous variables? I would prefer to show 35 (10%) and 1.5 (1.2-1.8) rather than 10% (35) and 1.2 / 1.5 / 1.8. Here is a simple example: sex <- factor(sample(c("m","f"), 500, rep=TRUE)) age <- rnorm(500, 50, 5) treatment
2009 Jun 11
2
Expand a contingency table based on the value in one column
Hi R-helpers, I have the following (dummy) dataframe: > test DATE LOCATION KIND CLASS COUNT 1 1 1 CAR A 2 2 1 1 TRUCK D 3 3 1 1 BUS E 4 4 1 2 CAR E 2 5 1 2 TRUCK A 7 6 1 2 BUS F 1 That I would like to turn into this: > test2 DATE LOCATION KIND CLASS 1 1 1
2010 Mar 16
3
function arguments: name of an object vs. call producing the object?
In a function, say foo.glm for glm objects I want to use the name of the object as a label for some output, but *only* if a glm object was passed as an argument, not a call to glm() producing that object. How can I distinguish these two cases? For example, I can use the following to get the name of the argument: foo.glm <- function(object) { oname <- as.character(sys.call())[2]
2009 Jan 10
1
Setting a contingency table
Hi, I want to set a make a contingency table which will look like this.. The problem is that I can't  set the table like the following.                      col1     col2       Total     row1              a         b         n10                      rp1       rp2        100                      cp1       cp2       rtp1   ---------------------------------------------     row2            
2007 Aug 22
4
within-subject factors in lme
I don't think, this has been answered: > I'm trying to run a 3-way within-subject anova in lme with 3 > fixed factors (Trust, Sex, and Freq), but get stuck with handling > the random effects. As I want to include all the possible random > effects in the model, it would be something more or less > equivalent to using aov > > > fit.aov <- aov(Beta ~ >
2003 Apr 11
1
Pearson's Chi-squared Test
How i can perform a Pearson's Chi-squared Test in this data set: | Outcome -----------------+-----------+----------------------------------+ Treatment | Sex | None |Some | Marked | Total -----------------+------------+--------+--------+-------------+ Active | Female | 6 | 5 | 16 | 27
2010 May 12
3
Summarizing counts by multiple factors
Hi, An example data set is: group level color A 1 "blue" A 1 "Red" B 1 "blue" B 2 "Red" A 2 "Red" B 2 "Red" B 2 "blue" B 2 "blue" A 2 "blue" A 2 "Red"
2008 Jul 25
2
Package Hmisc, functions summary.formula() and latex(), options pdig, pctdig, eps and prmsd
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20080725/bcafe250/attachment.pl>
2010 Jul 22
1
gam() and contrast
Dear All, I met problems when doing contrast and now really need some help in the model below: Fit=gam(y~treat+SEQUENCE+PERIOD+SEX+s(x),data=dat, random=list(SUBJID=~1),correlation=corAR1(form=~1|SUBJID)) And error message keeps coming out when I want to compare the differences between treatments: Diff=contrast(Fit, list(treat=treatment[-placebo.pos]),list(treat="Placebo"),
2007 May 14
1
Nicely formatted summary table with mean, standard deviation or number and proportion
Dear all, The incredibly useful Hmisc package provides a method to generate summary tables that can be typeset in latex. The Alzola and Harrell book "An introduction to S and the Hmisc and Design libraries" provides an example that generates mean and quartiles for continuous variables, and numbers and percentages for count variables: summary() with method = 'reverse'. I
2009 Feb 27
2
Adjusting confidence intervals for paired t-tests of multiple endpoints
Dear R-users, In a randomized placebo-controlled within-subject design, subjects recieved a psycho-active drug and placebo. Subjects filled out a questionnaire containing 15 scales on four different time points after drug administration. In order to detect drug effects on each time point, I compared scale values between placebo and drug for all time conditions and scales, which sums up to
2007 May 17
2
How to analyse simple study: Placebo-controlled (2 groups) repeated measurements (ANOVA, ANCOA???)
Hallo! I have two groups (placebo/verum), every subject is measured at 5 times, the first time t0 is the baseline measurement, t1 to t4 are the measurements after applying the medication (placebo or verum). The question is, if there is a significant difference in the two groups and how large the differnce is (95% confidence intervals). Let me give sample data # Data
2008 Mar 14
2
problems creating data frames
I am having two problems creating data frames that I have solutions, but they really seem like kludges and I assume I just don't understand the proper R way of doing things. The first situation is I have an set of uneven data vectors. When I try to use them to create a data frame I would like the bottoms of them padded with NAs, without explicitly specifying that. When I do: anxiety.data =
2011 Mar 01
1
glht() used with coxph()
Hi, I am experimenting with using glht() from multcomp package together with coxph(), and glad to find that glht() can work on coph object, for example: > (fit<-coxph(Surv(stop, status>0)~treatment,bladder1)) coxph(formula = Surv(stop, status > 0) ~ treatment, data = bladder1) coef exp(coef) se(coef) z p treatmentpyridoxine -0.063 0.939 0.161
2007 Sep 27
1
windows device transparency issue
I read in a thread in r-help today that the windows device in 2.6 supports transparency, so I tried an example and had some issues. The density plots should be filled with transparent color in the following example (similar to the points), however the color is "fully" transparent. This works in the Cairo device, but not in the windows device. Thanks, --Matt Matt Austin
2008 Sep 09
4
Help with 'spectrum'
For the command 'spectrum' I read: The spectrum here is defined with scaling 1/frequency(x), following S-PLUS. This makes the spectral density a density over the range (-frequency(x)/2, +frequency(x)/2], whereas a more common scaling is 2? and range (-0.5, 0.5] (e.g., Bloomfield) or 1 and range (-?, ?]. Forgive my ignorance but I am having a hard time interpreting this. Does this mean
2008 Jul 02
1
auto.key in xyplot in conjunction with panel.text
All, I can't seem to get auto.key to work properly in an xyplot that is employing panel.text. Specifically, I often change the default grouping colors then use auto.key accordingly, but for some reason the same functionality isn't working for this different type of plot. Any help much appreciated. Cheers, David library("lattice") dat = data.frame( Y = c(rnorm(18,1),
2013 Sep 13
1
Creating dummy vars with contrasts - why does the returned identity matrix contain all levels (and not n-1 levels) ?
Hello, I have a problem with creating an identity matrix for glmnet by using the contrasts function. I have a factor with 4 levels. When I create dummy variables I think there should be n-1 variables (in this case 3) - so that the contrasts would be against the baseline level. This is also what is written in the help file for 'contrasts'. The problem is that the function
2007 Feb 24
1
Woolf's test, Odds ratio, stratification
Just a general question concerning the woolf test (package vcd), when we have stratified data (2x2 tables) and when the p.value of the woolf-test is below 0.05 then we assume that there is a heterogeneity and a common odds ratio cannot be computed? Does this mean that we have to try to add more stratification variables (stratify more) to make the woolf-test p.value insignificant? Also in the
2002 May 27
1
nlme cross-over and fixed nested
I have problem getting the concept of a nested fixed variable into the nlme scheme. I fear the question is very stupid. In the past I had asked this before, and never got a reply (in other cases, the response was within hours). I also checked the S-list, where several similar enquiries of other people are orphaned. We have a cross-over design, where patient are treated two weeks with placebo,