Forum Discussion

hp0709's avatar
hp0709
Frequent Visitor
3 years ago

R Script Error: date_field must be a Date or POSIXt vector ('DATE' is a 'character')

Has someone come across this error. (The insert /edit code sample didnt have R lanaguage so i've pasted it below)

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

# dataset <- data.frame(#_Breaches, DATE)
# dataset <- unique(dataset)

# Paste or type your script code here:

library(NHSRplotthedots)

DATE <- as.Date(dataset$DATE)
ptd_spc(.data = dataset,value_field ="#_Breaches" , date_field = DATE , improvement_direction = "decrease")
 
I'm converting my DATE column in my dataset to date with as.Date(), the script works in R studio but having issues in the R scipt visual. Any ideas what I could do you fix this?
 
 
No RepliesBe the first to reply