stevensanderson, to RegEx
@stevensanderson@mstdn.social avatar

I decided to make a blog post out of a problem I worked on a day or two ago and thankfully I was also pointed to another solution from @embiggenData which worked well too.

#R

Post: https://www.spsanderson.com/steveondata/posts/2024-04-12/

image/png
image/png

stevensanderson, to Glue
@stevensanderson@mstdn.social avatar

Some one just reached out looking to extract values from a cell that are produced by from the

Example a cell value like 251 (13%) they just want the 251, so I did something like this:

library(tidyverse)
tibble(
value = glue::glue("{11:20} ({1:10}%)"),
reged_val = str_extract(value, "\d+(?=\W|$)") |>
as.numeric()
)

A tibble: 10 × 2

value reged_val
<glue> <dbl>
1 11 (1%) 11

Thoughts?

#R

embiggenData,
@embiggenData@c.im avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • khanakhh
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • Durango
  • megavids
  • InstantRegret
  • cubers
  • GTA5RPClips
  • cisconetworking
  • ethstaker
  • osvaldo12
  • modclub
  • normalnudes
  • provamag3
  • tester
  • anitta
  • Leos
  • lostlight
  • All magazines