[R] Using a mock of an S4 class

Ramiro Barrantes ramiro at precisionbioassay.com
Wed Feb 1 20:46:31 CET 2017


I have a function that applies to an S4 object which contains a slot called @analysis:

function calculation(myObject) {
  tmp <- myObjects at analysis
  result <- ...operations on analysis...
  return result

I am writing a unit test for this function.  So I was hoping to create a mock object but I can't figure out how to do it:

test_that("test calculation function", {
  mockMyObject<- mock(?????)  #I am not sure what to put here

How can I create a mock S4 object??

Thanks in advance,

	[[alternative HTML version deleted]]

More information about the R-help mailing list