Can I recover lost/deleted scripts in R

I made a shiny app. With separate Ui.R and Server.R files. There was also one script named"Training "with some codes which I used to test packages and functions, used in Server.R. Also, it contained lots of tips and tricks I learned from the internet for learning R. The 3 files were saved in one project. For past few weeks it was all running good. But, recently I tried to deploy the app on shiny server. But, problem occurred that after giving all the addresses for app(project) files the app(project) which was deployed was different.(I named two different apps(project) with same name. one was {Stability Analysis App} & second one was {Stability_Analysis_App} difference was of "_"). I wanted to use "Stability Analysis App" and the other one was worthless. In server the later one was being deployed. So, I deleted it. But, with it I might have also deleted "Training" script. (don't know how). Now, with its loss I have lost lots of insights I gained in R.

Is there any way I can recover that file.

Also, can you please explain why Stability_Analysis_App was deployed when I wanted Stability Analysis App.

As I used the command
rsconnect::deployApp('C:\\Documents\\R Programming\\Stability Analysis App')

Sorry, for the stupid mistake of naming the projects same.

Thanking You for your reply.

Hi @prateek26394! Welcome!

Accidentally deleting files is no fun at all :worried:. I’m afraid that in general, there’s nothing special about R script files in this situation — they’re just plain text files. If you really deleted the file, then it’s probably gone (absent some sort of file recovery software miracle, but that has nothing to do with R).

But just to be clear, did you only delete the mistakenly deployed project from the server, or did you also delete your local copy? Are you in charge of the Shiny Server installation and the machine it runs on, or is somebody else?

I don’t know the answer to your question about which app got deployed. Are you sure that you used that line of code exactly as above, or is it possible there was a typo that caused the wrong folder to be referenced?

1 Like

Well, I do control the Shiny server, and I deleted the project in the server first then from the computer. Due to deployment of incorrect project, I deleted the folder of Stability_Analysis_App from the machine.

Even though it was just a script I noted lots of functions, tips and tricks of using R for different applications, which is being lost. :sob:

I am a learner, from past 2 months in R. I usually make notes of what I learned in those scripts.

But, Thank You for the concern. :slightly_smiling_face:

As, of this I learned 2 things.

  1. Never name 2 or more projects very close to each other.
  2. Always use pen and paper for making notes as nothing can delete those. Except for fire, water and shredder.

Not a bad list! I’ll suggest a couple more :grin::

  1. Back up anything and everything you care about that’s on a computer, like for real :sweat_smile:
  2. Consider learning how to use GitHub with your R projects, even when you’re just starting out, because it can also save you from yourself (this is a good starting place:

Sorry about your lost work! That’s really tough. But I suspect that if you keep on practicing, in another couple of months you’ll have even more wisdom accumulated! Hopefully not so much the hard way :smile:


Thank You for the crucial suggestions :smiley:

Will definitely look into GitHub. :hugs:

And may become proficient in R :sunglasses: in the (not so) near future.
To the path of becoming from :monkey_face: in computer science to data :man_scientist:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.