R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list('A','C','B','D','A','D','D','A','A','B','D','C','B','A','D','A','A','C','B','A','D','A','D','A','B','A','D','A','C','C','B','A','A','B','A','D','B','A','B','B','B','D','B','A','D','A','B','A','B','C','B','D','B','C','C','C','A','D','A','D','A','C','B','B','C','C','D','A','B','D','B','A','B','B','A','A','D','A','B','A','D','A','B','C','C','B','B','D','A','A','B','B','B','B','A','C','A','B','D','B','D','C','D','A','A','B','C','A','A','D','D','B','D','A','C','A','C','A','B','A','A','C','C','D','D','A','C','A'),dim=c(2,64),dimnames=list(c('Happiness','Depression'),1:64)) > y <- array(NA,dim=c(2,64),dimnames=list(c('Happiness','Depression'),1:64)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } There were 50 or more warnings (use warnings() to see the first 50) > par3 = 'Pearson Chi-Squared' > par2 = 'Depression' > par1 = 'Happiness' > main = 'Happiness VS Depression' > par3 <- 'Pearson Chi-Squared' > par2 <- 'Depression' > par1 <- 'Happiness' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Dr. Ian E. Holliday > #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: > #Technical description: > library(vcd) Loading required package: MASS Loading required package: grid Loading required package: colorspace > cat1 <- as.numeric(par1) # Warning message: NAs introduced by coercion > cat2<- as.numeric(par2) # Warning message: NAs introduced by coercion > simulate.p.value=FALSE > if (par3 == 'Exact Pearson Chi-Squared by Simulation') simulate.p.value=TRUE > x <- t(x) > (z <- array(unlist(x),dim=c(length(x[,1]),length(x[1,])))) [,1] [,2] [1,] "A" "C" [2,] "B" "D" [3,] "A" "D" [4,] "D" "A" [5,] "A" "B" [6,] "D" "C" [7,] "B" "A" [8,] "D" "A" [9,] "A" "C" [10,] "B" "A" [11,] "D" "A" [12,] "D" "A" [13,] "B" "A" [14,] "D" "A" [15,] "C" "C" [16,] "B" "A" [17,] "A" "B" [18,] "A" "D" [19,] "B" "A" [20,] "B" "B" [21,] "B" "D" [22,] "B" "A" [23,] "D" "A" [24,] "B" "A" [25,] "B" "C" [26,] "B" "D" [27,] "B" "C" [28,] "C" "C" [29,] "A" "D" [30,] "A" "D" [31,] "A" "C" [32,] "B" "B" [33,] "C" "C" [34,] "D" "A" [35,] "B" "D" [36,] "B" "A" [37,] "B" "B" [38,] "A" "A" [39,] "D" "A" [40,] "B" "A" [41,] "D" "A" [42,] "B" "C" [43,] "C" "B" [44,] "B" "D" [45,] "A" "A" [46,] "B" "B" [47,] "B" "B" [48,] "A" "C" [49,] "A" "B" [50,] "D" "B" [51,] "D" "C" [52,] "D" "A" [53,] "A" "B" [54,] "C" "A" [55,] "A" "D" [56,] "D" "B" [57,] "D" "A" [58,] "C" "A" [59,] "C" "A" [60,] "B" "A" [61,] "A" "C" [62,] "C" "D" [63,] "D" "A" [64,] "C" "A" > (table1 <- table(z[,cat1],z[,cat2])) <0 x 0 matrix> > (V1<-dimnames(y)[[1]][cat1]) [1] NA > (V2<-dimnames(y)[[1]][cat2]) [1] NA > postscript(file="/var/wessaorg/rcomp/tmp/15u2h1352797878.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > assoc(ftable(z[,cat1],z[,cat2],row.vars=1,dnn=c(V1,V2)),shade=T) Error in loglin(x, expected, fit = TRUE, print = FALSE) : incorrect specification of 'table' or 'start' Calls: assoc -> assoc.default -> strucplot -> loglin Execution halted