[R] Help with Programmin-1 submission.

John McKown john.archie.mckown at gmail.com
Sat Mar 14 13:58:50 CET 2015


Gary,

First off, I doubt anyone here will really be able to help you with a
question which is, basically, "How do I submit the R code that I've
worked on to my college as an answer to a programming assignment".
Unless by chance someone else here happens to be taking that course
and knows how to. It's not really an R programming question.

What I can help you with is an apparent misunderstand by you of what
source() does. source() is simply a way to say: read the lines in the
named "file" (not always a disk file) and act as if I had typed it all
in myself on the R command prompt.

Well, I may be chided a bit by others. But I'm bored this morning. And
I don't feel that this is actually a "homework problem". So I looked
at the R code at
http://d396qusza40orc.cloudfront.net/rprog/scripts/submitscript1.R and
at your transcript. Try the following commands:

source("http://d396qusza40orc.cloudfront.net/rprog/scripts/submitscript1.R")

setwd('H:/RStudio-Projects/Project1/')

submit()

Note that I replaced the second source() with a setwd() command. The
first source() defines some R programs for you. The setwd() makes your
"current working directory" be H:/RStudio-Projects/Project1/ which I
guess is where pollutantmean.R resides. The submit() function looks
for a __FILE__ in the __current working directory__ for the code which
you want to submit to your instructor. From what I can see, the
submit() process itself does the required source() to run your R code,
but only from your __current working directory__ (yes, I'm emphasizing
that). The rest of what you did after the submit() command looks to
match what the submit() function was wanting.

Now, I will emphasize yet again that this question is totally outside
the purview of this forum. Your question should have been asked of
your teacher, or a TA, or (as we were called back when I was in
college) a "user's ass" (we weren't P.C,. or even polite, back in the
60s. I had to help people with key punch machines and card readers). I
only went into this because: (1) I'm bored and (2) you look like you
might be just a bit younger that me and I believe in helping kids
succeed <grin>.


On Fri, Mar 13, 2015 at 6:46 PM, Gary Baggett <isleguard at gmail.com> wrote:
> Help.
>
>
>
> First of all, I admit being a noob when it comes to dealing with R and
> Git-hub (but not new to programming[embedded mostly]).  That being said,
> this first programming submission with this course is giving me fits.
>
>
>
> I have the first part of the assignment done, loaded the "submit" source
> within my local RStudio and am trying to run "submit ()".  It tries to run,
> but then aborts.see below.
>
>
>
>>source("http://d396qusza40orc.cloudfront.net/rprog%2Fscripts%2Fsubmitscript
> 1.R")
>
>> source('H:/RStudio-Projects/Project1/pollutantmean.R')
>
>> submit()
>
>
>
> Press Enter to continue...
>
>
>
> | Is the following information correct?
>
>
>
> Course ID: rprog-012
>
> Submission login (email): isleguard at gmail.com
>
> Submission password:
>
>
>
> 1: Yes, go ahead!
>
> 2: No, I need to change something.
>
>
>
> Selection: 1
>
>
>
> | Which part are you submitting?
>
>
>
> 1: 'pollutantmean' part 1
>
> 2: 'pollutantmean' part 2
>
> 3: 'pollutantmean' part 3
>
> 4: 'pollutantmean' part 4
>
> 5: 'complete' part 1
>
> 6: 'complete' part 2
>
> 7: 'complete' part 3
>
> 8: 'corr' part 1
>
> 9: 'corr' part 2
>
> 10: 'corr' part 3
>
>
>
> Selection: 1
>
> Error in file(filename, "r", encoding = encoding) :
>
>   cannot open the connection
>
> In addition: Warning message:
>
> In file(filename, "r", encoding = encoding) :
>
>   cannot open file 'pollutantmean.R': No such file or directory
>
>
>
>
>>
>
>
>
> Any suggestions as to where to go?  It appears to be unable to find my
> pollutantmean.R file even though I just sourced it.  The function is in
> memory and is in the directory from which I am trying to execute the submit
> script.
>
>
>
>
>
> Thanks,
>
> Gary Baggett
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown



More information about the R-help mailing list