0

I am trying to implement the code from this link:

http://rcompanion.org/handbook/H_09.html

specifically the code for this example: "Example of extended Cochran–Armitage test 1"

The problem is I am trying to read in a csv file containing the data for the "Input" table. The csv table is the same as the table in the sample code, i.e. enter image description here

I then proceed to write the following code myself in R;

> library(readr)
> rtestdata <- read_csv("C:/Users/Rayyan/Desktop/rtestdata.csv")
> View(rtestdata)
> a<-ftable(rtestdata)
> 
> sum (a)
[1] 3
> prop.table(a,
+            margin = 1)   ### proportion in each row

the resulting prop.table looks nothing like the one on the website, here is what it looks like: enter image description here

Can you please help me with this? Thanks

Ray92
  • 439
  • 6
  • 18
  • Is there a particular reason you want to read the data in as a CSV? The example you linked provides a working `Input` table object. – Raoul Duke Apr 17 '19 at 15:43
  • You can share sample data with `dput(head(Ryan's data,12))`. – NelsonGon Apr 17 '19 at 15:43
  • Because I am unable to get the code running as it is, when i copy paste the "input" table and execute the next line of code, an error is thrown – Ray92 Apr 17 '19 at 16:03

0 Answers0