similar to: Force "square" crosstabulation

Displaying 20 results from an estimated 7000 matches similar to: "Force "square" crosstabulation"

2008 Nov 13
2
CROSSTABULATION
I want to form a 3x3 crosstabulation for the signs of two vectors (i.e. Negative, Zero, Positive). The problem is that I am simulating the data so for some iterations one of the categories is absent. Thus the resulting table shrinks to 3x2. I want it to be 3x3 with zero column corresponding to the missing category. Moreover, I have tried but failed to give the dimension names. -- Sohail Chand
2009 Oct 12
1
crosstabulation and unlist function
Hello R-users, My toy example: aa<-c(1:5) bb<-c(NA,2,NA,4,5) cc<-c(1,2,NA,4,NA) dd<-c("A","B","B","A","C") df<-data.frame(aa,bb,cc,dd=as.factor(dd)) table(unlist(df[,1:3])) Can anyone point me to what function let's me do a crosstabulation between table(unlist(df[,1:3])) and df$dd? I want to find out when dd==A (or B,
2000 Sep 24
2
FW: Crosstabulation
how about this: tapply(vector,list(factor1,factor2),function)? -----Original Message----- From: owner-r-help at stat.math.ethz.ch [mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of Murray Jorgensen Sent: 24. september 2000 02:46 To: R-help Subject: [R] Crosstabulation I can't seem to find a function in R similar to Splus crosstabs() for creating a multi-way table from factors and a
2010 May 20
2
multiple 2 by 2 crosstabulations?
Hello, I have a dataframe (var_1, var_2, ..., var_n) and I would like to export summary statistics to Latex in the form of a table. I want specific summary statistics by crossing numerous variables 2x2 AT ONCE. In each cell I would like sometimes to have the median (Q1 - Q3), or frequency and proportion, etc. CrossTable, xtab, etc... do not allow for multiple 2 by 2 crosstabulation. The table
2003 May 17
1
how to handle 'multiresponse' variable?
Hello! I have dataset where one variable is 'multiresponse', like this: [1] "1 2" "1 2 3" "4" "1 4" "4 3" etc. 'responses' separated by space. observations in different 'rows' of data.frame. I can do strsplit(data$var,' ') and make a list, where multiple responses are elements of character vectors, like this: $
2007 Jul 27
3
Convert string to list?
Let's say I have the following string: str <- "P = 0.0, T = 0.0, Q = 0.0" I'd like to find a function that generates the following object from 'str'. list(P = 0.0, T = 0.0, Q = 0.0) Thanks! -- http://mutualism.williams.edu
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
2003 Aug 22
2
"subscript out of range" message
Hi All: I was recently working with a dataset on arsenic poisoning. Among the variables in the dataset, I used the following three variables to produce crosstabulations (variable names: FOLSTAT, GENDER, ASBIN; all three were categorical variables, FOLSTAT denoted follow up status for the subjects and had seven levels, GENDER denoted sex (two levels: male,female), and ASBIN denoted binarized
2001 Sep 06
0
crosstabulation
Hi, I find difficult to read crosstabulated data without percentages, so I wrote this dirty function that may be useful to others. It only works up to 3 dimensions since I am not very good at programming in R. I would appreciate if someone else has a better similar function or can improve this one. As an example of use: > x<-rbinom(100,1,.3) > y<-rbinom(100,1,.3) >
2006 May 02
1
Is there a bug in CrossTable (gmodels)
Library gmodels include a function CrossTable that is useful for crosstabulation. In the help, it is indicated that one can call this function as CrossTable(data), were data is a matrix. However, when I try to use this option, it doesn't help. Any idea? Is there a bug? Thanks for your help. Prof. Albert Sorribas Grup de Biomatem?tica i Bioestad?stica Departament de Ci?ncies M?diques B?siques
2008 Sep 23
1
Generalising to n-dimensions
Hi R-helpers, I have two queries relating to generalising to n dimensions: What I want to do in the first one is generalise the following statement: expand<-expand.grid(1:x[1],1:x[2],...1:x[n]) where x is a vector of integers and expand.grid gives every combination of the set of numbers, so for example, expand.grid(1:2, 1:3) takes 1,2 and 1,2,3 and gives 1,1 2,1 1,2 2,2 1,3 2,3 My x
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.
1998 Oct 22
1
crosstab means
I would like to obtain a crosstabulation of means(var, quantiles...) i.e. I have a data frame with Var-i, Var-j, Var-k, Var-X, var-Y I like to have the mean of Var-X for each combination of Var-i,Var-j. One solution would be: by(var-i,Var-j,mean(Var-x)) but I would like it better formatted and with mean,S.Dev,n for each cell? Does anybody have some function to do this or some ideas how to go
2006 Oct 27
1
Using data and subset arguments in user-defined functions
Dear list, A while ago, I posted a question asking how to use data or subset arguments in a user-defined function. Duncan Murdoch suggested the following solution in the context of a data argument: data <- data.frame(a=c(1:10),b=c(1:10)) eg.fn <- function(expr, data) { x <- eval(substitute(expr), envir=data) return(mean(x)) } eg.fn(a,data) I've
2009 Jun 22
1
nls vs nlme: parameter constraints
Hello list, I'm trying to fit a model like beta[trt]/(1+alpha*x) where the data include some grouping factor. The problem is that the estimate for alpha is undefined for some of the treatments - any value greater than 20 is equally good and a step function would suffice. Ignoring the grouping structure, I can fit this using nls with the port algorithm by restricting the upper value of alpha
2002 May 23
2
crosstabulation of means
Hello, I am trying to print a crosttabulation of mean,sd,n for a continuous variable crossclassified by anoother/s grouping variables. I came up with: xtab2 <- function(x,g1,g2) { funy <- function(z) list(mean(z,na.rm=T),sd(z,na.rm=T),length(z)) aa <- by(x,list(g1,g2),funy) bb <- matrix(unlist(aa),nrow=3 ,dimnames=list(c("mean","sd","n"),
2006 Oct 08
1
Simulate p-value in lme4
Dear r-helpers, Spencer Graves and Manual Morales proposed the following methods to simulate p-values in lme4: ************preliminary************ require(lme4) require(MASS) summary(glm(y ~ lbase*trt + lage + V4, family = poisson, data = epil), cor = FALSE) epil2 <- epil[epil$period == 1, ] epil2["period"] <- rep(0, 59); epil2["y"] <- epil2["base"]
2009 Feb 24
1
COSTA RICA - E1
Does any have experience with E1 telephony support plus asterisk in costa rica ? Regards, Luis Morales -- --------------------------------------------------------------------------------- Luis Morales Consultor de Tecnologia Cel: +(58)416-4242091 --------------------------------------------------------------------------------- "Empieza por hacer lo necesario, luego lo que es posible... y
2008 Feb 15
12
Transfer Crosstable to Word-Document
# Dear list, # I am an R-beginner and # spent the last days looking for a method to insert tables produced # with R into a word document. I thought about SPPS: copy a table from # an SPO-file and paste it into a word document # (if needed do some formatting with that table). # Annother idea was, to produce a TEX-file, # insert it and make it a word-table. # I found the following libraries, which
2013 Oct 05
2
mejora estética del resultado de una función
Muchas gracias por la rapidez en la respuesta. Funciona perfectamente. El 05/10/2013 10:09, Carlos Ortega escribió: > Hola, > Es un problema de "cat()". > Mira esta alternativa: > > foo > x2 > for(i in 1:length(x)){ > #print(cat("El cuadrado de",x[i],"es ", x2[i],"n")) > print(paste("El cuadrado de