Assignment showing code in the console

I teach an Intro to R class this summer. I have made an assignment, which comes with a template, but because this particular one was a little complicated I ran it on RStudio Cloud to make sure it was correct (I create the assignments on my computer). I then cleared the environment and restarted R - and I am pretty sure I made it an assignment after that.
I was just contacted by a student saying they can see all the code that I ran (i.e. the answers to the assignment) in the console. Maybe I misunderstood how assignments work - I thought students get a clean copy?
When I go to the assignment on my side, it shows up as completely clean; nothing in the console, environment or plotting pane.
I have a second account that I use as a "student account" to check everything shows up correct, and the student is right: I just "started" the assignment and I see all the previously run code.
This assignment was created on Aug 2, and some students already started working in it before today and I haven't heard anything from them. I am not sure if they did not have that problem, or if they decided not to tell me (which would be disappointing, but also hard to believe, out of 33 students). Does it have anything to do with the switch to paid accounts?
My "student" account with the assignment: #1507141 (that is the number you need, correct?)
Assignment on my instructor account: #1501076

No one has feedback here?
Seems like a simple question? Is the code supposed be showing in the console for students' assignments?
If so - my bad, I misunderstood how making assignments work.
If not - this needs to be fixed.

I am now checking all my students' assignments one by one to see if I need to clear the console. But of course some have already done quite a bit of work and I cannot see far enough up into the console to find out if they have seen the code.
And a problem is that not all students have made a copy of the assignment yet; it's quite hard to keep track who I would still need to check after this morning's checking and clearing (50+ students, so that's a lot to keep track of). Any tips? As said, the assignment to be copied looks clean, so it seems there is nothing I can do there?

Other things I've tried: go back into the assignment, turn off sharing and assignment. Leave assignment, get back in (and double check console is empty, history is empty, plotting pane is empty, environment is empty), turn sharing and assignment back on.

Went to my "student" account, got rid of the assignment copy I made before and re-started the assignment. Again: environment and plotting pane clean, packages not loaded, BUT code shows in the console and the History pane (the template script is closed; even though it is open in the assignment I am sharing).

I hope you can imagine that as an instructor/teacher this is giving me anxiety. Is this expected behavior? It seems there is nothing I can do here? Create a completely new assignment and make sure I don't run anything?


I realize this is frustrating, and sorry for the delay in responding, I've been trying to reproduce the behavior you are seeing and to understand what might be happening. There are a couple places where command history might be stored. The IDE itself has an internal database where it stores history, but this file should not be copied to student assignments. There is also a history file that can be updated by R itself that is stored in "/cloud/project/.Rhistory", but in the case of your project, it appears that file is empty (is that what you see as well?) This file is part of the project directory and would be copied to student assignments.

I haven't been able to reproduce what you are seeing, but I'm still investigating.

thanks for your patience

Yes, in both my instructor and student version .RHistory is empty.

Also, I forgot to mention that in my attempt to re-share, I also went into Tools -> Global Options -> General -> Basic and I unchecked "Always save history (even when not saving .RData)".
It was checked before.
It did not make a difference though.

I just made a new version of the assignment. I did not run any code in it, but did load libraries; and the console output that came with that is not visible in the student copy. So I suppose this new version should be okay.

I have stopped sharing the old version; that should not give students that already copied it any problems, right?

Right, they should be fine.

If you do see this again, I would like to try to understand what is happening so please let us know. If you are still seeing it on an existing assignment, maybe you could invite me to the space and I could start the assignment and take a look.


Sam, I can invite you; how do I add you? And should I add you as a Contributor or Admin? I assume Admin, since as a Contributor you will not be able to see the old assignment for which I turned sharing off?

Up to you, adding as a contributor would be fine. You can use my email (sam)


ps - i won't be able to investigate until tomorrow

1 Like

I was able to open each assignment and I see that none of them are demonstrating the same behavior you were seeing earlier. I don't think there is much more I can learn from being in your space unless you see the same thing happen. If you want to leave me in the space until you see it again, thats fine, but feel free to remove me, then let us know if it happens again. In the meantime, I'll talk with a few more folks on our end to try to learn more about what might have happened.

Sorry I don't have an answer for you right now, but thanks helping us investigate.


We're you able to get into my original Assignment7 though? The new one that I made did not show that behavior, and neither did any of my other assignments. I stopped sharing my original Assignment7, so I am not sure if as a Collaborator you could see it?

No, i could not see it. If you want to reshare that, i will take a look.


Thanks for sharing the project with me... however, when i opened it, the history tab was empty. Do you still see the problem?


Not when I open it as an instructor (because I cleaned everything up last time). But when I log in as a student and copy it, I do.

I can actually make you a contributor again and share the assignment (all my students are done with that one so I don’t have to worry about them copying it).

And I just noticed Assignment 8 has the same problem: I did not run any actual code in it before sharing it, but I loaded the tidyverse package. Now when I go in as a student and copy/start the assignment, it shows all the tidyverse installation information in the console.

I started Assginment 8 and the history empty for me there too. Very mysterious.

Yes, very mysterious... Assignment 9 looks fine (I made that one earlier this week).
Oh well. I'll let you know if it happens again :woman_shrugging:

Similar problem (with the console, not the history tab). I install {tidyverse} and {usethis} in a new project, set the timezone with {usethis} (to fix a problem with installing {anytime}, see the ['timedatectl' had status 1] topic), which requires an R restart, then install additional packages and finally clear the console. The log for installing all the tidyverse packages is visible in the console to anyone else who accesses that project, even though it does not appear when I am running it. If I clear the console before that initial restart, all is good.

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.