search for: tbl1

Displaying 8 results from an estimated 8 matches for "tbl1".

Did you mean: tbl
2018 Feb 03
2
find unique and summerize
Thank you so much Rui. 1. How do I export this table to excel file? I used this tbl1 <- table(Country, IDNum) tbl2=addmargins(tbl1) write.xlsx(tbl2,"tt1.xlsx"),sheetName="summary", row.names=FALSE) The above did not give me that table. 2. I want select those unique Ids that do have records in all countries. From the above data set, this ID &qu...
2018 Feb 05
0
find unique and summerize
...po.pt >> <mailto:ruipbarradas at sapo.pt>> wrote: >> >> Hello, >> >> As for the first question, instead of writing a xlsx file, maybe it >> is easier to write a csv file and then open it with Excel. >> >> tbl2 <- addmargins(tbl1) >> write.csv(tbl2, "tt1.csv") >> >> As for the second question, the following does it. >> >> inx <- apply(tbl1, 1, function(x) all(x != 0)) >> tbl1b <- addmargins(tbl1[inx, ]) >> tbl1b >> >> >> Hope...
2012 May 31
1
svychisq??
...atrix(c(am18$M1_3_ESTRATO),ncol=1) e<-matrix(c(rep(0.078,315)),ncol=1) Muestra.comp<-svydesign(id=~b,strata =~d,nest=TRUE,weights=~c,data=am18, fpc=~e) ocupacion <-matrix(c(am18$M1_19_OCUPACIONPRINCIPALACTUAL),ncol=1) APES<-matrix(c(am18$M3_11_AUTOPERCEPCIONSALUDGENERAL),ncol=1) tbl1<-svytable(~ocupacion+APES,Muestra.comp) summary(tbl1, statistic="Chisq") Error en `[.data.frame`(design$variables, , as.character(rows)) : undefined columns selected when I call am18 at the end says it is a data.frame (to.data.frame = TRUE)) and by that I aprace erro...
2018 Feb 03
0
find unique and summerize
Hello, Thanks for the reproducible example. See if the following does what you want. IDNum <- sub("^(\\d+).*", "\\1", mydata$ID) Country <- sub("^\\d+(.*)", "\\1", mydata$ID) tbl1 <- table(Country, IDNum) addmargins(tbl1) tbl2 <- xtabs(Y ~ Country + IDNum, mydata) addmargins(tbl2) Hope this helps, Rui Barradas On 2/3/2018 3:00 AM, Val wrote: > Hi all, > > I have a data set need to be summarized by unique ID (count and sum of a > variable) > A uniq...
2018 Feb 03
2
find unique and summerize
Hi all, I have a data set need to be summarized by unique ID (count and sum of a variable) A unique individual ID (country name Abbreviation followed by an integer numbers) may have observation in several countries. Then the ID was changed by adding the country code as a prefix and new ID was constructed or recorded like (country code, + the original unique ID Example original ID
2006 Nov 09
1
Discriminant Analysis- Apparent error rate
...the misclasification rate of an estimated discrimated function (hyDA) hyDA <- with(hyB, lda(Maturity ~ Length + Weight)) , so here is what I do (code from S-plus 6.1 Guide to Statistics Vol. 2 p 101) test <- predict(hyDA) tbl <- table(hyB$Maturity, test$class) tbl <- tbl[-2,-2] tbl1 <- cbind(tbl, error = (apply(tbl, 1, sum) - diag(tbl)) / hyDA$counts) sum(hyDA$prior * tbl1[,'error']) The error rates I get is 0.57 which is very large I was wondering if I'm doing something wrong. Thanks in advance. > version _ plat...
2009 Jul 28
4
How to do poisson distribution test like this?
Dear R-listers, I want to reperfrom a poisson distribution test that presented in a recent-published biological research paper (Plant Physiology 2008, vol 148, pp. 1189-1200). That test is about the occurrence number of a kind of gene in separate chromosomes. For instance: The observed gene number in chromosome A is 36. The expected gene number in chromosome A is 30. Then, the authors got a
2013 Apr 06
2
manipulating R contingency tables
Hi Guys I am back with another thing that's puzzling me. I am creating contingency tables but then I want to filter out certain columns and also find if any entry in the table is 0. Example: gts labels A1 B2 G3 1 21 127 120 2 23 112 0 Here I want to remove B2 column from this table and also if any entry is 0 in this case G3 second row. Missing out on how to do