What format of the form changes when copying and pasting in rstudio?
Edit
As @Jay mentioned in the comments, the command n%
in the command is treated as a function, and since it is incomplete, it is indented from the next line.
To further confirm, try with df %in%
in a script or df >%>
and press Enter to see the cursor move to the next indented line.
To avoid simple function execution.
sample_frac(mydata,n)
OR
sample_frac(mydata, n %% somenumber)
whatever you try to do, and everything should be fine.
Original Answer
This added 2 spaces in the code when pasted into the RStudio script. I tried to paste the same text into my notes, Pycharm editor, but it didn't add any extra tabs. So he was pretty sure it was an RStudio problem.
It turns out that the padding settings in RStudio are responsible for this. To change this:
Go to Tools -> Global Options. Click the "Code" button on the left. You will see the following:
Uncheck Auto-indent after pasting
and click OK.
Now try pasting the same text. Should be allowed.
source to share