#sample select
sample_frac(mydata,n%)#random select n% sample
##############data review####
Just copy above code into rstudio script, you will find 2 more tab
added to the last line.
What cause it?
Edit
As mentioned by @Jay in the comments, the n%
in the command is treated as a function and since it is not complete it indents the next line.
To further confirm, try with df %in%
in the script or df >%>
and hit enter to see the cursor goes to the next line with an indent.
To avoid that just complete the function there.
sample_frac(mydata,n)
OR
sample_frac(mydata, n %% somenumber)
whatever you are trying to do and it should be fine.
Original Answer
It did add 2 tab spaces in the code when pasting in the RStudio script. I tried to paste the same text in my notes, Pycharm editor but it did not add any extra tabs there. So it was sure that this is a RStudio issue.
It turns out it is the indentation settings in RStudio which is responsible for this. To change that:
Go to Tools -> Global Options. Click on the Code option on the left. You'll see this :
Uncheck Auto-indent code after paste
and click on OK.
Now try to paste the same text. Should be resolved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With