thx. I boldly forged ahead and translated. :)
And the translated code had some sophisticated (to me) R commands. chatgpt 'figured out" to use an sapply() statement. however it did have a mistake rendering that step in the code does not run. The code gets random values from a bernoulli. Chatgpt converted to the rbinom() . And the R code got an error because it appears to be giving the wrong values to one of the function parameters.
As another person identified a problem in the implementation of the histogram. I returned all the errors for fixing by my co-author.
-thank you all for the replies
------------------------------
Chris Barker, Ph.D.
Past Chair
Statistical Consulting Section
Consultant and
Adjunct Associate Professor of Biostatistics
www.barkerstats.com---
"In composition you have all the time you want to decide what to say in 15 seconds, in improvisation you have 15 seconds."
-Steve Lacy
------------------------------
Original Message:
Sent: 05-27-2024 20:42
From: Charles Coleman
Subject: converting Python code to R code/manuscript
I only recommend translating code when you're proficient in both languages. AI is imperfect, so you have to understand what the original code is doing and be able to verify that the translated code does the same thing. I've seen some creative translations made by AI. Thus, I recommend Sandra's suggestion of running the Python code as is using R's reticulate or similar package.
------------------------------
Chuck Coleman
Mathematical Statistician
US Census Bureau
------------------------------
Original Message:
Sent: 05-24-2024 10:34
From: David Miller
Subject: converting Python code to R code/manuscript
Chris - if you haven't tried ChatGPT for code conversion, I recommend it. For all it's faults, code translation is one of the tasks where ChatGPT genuinely excels. It doesn't always get it right the first time, but it's remarkably good at answering follow up questions about error messages.
------------------------------
David P Miller
Principal
DPM Biostatistics LLC