Hi guys I'm hoping someone can help me with this.  It should be easy but it 
seems to get stuck for no obvious reason!  I am trying to set a report up in 
odfWeave so that we can re-run the same analysis at 3 time points as the data 
matures and provide an 'instant' report.

To simplify the situation we have two pieces of data: site_id (numerical value 
1-9) and reaction (categorical Y or N).

mydata=""
mydata$site_id = rep(1:9, 15)
mydata$reaction = rep(c("Y","N","N","Y","N"),27)

until now I've simply used the command:

with (mydata, table (site_id, reaction))

to give me a 'table' that looks like this:

       reaction
site_id N Y
      1 9 6
      2 9 6
      3 9 6
...
      7 9 6
      8 9 6
      9 9 6

I can pass that as plain text to odf, but I want to make it a properly 
formatted table.

Executing odfTable(with (mydata, table (site_id, reaction)))  results in: Error 
in UseMethod("odfTable") : no applicable method for "odfTable", which I assume 
is because the output of table is not a dataframe, vector or matrix which is 
what odfTable needs.  So I got more creative - but nothing is working they way 
I want it :-(

odfTable(
  as.vector (
     with (mydata, table (site_id, reaction))
 )
)
Produces a table with 9 9's and 9 6's in a vertical column...

odfTable(
  as.data.frame (
     with (mydata, table (site_id, reaction))
 )
)

Doesn't error but produces a table similar to this:
   site_id reaction Freq
1        1        N    9
2        2        N    9
3        3        N    9
4        4        N    9
...
15       6        Y    6
16       7        Y    6
17       8        Y    6
18       9        Y    6

Both of the above are how they appear at the command prompt so not odfWeave 
doing anything wrong...

odfTable(
  as.matrix (
     with (mydata, table (site_id, reaction))
 )
)

At the command prompt this looks the same as the original output so looks like 
it might work!  BUT  odfWeave complains Error in UseMethod("odfTable") : no 
applicable method for "odfTable"  -- but its a matrix and odfWeave is supposed 
to be able to handle matrices?  Anyone got any suggestions?

********************************************************************************************************************

This message may contain confidential information. If yo...{{dropped:21}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  • [R] Cont... Polwart Calum (County Durham and Darlington NHS Foundation Trust)
    • Re:... Polwart Calum (County Durham and Darlington NHS Foundation Trust)

Reply via email to