🧹Tidier.jl 0.6.0 is available on the #JuliaLang registry.

What’s new?

- New logo!
- distinct()
- n(), row_number() work *everywhere*
- `!` for negative selection
- pivoting functions are better
- bug fixes to mutate() and slice()

Docs: kdpsingh.github.io/Tidier.jl/dev/

A short tour.
If you use distinct() without any arguments, it behaves just like the #rstats {tidyverse} distinct().

It checks if rows are unique, and returns all columns just as you would expect.
If you use distinct() with arguments as shown here, then it returns all columns for unique values of the supplied column.

This is slightly different behavior than {tidyverse} distinct(), but I kind of like it. Can easily pair this with select() to mimic dplyr behavior.
Another thing that’s new is the helper function n().

While seemingly simple, implementing this was fairly difficult. When used inside of summarize/summarise, it behaves just like DataFrames.jl’s nrow() function.

So far, so good.
However, n() — and its counterpart row_number() — also work inside of mutate(), where nrow() from DataFrames.jl isn’t as straightforward to use, particularly inside of an expression (e.g. n() + 1).

n() provides a standard interface from all functions.
You can even use n() inside of slice().

To select the last 2 rows of a dataframe?

slice(n() - 1 : n()) — notice the order of operations is slightly different from R bc the `-` takes precedence over the `:` so no need for extra `()`.

Otherwise, this is exactly like R tidyverse.
And when the update says that n() and row_number() work *everywhere*, it’s really true.

You can even use row_number() inside of filter() to mimic the functionality provided by slice(), just like in R.
A hearty thanks to @PVDimens @randyboyes @zzhaozhe @PietroMonticone @Gaspardelanoche @LazarusAlon for contributions to Tidier.jl, to many others in the #JuliaLang community for code, blogs, and inspiration, and to #rstats and @posit_pbc colleagues for the tidyverse ecosystem! 🙏
And finally, ICYMI, here’s the new logo thanks to @PVDimens!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Karandeep Singh

Karandeep Singh Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @kdpsinghlab

Feb 25
A Visual Tour of the Meta-Tidyverse

For years, I’ve been trying out different non-tidyverse implementations of tidyverse. It’s fun seeing folks mold languages to run analysis code inspired by it.

If you like screenshots of code, come along for a visual tour.

Let’s start w/ R.
If you thought that one tidyverse was enough for R, you would be wrong.

There are 2 fully independent re-implementations: {poorman} and {tidytable}.

{poorman} is powered by base R only - no dependencies! It’s a great pkg to use with binder/CI workflows.

cran.r-project.org/web/packages/p…
{tidytable} has a similar premise, except it relies primarily on {data.table} and {tidyselect}.

While it’s similar to {dtplyr} in some ways, the syntax is even cleaner bc you don’t need to declare your data.table or use collect() to get the results.

github.com/markfairbanks/…
Read 16 tweets
Feb 23
If a tree falls in the forest but there’s no one around to hear it, does it really make a sound?

If a model detects a patient in need of ICU-level care but there are no ICU beds available, did the model really help the patient?
When we link an intervention to a model threshold (eg alerts), we often worry about overalerting.

Overalerting can take on multiple forms. Either there are too many alerts bc many alerts are wrong. Or, there are too many alerts bc we lack capacity to act even if they are right.
Consider this: a model scoring 10 patients. Using a threshold of 20%, you identify 4 out of 5 patients needing ICU-level care.

The sensitivity is 80%, right?

But what if you only have 3 beds available?
Read 8 tweets
Feb 22
Why do seemingly useful models fail to improve clinical outcomes when implemented? Resource constraints.

In this paper, we describe constraints, how they affect net benefit, and how they apply to other measures.

Paper: academic.oup.com/jamia/advance-…

R pkg: github.com/ML4LHS/modelre… Image
We use 4 case studies to show how a resource constraint diminishes the usefulness of a model and changes the optimal resource allocation strategy.

We show that some of the usefulness can be recouped by introducing a relative constraint (and relaxing the absolute constraint). ImageImage
All of the results in the paper can be reproduced using the accompanying {modelrecon} #rstats package and are shown in the README file accompanying the package.

github.com/ML4LHS/modelre… ImageImageImageImage
Read 5 tweets
Jan 31
My lab is moving to #JuliaLang, and I’ll be putting together some R => Julia tips for our lab and others who are interested.

Here are a few starter facts. Feel free to tag along!

Julia draws inspiration from a number of languages, but the influence of R on Julia is clear.
Let's start with packages.

Like R, Julia comes with a package manager that can be used to install pkgs from within the console (or REPL). The Pkg package isn't automatically imported in Julia but it's easy to do.

Both are different from Python's command line approach to pkgs.
Julia natively takes pkg management much further than R. Want to install a package from GitHub? Easy, just add a url argument to the add function.

Pkg.add(url = "github.com/kdpsingh/TidyT…")
Read 33 tweets
Sep 29, 2022
The new FDA guidance on CDS software is important but not for the reasons you might expect.

tl;dr: This document clarifies what the FDA *isn't going to regulate* and says little about *how* it's going to regulate CDS it considers to be a device.

Link: fda.gov/media/109618/d… Image
While the FDA was established formally by the FD&C Act in 1938, it didn't gain the authority to regulate medical devices until 1976 when the FD&C Act was amended.

ncbi.nlm.nih.gov/pmc/articles/P… Image
In 2013, an international working group chaired by the FDA determined that software could be a medical device under certain conditions.

Much CDS software falls under this umbrella.

Is all CDS of equal risk to patients?

imdrf.org/sites/default/… Image
Read 11 tweets
Feb 5, 2022
A prediction model paradox in health: while many are developed, few are recommended.

But when models *are* recommended, they often come from tertiary care hospitals.

Is this a problem? We tested 3 prostate ca models in regional/ national data.

Paper: auajournals.org/doi/pdf/10.109… Image
When people talk about risk stratifying cancer outcomes, there’s an implicit assumption that’s what being modeled is biology.

But whose biology? Patients who present to tertiary care centers are often more complex, and only some of that complexity is measurable.
So what happens when models trained on complex patients at tertiary care centers are tested against registries that capture risk across a regional or national population?

At least some of them (MSK and Briganti) overestimate risk.

What’s up with the squiggly green density plot? Image
Read 13 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(