search for: haireyecolor

Displaying 20 results from an estimated 32 matches for "haireyecolor".

2002 Jan 30
1
mosaicplot(formula, data)--- bugged?
...ike to extend mosaicplot to work with loglin and logln (MASS) objects. I'm using R 1.4.0 on Win 98. I've been trying to figure out the formula interface, and think there's a bug, but not sure how to find it, yet alone fix it. It seems to only work with independence models: > data(HairEyeColor) > mosaicplot(~ Hair + Eye + Sex, data=HairEyeColor) > mosaicplot(~ Hair * Eye + Sex, data=HairEyeColor) Error in aperm(a, perm, resize) : `perm' is of wrong length here's a traceback: > debug(mosaicplot) > mosaicplot(~Hair + Eye + Sex + Hair:Eye, data=HairEyeColor) debugging...
2013 Aug 18
1
How does R_UnboundValue and removing variables work?
...E > x <-5; local({x <- 6; x <- unbound_value(); exists("x", inherits=FALSE)}) [1] TRUE > x <-5; local({x <- 6; x <- vadr:::unbound_value(); x}) [1] 5 but assigning unbound on the global namespace blocks name lookup from going up the search path: > find("HairEyeColor") [1] "package:datasets" > HairEyeColor <- unbound_value() > class(HairEyeColor) Error: object 'HairEyeColor' not found > rm("HairEyeColor") > class(HairEyeColor) [1] "table" I've been looking through the source in envir.c but I haven...
2002 Feb 08
2
bugs or imperfect implementation?
...in the whole word "package" I'll get an error in 1.4.0. For example, data(cats,package=MASS) works fine but data(cats,pac=MASS) doesn't. 2. drop1 doesn't seem to be as smart as before. In the sequence below, drop1 didn't produce what I expected it to produce. data(HairEyeColor); lab<-dimnames(HairEyeColor) HairEye<-cbind(expand.grid(Hair=lab$Hair,Eye=lab$Eye, Sex=lab$Sex),Fr=as.vector(HairEyeColor)) HairEye.fit<-glm(Fr~.^2,poisson,HairEye) drop1(HairEye.fit) The following sequence however works. HairEye.fit<-glm(Fr~(Hair+Eye+Sex)^2,p...
2008 Sep 26
2
adjusting textsize and spacing in mosaic (vcd package)
I'm trying to find a way to change the font size in a mosaic plot (the grid version, not the base graphics one). Here's an example to demonstrate: #Basic plot library(vcd) mosaic(HairEyeColor, shade = TRUE) #Bad first guess: this stops the default cell colouring, and doesn't change the font size mosaic(HairEyeColor, shade = TRUE, gp=gpar(fontsize=16)) #This successfully changes most of the text sizes, but not the numbers on the legend scale mosaic(HairEyeColor, shade = TRUE,...
2008 Nov 16
3
chisq.test with simulate.p.value=TRUE (PR#13292)
Full_Name: Reginaldo Constantino Version: 2.8.0 OS: Ubuntu Hardy (32 bit, kernel 2.6.24) Submission from: (NULL) (189.61.88.2) For many tables, chisq.test with simulate.p.value=TRUE gives a p value that is obviously incorrect and inversely proportional to the number of replicates: > data(HairEyeColor) > x <- margin.table(HairEyeColor, c(1, 2)) > chisq.test(x,simulate.p.value=TRUE,B=2000) Pearson's Chi-squared test with simulated p-value (based on 2000 replicates) data: x X-squared = 138.2898, df = NA, p-value = 0.0004998 > chisq.test(x,simulate.p.value=TRUE,B=1...
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,...
2010 Oct 03
1
plyr: a*ply with functions that return matrices-- possible bug in aaply?
...else { require(plyr) result <- aaply(f, stratum, fun2way) ## order of dimensions screwed up! } result } For example, by hand (or with a loop) I can calculate the pieces and combine them as I want using abind(): > # apply separately to strata > t1<-fun2way(HairEyeColor[,,1]) > t2<-fun2way(HairEyeColor[,,2]) > > library(abind) > abind(t1, t2, along=3) , , 1 Brown Blue Hazel Black 32 11 10 Brown 53 50 25 Red 10 10 7 , , 2 Brown Blue Hazel Black 36 9 5 Brown 66 34 29 Red 16 7...
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 would like to make the labels on the x-axis diagonal, so I tried the following: barplot_reference<-barplot(a, beside = TRUE,...
2010 Sep 19
1
odds ratios for n-way tables: seeking an *apply-able method
...for (j in 1:(C-1)) { tab <- f[i:(i+1), j:(j+1)] res[i,j] <- OR2x2(tab, log=log) } } for (j in 1:(C-1)) { colnames(res)[j] <- paste(colnames(f)[j:(j+1)], collapse=":") } res } ### Examples > (HE <- apply(HairEyeColor, 1:2, sum)) Eye Hair Brown Blue Hazel Green Black 68 20 15 5 Brown 119 84 54 29 Red 26 17 14 14 Blond 7 94 10 16 > > OR(HE) Brown:Blue Blue:Hazel Hazel:Green Black:Brown 0.87547 -0.1542 0.4769 Brow...
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 29 Red 26 17 14 14 Blond 7 94 10 16 assoc> assoc(x) Error in unit.c(mar[4], unit(1, "null")...
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 Brown 81...
2002 Sep 13
1
[R] proposal: mosaicplot with sub and las
Two proposals for mosaicplot(): - The argument "sub" should not be ignored. Example: mosaicplot( HairEyeColor, sub = 'test of sub' ) - To be able to discern also longer axis labels the argument "las" or par(las=2) should not be ignored. Example: mosaicplot( HairEyeColor, las=2 ) Thanks Wolfram -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel m...
2001 Nov 30
1
mosaic.by(): vectorizing args passed by apply()?
...In the function below, titles is a list like: > paste("Sex: ", dimnames(Titanic)[[2]]) [1] "Sex: Male" "Sex: Female" and I want each element passed as the main= value for the corresponding slice of the table. Can someone help? Try the function below with data(HairEyeColor) mosaic.by(HairEyeColor, 3) ## Conditional mosaics, one for each level of the by-variable(s) ## -- how to add factor levels as main= ? ## -- how to do for more than one by-variable? mosaic.by <- function(table, by=NULL, ...) { n <- length(dim(table)) if(n == 0) stop(&qu...
2003 Oct 30
0
loglm() uses only a reference to data, and not data itsel f - is that on purpose??
...Message----- From: S?ren H?jsgaard [mailto:Soren.Hojsgaard at agrsci.dk] Sent: Thursday, October 30, 2003 8:10 AM To: r-help at stat.math.ethz.ch Subject: [R] loglm() uses only a reference to data, and not data itself - is that on purpose?? Dear all, Consider the following: library(MASS); data(HairEyeColor) l1 <- loglm(~ 1+2+3, data=HairEyeColor) myloglm <- function(){ nd <- HairEyeColor v <- loglm(~ 1+2+3, data=nd) return(v) } l2 <- myloglm() Now, step(l1) works, whereas step(l2) does not, the problem being that data nd does not exist outside myloglm. I was under the i...
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 Brown Male 10 4 Blond Brown Male 3 5 Black Blue Male 11 6 Brown Blue Male 50 7 Red Blue Male 10 8 Blond Blue M...
2006 Jan 10
2
reading contigency tables
Hi all, I need some help using read.ftable to read a contingency table. My columns are organized as follows: order--family--species--location--number of individuals I couldn't figure out how to change the data on my text file to be imported into R; and after you do that, is it possible to convert the table into a data frame? Any tips would be greatly appreciatted! Thanks a lot, Naiara.
2003 Dec 11
1
packaging standards for rda files?
...ated way of packaging these things. For example, how do people put in the meta information that appears in the right side of the data() output, as in: Data sets in package '.': NatAnnES2000 Data sets in package 'base': Formaldehyde Determination of Formaldehyde HairEyeColor Hair and Eye Color of Statistics Students ... Are there other attributes that I should specify if I want to package an .rda file for other users? An rda file created in this way will translate across platforms, won't it? pj -- Paul E. Johnson email: pauljo...
2004 Oct 28
3
Table question
I have a table (output from table(factor1,factor2)). I would like to use write.table to output that table to a file. However, it seems that as.data.frame converts such a table to three columns, Var1, Var2, and Freq rather than converting to the data.frame with equivalent numbers of rows and columns. I can use write.matrix from the MASS package, but then I get no rownames. Any hints here?
2009 Aug 04
4
array slice notation?
Suppose I have an n-diml array A and I want to extract the first "row" -- ie all elements A[1, ...] Interactively if I know 'n' I can write A[1,,,,,] with (n-1) commas. How do I do the same more generally, eg in a script? (I can think of doing this by converting A to a vector then extracting the approp elements then reshaping it to an array, but I wonder if there isn't a
2010 Dec 17
2
rgl: coordinating and saving viewpoints, zoom, scale for multiple images
...uivalent view of the new data/model. An example follows, but I don't know how to capture in code what I did manually to get graph 1 in the orientation, zoom and scaling to re-create in another session or another graph.... Which is why I'm asking for R-help. library(vcdExtra) HEC <- HairEyeColor[,c(1,3,4,2),] # graph 1 mosaic3d(HEC) # hand rotate, scale, then save orientation; make sure rgl window is not hidden #snapshot3d("HEC3D-1a.png", top=TRUE) M1a <- par3d("userMatrix") # try to make this reproducible, across sessions #> dput(M1a) #structure(c(0.8901187181...