Code won't work in Script space

Hello,

My code will only work in the Console space, not in the Script space. Could anyone tell me why? Here is the code and the message I get when it's run in the Script space. Thank you.

inputs.overall<-c("operators", "tools", "raw material", "facilities")
outputs.overall<-c("helicopter")
steps <- c("INSPECTION", "ASSEMBLY", "TEST", "LABELING")
#Inputs of process "i" are inputs of process "i+1"
input.output<-vector(mode="list",length=length(steps))
input.output[1]<-list(c("sheets", "..."))
input.output[2]<-list(c("sheets"))
input.output[3]<-list(c("helicopter"))
input.output[4]<-list(c("helicopter"))

#Parameters of each process
x.parameters<-vector(mode="list",length=length(steps))
x.parameters[1]<-list(c(list(c("width", "NC")),list(c("operator", "C")),
                        list(c("Measure pattern", "P")), list(c("discard", "P"))))
x.parameters[2]<-list(c(list(c("operator", "C")),list(c("cut", "P")),
                        list(c("fix", "P")), list(c("rotor.width", "C")),list(c("rotor.length",
                                                                                "C")), list(c("paperclip", "C")), list(c("tape", "C"))))
x.parameters[3]<-list(c(list(c("operator", "C")),list(c("throw", "P")),
                        list(c("discard", "P")), list(c("environment", "N"))))
x.parameters[4]<-list(c(list(c("operator", "C")),list(c("label", "P"))))
x.parameters

#Features of each process
y.features<-vector(mode="list",length=length(steps))
y.features[1]<-list(c(list(c("ok", "Cr"))))
y.features[2]<-list(c(list(c("weight", "Cr"))))
y.features[3]<-list(c(list(c("time", "Cr"))))
y.features[4]<-list(c(list(c("label", "Cr"))))
y.features

ss.pMap(steps, inputs.overall, outputs.overall,
        input.output, x.parameters, y.features, 
        sub="Paper Helicopter Project")

Error in ss.pMap(steps, inputs.overall, outputs.overall, input.output,  : 
  object 'steps' not found

Most likely you are only executing the last line of your script if you are using the
Ctrl+Enter shortcut, it only executes the current line so the line of code where you define steps hasn't been executed.

Thanks for the reply. However, I've also used the Run button in the script area and get the same error message (I click Run when the cursor is at the end of the ss. pMap line). I will appreciate your response.

I can't take a look into your issue since you haven't provided a reproducible example (I don't know from where the ss.pMap() function comes from).
If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

I believe that the Run button does exactly the same thing as the keyboard shortcut, which is runs the current line or selection. Try selecting all of the code in the script and then clicking on Run.

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.