Including a table in an rMarkdown powerpoint

Hi all, I am trying to use the kable() function to include a table of my data in a powerpoint presentation. I keep getting the following error:
Error in as.data.frame.default(x) :
cannot coerce class '"function"' to a data.frame
Calls: ... eval -> kable -> as.data.frame -> as.data.frame.default
Execution halted

the code where the error occurs is as follows:

kable(data, format='simple')

and the code I used to form the data is as follows:
withdraw <- c(1,0,0,1,1,1,0,0,1,0)
tolerance <- c(0,1,1,0,0,1,0,1,1,0)
failureStop <- c(0,1,1,0,0,1,1,0,0,1)
riskyBehavior <- c(1,0,0,0,0,1,1,1,0,1)
diagnosis <- rep(0,10)

data <- data.frame(withdraw, tolerance, failureStop, riskyBehavior,diagnosis)

When I type 'class(data)' into the console, I get that the class is in fact a data.frame so I'm really not sure why this isn't working. Anything would be appreciated. Thanks.

Give your data.frame another name e.g. df1 .
I think you will find the error sooner that way.
( of course you are allowed to call it data
but because that is also the name of a function
this can be confusing)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.