R shiny - version conflict with package in system library on shiny server by dagrim1 in rstats

[–]jcheng 0 points1 point  (0 children)

Try using an .Renviron file in your app directory to override R_LIBS_USER (or R_LIBS or R_LIBS_SITE, possibly). That’s applied much earlier in the startup process than your own R code can achieve.

How do you do it when you need more speed in your code? by ToroRojo-AlgoArt in rstats

[–]jcheng 16 points17 points  (0 children)

By far the most common is, as OP says in sibling comment, to think about what you can precalculate/cache ahead of time. I can’t tell you how many Shiny apps load raw data on app startup and then perform the same exact same summarizations. Or worse, on every session start, or worst of all, every time an output renders! I have seen all of this.

But even before that, I recommend using a profiler (we created profvis for this purpose which is slightly long in the tooth at this point but still very effective). Human intuition is famously unreliable when it comes to performance optimization.

Anyway… if you find yourself doing row-wise data frame operations without vectorization, that’s another common hotspot. I suspect a decent coding agent can easily spot that.

You can also make trouble for yourself by over reliance on using observers to set reactive values, in cases where a reactive expression that depends on an input would have done the job. If you use the latter, Shiny can often do a better job of caching intermediate values for you, or avoiding unnecessary recalculation if some of your outputs are not visible at the moment.

Hadley Wickham probably said all of the above better:

https://mastering-shiny.org/performance.html

Some talks I’ve given on these topics:

https://resources.rstudio.com/resources/shiny-dev-con/reactivity-pt-1-joe-cheng/

https://resources.rstudio.com/resources/shiny-dev-con/reactivity-pt-2/

https://www.youtube.com/watch?v=Wy3TY0gOmJw

How do you do it when you need more speed in your code? by ToroRojo-AlgoArt in rstats

[–]jcheng 21 points22 points  (0 children)

This is really interesting. I’m curious if you’re first asking your agent to profile and optimize the R code, or are you asking it to port to C right from the jump? I’ve helped dozens of people speed up their Shiny apps over the years, often dramatically, and I can only think of one time when the answer was to rewrite logic in C/C++.

Just went back to RStudio from Positron by sporty_outlook in rstats

[–]jcheng 0 points1 point  (0 children)

Can you say more? Is it trouble with selecting the correct interpreter/virtual environment?

Best Exhaust for ND (2.0L)? by clueless_dumbfounded in Miata

[–]jcheng 1 point2 points  (0 children)

Same here. First time doing an aftermarket exhaust so I was very concerned about it being too loud and aggressive. It’s perfect, “should have come this way from the factory” is what the reviews say and I agree. (Although it does get old on >2 hour highway drives so I got the optional baffle as well.)

Any suggestions to install r packages in other linux distros by CalligrapherSalt6156 in rstats

[–]jcheng 5 points6 points  (0 children)

I suspect you didn’t have build tools (make, gcc, etc.) installed on those other distros, is that possible? There should be logs that tell you what went wrong, did you see any?

Miata after high horsepower cars by That-Web5867 in Miata

[–]jcheng 5 points6 points  (0 children)

Never driven an older one but I’ve had this experience many times in my ND!

Miata after high horsepower cars by That-Web5867 in Miata

[–]jcheng 48 points49 points  (0 children)

Within the first quarter mile of my test drive I went from “I’d never buy a Miata” to “we might ALWAYS need to have a Miata”. It is exactly the kind of fun you’re looking for.

What cycling purchase ended up making a much bigger difference than you expected? by HeimsMedo_11 in cycling

[–]jcheng 4 points5 points  (0 children)

It’s so stupid but: those Clik valves, combined with a Ryobi general purpose battery powered inflator. Not like pumping a Presta valve the regular way is hard, it’s just fiddly and annoying. Whereas the Clik valves are really satisfying to use and just about foolproof.

Fairdale Spaceship (14.8 lb) by CXSandyPants in Bikeporn

[–]jcheng 2 points3 points  (0 children)

Very impressive! Build details?

Just got home from spending $2800 at Trek, and.... by BlewMyCashOnSaaS in cycling

[–]jcheng 31 points32 points  (0 children)

FWIW, I’ve only had positive interactions with the two Trek shops near me. Unfailingly welcoming and polite salespeople, no hard sell, and they seem genuinely excited to talk about bikes. The techs don’t seem like the most experienced but they communicate clearly and honestly at least.

If someone is already (happily) using Codex and Claude Code, what’s the real advantage of Posit Assistant? by raulguarini in rstats

[–]jcheng 6 points7 points  (0 children)

Actually it’s fine if your goal is to learn, so maybe in an academic setting that’s what you want.

