{"size":{"Width":646,"Height":201},"appearance":{"background":null,"padding":14,"font":{"family":"Courier New","size":10.0,"bold":false,"italic":false,"underline":false,"strikeout":false,"color":"rgb(0,72,168)"},"border":{"on":true,"size":0.0,"style":"solid","color":"#666"},"text":{"wrap":false,"hAlign":"left","vAlign":"top"}},"outputType":"WIDGET","widgetState":null,"outputs":{"console":"<pre class='debug-source'>>library(flipData)\n</pre>\n<pre class='debug-source'>>library(flipFormat)\n</pre>\n<pre class='debug-source'>>library(flipTransformations)\n</pre>\n<pre class='debug-source'>>library(survey)\n</pre>\n<pre class='debug-message'>Loading required package: grid\n</pre>\n<pre class='debug-message'>Loading required package: Matrix\n</pre>\n<pre class='debug-message'>Loading required package: survival\n</pre>\n<pre class='debug-message'>\nAttaching package: 'survey'\n\n</pre>\n<pre class='debug-message'>The following object is masked from 'package:graphics':\n\n dotchart\n\n</pre>\n<pre class='debug-source'>>dat.raw <- ProcessQVariables(data.frame(var1 = formVariable1, var2 = formVariable2, stringsAsFactors=FALSE))\n</pre>\n<pre class='debug-source'>>dat <- dat.raw[QFilter, ]\n</pre>\n<pre class='debug-source'>>dat$var1 <- factor(dat$var1)\n</pre>\n<pre class='debug-source'>>dat$var2 <- factor(dat$var2)\n</pre>\n<pre class='debug-source'>> \n</pre>\n<pre class='debug-source'>>if (is.null(QCalibratedWeight)) {\n s <- summary(xtabs(~ var1 + var2, dat))\n statistic.value <- s$statistic\n df <- s$parameter\n p.value <- s$p.value\n statistic.name <- "Chi-square"\n} else {\n wgt <- QCalibratedWeight[QFilter]\n design <- WeightedSurveyDesign(dat, wgt)\n tryCatch(test <- svychisq(~ var1 + var2, design, statistic = "F"),\n error = function(e) {\n if (grepl("system is computationally singular", e))\n stop(paste("A weighted chi-square test could not be run using the selected variables.",\n "Consider merging categories or removing the weight variable."))\n else\n stop(e)\n })\n statistic.value <- test$statistic\n df <- test$parameter[1]\n p.value <- test$p.value\n statistic.name <- "F"\n}\n</pre>\n<pre class='debug-source'>>decimal.places <- if (formDecimals) 8 else NULL\n</pre>\n<pre class='debug-source'>>chi.sq.test <- list(statistic = statistic.value, df = df, p.value = p.value)\n</pre>\n<pre class='debug-source'>>SignificanceTest(chi.sq.test, "Chi-Square Test of Independence", dat.raw, filter = QFilter,\n show.labels = !formNames, decimal.places = decimal.places)\n</pre>\r\n<div class=\"debug-summarystatistics\"><table>\r\n<tr><th>Started:</th><td class=utc-time>2018-08-28T06:13:57.469Z</td></tr>\r\n<tr><th>Finished:</th><td class=utc-time>2018-08-28T06:13:59.469Z</td></tr>\r\n<tr><th>Total time:</th><td>2.31s</td></tr>\r\n<tr><th>Time executing code:</th><td title=\"0.06s\">2.25s</td></tr>\r\n<tr><th>Other overhead on R server:</th><td>2.05s</td></tr>\r\n<tr><th>Time spent transferring data:</th><td>0.06s</td></tr>\r\n<tr><th>Data sent to R server:</th><td>4.1KB</td></tr>\r\n<tr><th>Data received from R server:</th><td>8.6KB</td></tr>\r\n</table></div>","message":"Loading required package: grid\n\r\nLoading required package: Matrix\n\r\nLoading required package: survival\n\r\n\nAttaching package: 'survey'\n\n\r\nThe following object is masked from 'package:graphics':\n\n dotchart\n\n","htmlwidgets":"<div id=\"htmlwidget_container\">\n <div id=\"htmlwidget-2cae5811e78ac614139b\" class=\"formattable_widget html-widget\" style=\"width:100%;height:500px;\" width=\"100%\" height=\"500\"></div>\n</div>\n<script type=\"application/json\" data-for=\"htmlwidget-2cae5811e78ac614139b\">{\"x\":{\"html\":\"<table class = \\\"table table-condensed\\\"style = \\\"margin:0; border-bottom: 2px solid; border-top: 2px solid; font-size:90%;\\\">\\n<h3 class=\\\".h3\\\" style=\\\"color:#3E7DCC; text-align:left; margin-top:0px; margin-bottom:0\\\">Chi-Square Test of Independence<\\/h3>\\n<h4 class=\\\".h4\\\" style=\\\"color:#3E7DCC; text-align:left; margin-top:5px; margin-bottom:0\\\">Significant: p-value < 0.000000000001<\\/h4>\\n<h5 class=\\\".h5\\\" style=\\\"color:#888888; text-align:left; margin-top:5px; margin-bottom:0\\\">Q6. Brand preference: Coca Cola (Don t Know, Hate, Dislike, Neither like nor dislike, Like, Love)<\\/h5>\\n<h5 class=\\\".h5\\\" style=\\\"color:#888888; text-align:left; margin-top:5px; margin-bottom:0\\\">by Q6. Brand preference: Diet Coke (Don t Know, Hate, Dislike, Neither like nor dislike, Like, Love)<\\/h5>\\n<caption style=\\\"caption-side:bottom;font-style:italic; font-size:90%;\\\">n = 327 cases used in estimation; null hypothesis: variables are independent;<\\/caption>\\n <thead>\\n <tr>\\n <th style=\\\"text-align:right;\\\"> Chi-square <\\/th>\\n <th style=\\\"text-align:right;\\\"> Degrees of freedom <\\/th>\\n <th style=\\\"text-align:right;\\\"> p-value <\\/th>\\n <\\/tr>\\n <\\/thead>\\n<tbody>\\n <tr>\\n <td style=\\\"text-align:right;\\\"> 142.63 <\\/td>\\n <td style=\\\"text-align:right;\\\"> 25 <\\/td>\\n <td style=\\\"text-align:right;\\\"> < 0.000000000001 <\\/td>\\n <\\/tr>\\n<\\/tbody>\\n<\\/table>\"},\"evals\":[],\"jsHooks\":[]}</script>\n<script type=\"application/htmlwidget-sizing\" data-for=\"htmlwidget-2cae5811e78ac614139b\">{\"viewer\":{\"width\":\"100%\",\"height\":350,\"padding\":15,\"fill\":false},\"browser\":{\"width\":\"100%\",\"height\":500,\"padding\":0,\"fill\":false}}</script>","htmlwidget-head":"{\"stylesheets\":[\"https://rserverhtmlwidgetasset.azureedge.net/bootstrap.min-63e52244789ab8f6e3a78818886e7085.css\"],\"javascript\":[\"https://rserverhtmlwidgetasset.azureedge.net/jquery.min-91a24ea414e8c447d647cecab86866c2.js\",\"https://rserverhtmlwidgetasset.azureedge.net/bootstrap.min-326d184c3c13feede563e4adcb5ff2a0.js\",\"https://rserverhtmlwidgetasset.azureedge.net/html5shiv.min-e70767555a95c48c08833356d362ccef.js\",\"https://rserverhtmlwidgetasset.azureedge.net/respond.min-4255ee1a060b15cb2432d0a497a6d510.js\",\"https://rserverhtmlwidgetasset.azureedge.net/htmlwidgets-917a66c6e5036eb1bfd1fb672a82635a.js\",\"https://rserverhtmlwidgetasset.azureedge.net/formattable_widget-d2927ec9dec4a568bd3f4a62041c0ddb.js\"],\"attachments\":[],\"widget-cannot-re-render\":true}","warning":""},"secondsTaken":2.3101051999999997,"updated":"2018-08-28T06:13:59.4694499Z","lastUpdatedMessage":null,"executedCode":"library(flipData)\nlibrary(flipFormat)\nlibrary(flipTransformations)\nlibrary(survey)\ndat.raw <- ProcessQVariables(data.frame(var1 = formVariable1, var2 = formVariable2, stringsAsFactors=FALSE))\ndat <- dat.raw[QFilter, ]\ndat$var1 <- factor(dat$var1)\ndat$var2 <- factor(dat$var2)\n \nif (is.null(QCalibratedWeight)) {\n s <- summary(xtabs(~ var1 + var2, dat))\n statistic.value <- s$statistic\n df <- s$parameter\n p.value <- s$p.value\n statistic.name <- \"Chi-square\"\n} else {\n wgt <- QCalibratedWeight[QFilter]\n design <- WeightedSurveyDesign(dat, wgt)\n tryCatch(test <- svychisq(~ var1 + var2, design, statistic = \"F\"),\n error = function(e) {\n if (grepl(\"system is computationally singular\", e))\n stop(paste(\"A weighted chi-square test could not be run using the selected variables.\",\n \"Consider merging categories or removing the weight variable.\"))\n else\n stop(e)\n })\n statistic.value <- test$statistic\n df <- test$parameter[1]\n p.value <- test$p.value\n statistic.name <- \"F\"\n}\ndecimal.places <- if (formDecimals) 8 else NULL\nchi.sq.test <- list(statistic = statistic.value, df = df, p.value = p.value)\nSignificanceTest(chi.sq.test, \"Chi-Square Test of Independence\", dat.raw, filter = QFilter,\n show.labels = !formNames, decimal.places = decimal.places)","lastSavedCode":"library(flipData)\nlibrary(flipFormat)\nlibrary(flipTransformations)\nlibrary(survey)\ndat.raw <- ProcessQVariables(data.frame(var1 = formVariable1, var2 = formVariable2, stringsAsFactors=FALSE))\ndat <- dat.raw[QFilter, ]\ndat$var1 <- factor(dat$var1)\ndat$var2 <- factor(dat$var2)\n \nif (is.null(QCalibratedWeight)) {\n s <- summary(xtabs(~ var1 + var2, dat))\n statistic.value <- s$statistic\n df <- s$parameter\n p.value <- s$p.value\n statistic.name <- \"Chi-square\"\n} else {\n wgt <- QCalibratedWeight[QFilter]\n design <- WeightedSurveyDesign(dat, wgt)\n tryCatch(test <- svychisq(~ var1 + var2, design, statistic = \"F\"),\n error = function(e) {\n if (grepl(\"system is computationally singular\", e))\n stop(paste(\"A weighted chi-square test could not be run using the selected variables.\",\n \"Consider merging categories or removing the weight variable.\"))\n else\n stop(e)\n })\n statistic.value <- test$statistic\n df <- test$parameter[1]\n p.value <- test$p.value\n statistic.name <- \"F\"\n}\ndecimal.places <- if (formDecimals) 8 else NULL\nchi.sq.test <- list(statistic = statistic.value, df = df, p.value = p.value)\nSignificanceTest(chi.sq.test, \"Chi-Square Test of Independence\", dat.raw, filter = QFilter,\n show.labels = !formNames, decimal.places = decimal.places)","highlightedCodeSpans":[{"start":130,"length":13,"index":4},{"start":152,"length":13,"index":4},{"start":207,"length":7,"index":6},{"start":290,"length":17,"index":6},{"start":493,"length":17,"index":6},{"start":511,"length":7,"index":6},{"start":1157,"length":12,"index":4},{"start":1343,"length":7,"index":6},{"start":1388,"length":9,"index":4}],"tableTransformations":"<TabularTransformer>\r\n <TabularTransform type=\"Truncation\" truncationHeaderType=\"Column\" />\r\n <TabularTransform />\r\n</TabularTransformer>","tabularFilteringOptions":null,"hasGuiControls":true,"guiControls":{"Code":"form.setHeading(\"Chi-Square Test of Independence\");\nform.dropBox({label: \"Variable 1\",\n types:[\"Variable: Numeric, Categorical, OrderedCategorical, Text, Date, Money\"],\n name: \"formVariable1\"});\nform.dropBox({label: \"Variable 2\",\n types:[\"Variable: Numeric, Categorical, OrderedCategorical, Text, Date, Money\"],\n name: \"formVariable2\"});\nform.checkBox({label: \"Variable names\", name: \"formNames\", default_value: false});\nform.checkBox({label: \"More decimal places\", name: \"formDecimals\", default_value: false});","JSError":null,"JSErrorDetails":null,"ControlDefinitionErrors":null,"InputValidationErrors":null,"Controls":[{"ItemGuid":"00000000-0000-0000-0000-000000000000","ControlName":null,"Page":null,"Group":null,"Type":"Heading","Label":null,"LabelEmphasised":false,"Value":null,"Allowed":null,"Multi":false,"Prompt":null,"ErrorMessage":null,"Invalid":null,"Required":false,"AllowedTypes":null,"OwnerRItemGuid":null,"MinInputs":0,"MaxInputs":0,"Height":0,"Duplicates":false,"Values":null,"CheckAlign":null,"Text":"Chi-Square Test of Independence","Increment":0.0,"Min":0.0,"Max":0.0,"Vertical":null},{"ItemGuid":"00000000-0000-0000-0000-000000000000","ControlName":"formVariable1","Page":null,"Group":null,"Type":"DropBox","Label":"Variable 1","LabelEmphasised":false,"Value":"19b0bad8-a674-4087-92f9-212c36f485bb","Allowed":null,"Multi":false,"Prompt":"Select an input which is of type Variable (Numeric, Categorical, Orderedcategorical, Text, Date or Money).","ErrorMessage":"Variable 1: Variable 1 accepts only one input which is of type Variable (Numeric, Categorical, Orderedcategorical, Text, Date or Money).","Invalid":null,"Required":true,"AllowedTypes":["Variable: Numeric, Categorical, OrderedCategorical, Text, Date, Money"],"OwnerRItemGuid":"fea790d8-49b9-4f30-afd5-d0acba6c4636","MinInputs":1,"MaxInputs":1,"Height":1,"Duplicates":false,"Values":null,"CheckAlign":null,"Text":null,"Increment":0.0,"Min":0.0,"Max":0.0,"Vertical":null},{"ItemGuid":"00000000-0000-0000-0000-000000000000","ControlName":"formVariable2","Page":null,"Group":null,"Type":"DropBox","Label":"Variable 2","LabelEmphasised":false,"Value":"89d4cd6e-5047-48df-a9dc-de0a82ab6eea","Allowed":null,"Multi":false,"Prompt":"Select an input which is of type Variable (Numeric, Categorical, Orderedcategorical, Text, Date or Money).","ErrorMessage":"Variable 2: Variable 2 accepts only one input which is of type Variable (Numeric, Categorical, Orderedcategorical, Text, Date or Money).","Invalid":null,"Required":true,"AllowedTypes":["Variable: Numeric, Categorical, OrderedCategorical, Text, Date, Money"],"OwnerRItemGuid":"fea790d8-49b9-4f30-afd5-d0acba6c4636","MinInputs":1,"MaxInputs":1,"Height":1,"Duplicates":false,"Values":null,"CheckAlign":null,"Text":null,"Increment":0.0,"Min":0.0,"Max":0.0,"Vertical":null},{"ItemGuid":"00000000-0000-0000-0000-000000000000","ControlName":"formNames","Page":null,"Group":null,"Type":"CheckBox","Label":"Variable names","LabelEmphasised":false,"Value":false,"Allowed":null,"Multi":false,"Prompt":null,"ErrorMessage":null,"Invalid":null,"Required":false,"AllowedTypes":null,"OwnerRItemGuid":null,"MinInputs":0,"MaxInputs":0,"Height":0,"Duplicates":false,"Values":null,"CheckAlign":"left","Text":null,"Increment":0.0,"Min":0.0,"Max":0.0,"Vertical":null},{"ItemGuid":"00000000-0000-0000-0000-000000000000","ControlName":"formDecimals","Page":null,"Group":null,"Type":"CheckBox","Label":"More decimal places","LabelEmphasised":false,"Value":false,"Allowed":null,"Multi":false,"Prompt":null,"ErrorMessage":null,"Invalid":null,"Required":false,"AllowedTypes":null,"OwnerRItemGuid":null,"MinInputs":0,"MaxInputs":0,"Height":0,"Duplicates":false,"Values":null,"CheckAlign":"left","Text":null,"Increment":0.0,"Min":0.0,"Max":0.0,"Vertical":null},{"ItemGuid":"00000000-0000-0000-0000-000000000000","ControlName":null,"Page":null,"Group":null,"Type":null,"Label":null,"LabelEmphasised":false,"Value":null,"Allowed":null,"Multi":false,"Prompt":null,"ErrorMessage":null,"Invalid":null,"Required":false,"AllowedTypes":null,"OwnerRItemGuid":null,"MinInputs":0,"MaxInputs":0,"Height":0,"Duplicates":false,"Values":null,"CheckAlign":null,"Text":null,"Increment":0.0,"Min":0.0,"Max":0.0,"Vertical":true}]},"calculating":"Idle","showDebug":false,"layout":"OutputOnly","vSplit":0.25,"hSplit":0.45,"updateWarnings":true,"updateMode":"Manual","warnSlow":false,"Options":{"debugconsole":false,"codeposition":"OutputOnly","splitH":0.45,"splitV":0.25,"update warnings":true,"updating":"Manual","warn slow":false}}