SparklyR error Error in if (n > 0) c(NA_integer_, -n) else integer(): missing value where TRUE/FALSE needed

Hi all, I am new to using sparklyr. A simple example of the code I am using is as per below:

library(dplyr)
data(iris)
sdf = sdf_copy_to(sc, iris, overwrite=TRUE)

In the example above the iris table loads correctly onto the spark cluster. However whenever I try to execute head(sdf) I receive the following error:

Error in if (n > 0) c(NA_integer_, -n) else integer():
missing value where TRUE/FALSE needed

What can I do to rectify the problem?
Thanks