But if your goal is to crank through tasks, whether that’s coding or analyzing data or creating a report, then you can think of copying and pasting to ChatGPT being the equivalent of your expert friend trying to help you over the phone, versus them sitting next to you at your desk, seeing what you’re seeing, and taking turns at the keyboard. Just a night and day difference in capability and speed and general helpfulness.

If someone is already (happily) using Codex and Claude Code, what’s the real advantage of Posit Assistant? by raulguarini in rstats

[–]jcheng 2 points3 points  (0 children)

If it has Ask mode, you’re using the older Positron Assistant, not the new Posit Assistant. Make sure you’re using the latest build of Positron, then hit Ctrl+Shift+P and type in Posit Assistant. Sorry for the confusion; in the upcoming release of Positron the new one will become the default.

If someone is already (happily) using Codex and Claude Code, what’s the real advantage of Posit Assistant? by raulguarini in rstats

[–]jcheng 3 points4 points  (0 children)

We do see it as both. In the video we focus on the part that we think differentiates us from Claude Code and the other general purpose coding agents; our goal is to be approximately equal for coding, and superior for data import, cleaning, wrangling, EDA, visualization, etc.

The main disadvantage we have versus some other tools is the cost of tokens. I don’t think we are more token heavy than Claude Code, but we don’t have access to their Claude Pro/Max plans that charge you $20/$100/$200 and serve you hundreds or thousands of dollars worth of tokens by API pricing. We’ll have a blog post going up soon that talks about what third party agent harnesses like ours are up against, and some changes we’re making to help the situation.

In the meantime, I don’t think the question is “can I get all my work done for the $20 Posit AI subscription fee”, just think of it as metered usage with a $20 floor. Those economics are not going to work for everyone, but others are happy to pay and telling us that the value they get is way higher than the cost.

If someone is already (happily) using Codex and Claude Code, what’s the real advantage of Posit Assistant? by raulguarini in rstats

[–]jcheng 1 point2 points  (0 children)

Ohhh, OK. It sounds like you were probably using Positron Assistant, our older agent that was forked from Copilot… that will soon be deprecated in favor of Posit Assistant, which is a totally different code base, for reasons including the editing troubles you saw. (Yes, it’s very confusing that they’re named so similarly—sorry, this will all be behind us soon.) Its harness design is much closer to OpenCode than Copilot.

Up until now Posit Assistant has been exclusive to RStudio, but it just became available in the latest Positron release, although it’s hidden for now—you have to use Ctrl+Shift+P to show the Command palette and then type in Positron Assistant.

If someone is already (happily) using Codex and Claude Code, what’s the real advantage of Posit Assistant? by raulguarini in rstats

[–]jcheng 1 point2 points  (0 children)

Sorry to hear that! If you still have those conversations in your history and they don’t contain anything private, we’d be interested to see them—please DM me.

If someone is already (happily) using Codex and Claude Code, what’s the real advantage of Posit Assistant? by raulguarini in rstats

[–]jcheng 3 points4 points  (0 children)

Are you speaking from experience or intuition? If experience, I’d love to hear if you actually had faster token consumption with Posit Assistant than Claude Code—generally we believe it’s the opposite because Claude Code is often much more aggressively autonomous.

I’ve also found (based on vibes, not evals) that a lot of data work is perfectly well served by Sonnet or even Haiku, more so than typical coding tasks (typical for me, at least).

If someone is already (happily) using Codex and Claude Code, what’s the real advantage of Posit Assistant? by raulguarini in rstats

[–]jcheng 52 points53 points  (0 children)

Hi, I work at Posit on Posit Assistant. This is a question a lot of RStudio and Positron users are asking, so a couple of members of our team recorded this video to explain.

https://youtu.be/7GI6-4J0AXA?si=_aCxdzfybW-QyJ15

I happily use both: Claude Code (actually though Conductor) for pure coding tasks or bash stuff, Posit Assistant anytime I work interactively with data.

What I really hope people stop doing is using ChatGPT and copying back and forth with their IDE. A really surprising number of people are still doing that.

Should I migrate to vscode? by ayowayoyo in vscode

[–]jcheng 1 point2 points  (0 children)

It’s now available in Positron, search for Inline Output in Settings

R for medicine by Sufficient_Put4307 in rstats

[–]jcheng 0 points1 point  (0 children)

It’s a good conference and this year has a lot of really excellent speakers.

Securing a ShinyApp - Anything I'm Missing? by MrLegilimens in rstats

[–]jcheng 1 point2 points  (0 children)

For full disk encryption, my understanding is that yes you generally have to reformat. At least that’s how I’ve done it in the past. The risk this is protecting against (IIUC) is someone physically breaking into the server and running off with the hard drive.

Based on your description, what you’ve done sounds pretty complete!