similar to: How to change dataframe to tables

Displaying 20 results from an estimated 8000 matches similar to: "How to change dataframe to tables"

2010 Sep 19
1
odds ratios for n-way tables: seeking an *apply-able method
I'm looking for a way to generalize the calculation of (log) odds ratios for 2 x 2 x {strata} frequency tables in vcd::oddsratio() to R x C x {strata} tables. For an R x C table, F, odds ratios can be defined in several ways; one simple way, particularly for tables with ordered factors, is to calculate the set of continuation odds ratios, based on the (R-1)x(C-1) set of 2x2 tables with
2005 Nov 12
1
how to make automatically each level from data.frame to vector
Dear R-helpers, Suppose I have dataset like this below: data(HairEyeColor) dfHEC <- as.data.frame(as.table(HairEyeColor)) my.dfHEC <- data.frame(Hair=rep(dfHEC$Hair,dfHEC$Freq), Eye=rep(dfHEC$Eye,dfHEC$Freq), Sex=rep(dfHEC$Sex,dfHEC$Freq)) my.dfHEC my.dfHEC$Hair my.dfHEC$Eye my.dfHEC$Sex and I know all levels for Hair, Eye and Sex. In my case, I
2007 Jul 18
0
HSAURtable question
It appears that HSAURtable only works on two dimensional tables. Is this correct? For example, here is HairEyeColor: , , Sex = Male Eye Hair Brown Blue Hazel Green Black 32 11 10 3 Brown 38 50 25 15 Red 10 10 7 7 Blond 3 30 5 8 , , Sex = Female Eye Hair Brown Blue Hazel Green Black 36 9 5 2
2003 Jun 13
0
mca & contingency tables - error: "All variables must be factors"
Hi, I would like to do a multiple correspondence analysis with the mca function in the MASS library on data that I have as a contingency table (which I've tried converting to a data frame). For example, ========= > data(HairEyeColor) > hair.df <- as.data.frame(HairEyeColor) > hair.df Hair Eye Sex Freq 1 Black Brown Male 32 2 Brown Brown Male 38 3 Red
2010 Oct 03
1
plyr: a*ply with functions that return matrices-- possible bug in aaply?
I have an application where I have a function to calculate results for a 2-way table or matrix, which returns a matrix with one less row and column. To keep this short, the function below captures the structure: fun2way <- function(f){ if (!length(dim(f)) ==2) stop("only for 2-way arrays") R <- dim(f)[1] C <- dim(f)[2] f[1:(R-1), 1:(C-1)] } Now, I want to
2006 Dec 06
2
vcd package, assoc()
Hello, I am trying to use the extended assocplot() function: assoc(), from vcd package. Trouble is that it cannot even run its own examples on my installation. I get this output: $> example(assoc) assoc> data("HairEyeColor") assoc> (x <- margin.table(HairEyeColor, c(1, 2))) Eye Hair Brown Blue Hazel Green Black 68 20 15 5 Brown 119 84 54
2011 Jan 19
3
question about result of loglinear analysis
Hi all: Here's a question about result of loglinear analysis. There're 2 factors:area and nation.The raw data is in the attachment. I fit the saturated model of loglinear with the command: glm_sat<-glm(fre~area*nation, family=poisson, data=data_Analysis) After that,I extract the coefficients: result_sat<-summary(glm_sat) result_coe<-result_sat$coefficients I find that all the
2011 Aug 16
2
how to get the result in "short cut" manner?
Hi all: My data:data(sleep) If I wanna calculate each group's extra,what I can do is: #method1 attach(sleep) mean(extra[group==1]) mean(extra[group==1]) #method2 result<-matrix(,0,2) g<-split(sleep,sleep$group) for(i in 1:length(g)) { result<-rbind(result,data.frame(unique(g[[i]]$group),mean(g[[i]]$extra))) } colnames(result)<-c("name","mean") But the above
2011 Aug 16
4
a question about lm on t-test.
Hi all: I have a question about lm on t-test. data(sleep) I wanna perform t-test to test the difference between the 2 groups: I can use: t.test(extra~group) The t.test result shows that:t = -1.8608; mean1=0.75,mean2=2.33 But I still wanna use: summary(lm(extra~group)) Intercept=0.75,which is mean1,just the same as t.test. group2=1.58 means the difference of the 2 groups,so
2011 Mar 15
1
sample size of 2 groups of skewed data
Hi all: I have a question on sample size calculation of 2 groups of data. If 2 groups of data are all normal distribution, then I can use the function "n.indep.t.test.eq" from samplesize package.But if 2 groups of data are all skewed distribution, but not normal distribution,how can I calculate the sample size then? I've tried many transformation (e.g. log arcsin…) in order to
2011 Jul 18
1
question about linear mixed model
Hi all: I have a question about linear mixed model. my linear mixed model with randomized slope and intercept with interaction of time and group(g1,g2,g3): model<- glmmPQL(log10(CD4) ~ time + factor(group)+ time:factor(group), random = ~time|id) What I get is only the main and interaction of time and group.My question is: 1. How can I get the g1,g2,g3's slope respectively?In other
2011 Nov 11
1
How to compute time interval?
time1 = 2008-03-09 time2 = 2010-9-10 How to compute how many years between time1 and time2? Thanks! best [[alternative HTML version deleted]]
2010 Jun 06
1
I need help in analyzing
I'm sory for my weak english. I need to analyze this subject : x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 y 0 0 1 0 0 1 0 0 1 0 czarne 1 1 0 0 0 0 1 0 0 0 rude 0 0 1 0 0 1 1 0 0 0 braz 0 0 1 0 1 0 1 0 0 0 blond 1 0 0 0 0 1 0 0 0 1 rude 1 1 0 0 0 0 0 0 0 1 blond 0 0 1 1 0 0 0 0 1 0 czarne 1 0 0 1 0 0 1 0 0 0 blond 0 0 1 0 0 1 1 0 0 0 blond 1 0 0 0 0 1 1 0 0 0 czarne 0 0 1 0 0 1 0 0 0 1 czarne 1 0 1 0 0 0
2007 Oct 05
3
Tart charts
It being friday, I would like to call your attention to an innovative data analysis by Leslie Lamport available from: http://research.microsoft.com/users/lamport/pubs/hair.pdf I particularly liked the graphics. url: www.econ.uiuc.edu/~roger Roger Koenker email rkoenker at uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois
2006 Dec 01
3
Make many barplot into one plot
Dear all, ## I have 4 tables like this: satu <- array(c(5,15,20,68,29,54,84,119), dim=c(2,4), dimnames=list(c("Negative", "Positive"), c("Black", "Brown", "Red", "Blond"))) dua <- array(c(50,105,30,8,29,25,84,9), dim=c(2,4), dimnames=list(c("Negative", "Positive"),
2010 Oct 29
2
make many barplot into one plot
Dear R users I would like to group my barplot graph (see example on the R help link). The proposed R code, adding individual bars to the plot, looks really overwhelming. My specific dataset just consists of five groups and three different levels within each groups (the individual bars). The .txt file is read as matrix (horizontal: group, vertical: levels). The R trellis barchart (function
2009 Dec 15
2
Diagonal Labels on "Beside" Bars in Barplot
My question is based on an example provided in the following: Referencing: Statistics with R Vincent Zoonekynd <zoonek at math.jussieu.fr> 6th January 2007 URL: http://zoonek2.free.fr/UNIX/48_R/all.html data(HairEyeColor) a <- as.table( apply(HairEyeColor, c(1,2), sum) ) # Provided Example barplot(a, beside = TRUE, legend.text = attr(a, "dimnames")$Hair) # I
2011 Jul 26
3
a question about glht function
Hi all: There's a question about glht function. My data:data_ori,which inclue CD4, GROUP,time. f_GROUP<-factor(data_ori$GROUP) f_GROUP is a factor of 3 levels(0,1,2,3) result <- lme(sqrt(CD4) ~ f_GROUP*time ,random = ~time|ID,data=data_ori) glht(result, linfct = mcp(f_GROUP="Tukey") ) Error in `[.data.frame`(mf, nhypo[checknm]) : undefined columns selected I can't
2008 Feb 12
3
help with bwplot
Dear list, I have following data set, which I want to plot the "Scale" variable on the x-axis and "Mean"´on the y-axis for each Ageclass and for each sex. The Mean value of each Ageclass for each sex would be connected by a line. Totally, there should be 6 lines, from which three present the Mean values of each Ageclass for respective sex. Are there any easy ways to do
2005 Dec 24
2
grouping data
Hello R-users/experts, I am new to R- I have a simple question: Let say I have a data set as follows temp:[file attached] the data structure is a follows: sex age female 28 female 53 female 53 female 36 male 42 male 29 male 43 male 36 male 41 Here we are grouping all male value into male and all female value in to female