How to copy-and-paste for a R script within RStudio?

How to copy-and-paste for a R script within RStudio?

R version: 4.2.0
RStudio version: 2022.06.0 Build 342
OS: Ubuntu 20.04 LTS

After update R and RStudio to the version shown above, I encounter a new problem to edit my R script file .R on RStudio. This new problem will not be happened for all previous version of R and RStudio.

Problem description

Ater executing one line of R command within RStudio and the result is shown on RStudio Console. I use copy-and-paste method to copy the contents of the result output and want to add these contents on my R script as comment with '#' for further reference and comment. I cannot see the contents after pasting within my R script. There is no error shown, just nothing happened.

But the reverse is working.
i.e. I use copy-and-paste method to copy the contents of my R scipt within RStudio and can paste these contents into a seperated text file within a text editor. But I cannot paste the same copied contents within the same R script on RStudio only.

Thus, no pasting content is allowed for my R script within RStudio now. I need to key in all contents in my R script .R within RStudio now. It may be time-consuming job with many typing errors.

Why some changes on using RStudio now.

My current fix for this issue is as follows:

Open my R script .R on RStudio and a text editor same time.

Use copy-and-paste method to add the contents on R script within the text editor, not within RStudio.

The same contents is shown on the text editor normally as expected. Also, the same contents will be added and shown on the R script within RStudio automatically after saving the R script on the editor.

Before saving the new contents on the text editor, nothing is happened on the R script within RStudio.

After saving the new content on the text editor, the same contents will be shown on the R script within RStudio automatiaclly.

I guess the RStudio has read the latest R script .R again automatically and shows the latest contents on the R script within RStudio.
i.e. I need to update the R script within the text editor and save the contents in order to have a latest copy of the R script within RStudio.

This may be a new feature of RStudio, I don't know.

Please comment.

or

I need to configure the RStudio to have the 'paste' action of the content working again within RStudio.

Thanks in advance.

When I open the R script in text editor, gedit and in RStudio together under Ubuntu 20.04, I guess the text editor is synchronized with the RStudio.

Because when I edit the R script .R in RStudio, the content of the R script in the text editor will be updated in a few seconds later.

The reverse is tested and confirmed in 4 days ago, i.e. edit the content of R script in text editor, the content of R script in RStudio will be updated a few seconds later.

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.