user3201733
user3201733

Reputation: 27

error message could not find function "paste0" –

I am getting an error message when I execute the below code

datacfs_date$FeedbackMonth <- paste0(year(datacfs_date$FeedbackDate),
                                     "-M", month(da‌​tacfs_date$FeedbackDate)) 

Error in eval.with.vis(expr, envir, enclos) : could not find function "paste0".

Do I need to import some package? Kindly assist

Upvotes: 0

Views: 6528

Answers (1)

Andrie
Andrie

Reputation: 179558

The function paste0() was introduced in R version 2.15.0 - so your easiest option is to upgrade your version.

Otherwise use the original paste(), like this:

paste(year(datacfs_date$FeedbackDate), "-M", month(da‌​tacfs_date$FeedbackDate),
      sep="")

As Richie Cotton points out, you can also define your own paste0 function:

paste0 <- function(..., collapse = NULL) {
    paste(..., sep = "", collapse = collapse)
}

Upvotes: 3

Related Questions