Step1: File –> New script, to open R Editor
Step 2: Write function code
Step 3: myfun() and ls(), both can’t find the function we just wrote
Step 4: Copy and paste code from R Editor to R Console
Step 5: Now it’s ok to do myfun() and ls()
The other way to use our own functions:
Step 6: Write another function, myfun2
Step 7: Click “Save Script” button
Step 8: source(“fileName.r”) to get into our own functions
沒有留言:
張貼留言