[R] Is there anyone who uses both R and Python here? How do you debug? Perhaps in RStudio?
@pencer@gr@ve@ @end|ng |rom e||ect|vede|en@e@org
Wed Jan 27 17:38:26 CET 2021
You can mix R and Python code in the same R Markdown vignette. See:
# R code
# Python code
I did this a couple of years ago. I haven't used Python since.
However, this is described in the book Xie, Allaire, and Grolemund
(2020) R Markdown: The Definitive Guide (Chapman & Hall and available
for free at the above link).
On 2021-01-27 10:31, Robert Knight wrote:
> An iterative process works well. Python to get the data desired and then
> Rscript script.r from a command line. My process involves building a
> script in R using, using Rstudio, Pycharm, VS Code, Kate, or some other
> editor. Then using data input built with Python as input to Rscript. The R
> scripts produce excel files or CSV data for other use RStudio is amazing
> for some slow pace academic work. The "expected a numeric but got a char"
> error appeared to often for my needs and so the workflows wound up with
> Python building data that's already cleaned for use in R to avoid data
> import troubles. My code use a functional paradigm rather than object
> oriented paradigm. Python does more than just munge my data since it
> handled many mathematic operations on it, but it's ultimate purpose is to
> clean large amounts of data to avoid import errors in R.
> On Wed, Jan 27, 2021, 1:49 AM C W <tmrsg11 using gmail.com> wrote:
>> Hello all,
>> I'm a long time R user, but recently also using Python. I noticed that
>> RStudio rolled out Python through reticulate. It's great so far!
>> My question is, how do you debug in Python?
>> In R, I simply step through the code script in my console with cmd+enter.
>> But you can't do that with Python, some of them are objects.
>> Here's my example.
>> class person:
>> def __init__(self, id, created_at, name, attend_date, distance):
>> """Create a new `person`.
>> self._id = id
>> self.created_at = created_at
>> self.name = name
>> self.attend_date = attend_date
>> self.distance = distance
>> def get_person(self, employee):
>> """Find and return a person by.
>> return person(employee['created_at'],
>> The error message says self._id was 'str', but expecting an 'int'. I can't
>>> self._id = 5
>> I guess it's "hidden". Can't really assign and test like that.
>> It seems hardcore Python programmers just use a debugger, and do not
>> understand the greatness of interactive IDE and console. I'd still like to
>> stay in IDE, hopefully.
>> So, how are the R users coping with object classes? Do you just instantiate
>> every time? What if you got 10 of these class person objects to debug?
>> I know this may be a Python question. But, I really wanted to see from a R
>> user's working experience.
>> Thanks a lot,
>> [[alternative HTML version deleted]]
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
> [[alternative HTML version deleted]]
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help