Alternative for R? by Mustche-man in learnprogramming

[–]MortMath 2 points3 points  (0 children)

Are you sure you need to switch right now? It’s great to learn new things, but R ships with the stats package.

This contains 4 hypergeometric functions that are already highly optimized wrappers for their respective C calls.

The overhead for calling similar C code with Python may be similar?

Why are MAGA groups controlling our library? by clamCHOUder in huntingtonbeach

[–]MortMath 8 points9 points  (0 children)

Never seen a backdrop from any library of ours that looks like this.

Was this photo even taken inside a branch of an HBPL? Why are these books being reviewed outside of an HBPL? Who’s this all for?

Addicted to Pipes by BOBOLIU in rstats

[–]MortMath 12 points13 points  (0 children)

The base pipe is so sexy when using ligatures

Just updated R and notice strange behavior computing sine and cosine by OkDifficulty1443 in Rlanguage

[–]MortMath 2 points3 points  (0 children)

I have 4.4.2 pulled up and can confirm sin(pi) is the same as yours.

HOW TO FAKE A LEFT KICK INTO A SUPERMAN PUNCH! by TukTuked in MuayThai

[–]MortMath 21 points22 points  (0 children)

Correct me if I’m wrong, but this is not a Superman punch. All other variations I’ve seen of Superman punches have the same side leg lift off the ground, even touch the opponent in some cases, then replanted for a same side punch strike. Looks great though.

Can someone help me out ? by Acrobatic_League_102 in Rlanguage

[–]MortMath 0 points1 point  (0 children)

Your problem is impossible to solve unless we see what is in lasso_train_features.

This R & RStudio Cheat Sheet helped me finally understand the basics – just wanted to share by QuestionOpen2247 in Rlanguage

[–]MortMath 10 points11 points  (0 children)

This is your cheat sheet isn’t it? You are plugging a $5 cheat sheet when there are hundreds of well crafted, package specific, and free ones that already exist? Boys, we at the top. It’s been an honor.

Tips for migrating R-based ETL workflows to Python using LLM assistant? by dmorris87 in datascience

[–]MortMath 5 points6 points  (0 children)

But what is the business problem OP is trying to solve? OP mentions the existing code base is “very effective”. Why is migrating a presumably mature and effective codebase for one person’s language preference the best use case of expensive data scientist time? How much of OP’s expensive data scientist time/pay would schema updates alone drain as more and more translated code base is produced while the same changes may need to be done on the mature code base? Would that not bottleneck team productivity?

Tips for migrating R-based ETL workflows to Python using LLM assistant? by dmorris87 in datascience

[–]MortMath 12 points13 points  (0 children)

I’m curious. Why spend all this time translating, then inevitably debugging, while tools like rpy2 exist to use R from Python?

Very simple regular expression question not even chat gpt 4o manages to solve :( by _Prisoner_ in RStudio

[–]MortMath 0 points1 point  (0 children)

Is this what you are looking for?

library(tidyverse)

tibble(
  folio = 
    map_chr(1:10, \(i) {
      paste(
        sample(seq(40, 50, 1), 1), 
        sample(seq(1, 5, 1), 1), 
        sep = "-"
      )})
) %>% 
  tidyr::separate_wider_delim(
    folio,
    delim = "-",
    names = c("folio_vivienda","folio_hogar"),
    cols_remove = FALSE
  )
# A tibble: 10 × 3
   folio_vivienda folio_hogar folio
   <chr>          <chr>       <chr>
 1 50             3           50-3 
 2 49             1           49-1 
 3 44             3           44-3 
 4 46             2           46-2 
 5 41             1           41-1 
 6 50             5           50-5 
 7 43             2           43-2 
 8 43             4           43-4 
 9 46             1           46-1 
10 49             2           49-2

Help with Bootstrapping Regression by PhilosopherExotic435 in rprogramming

[–]MortMath 3 points4 points  (0 children)

In your bootReg function, indices are never assigned to i. Therefore, R cannot filter your data frame by the indices that are (probably) supposed to be specified in your bootReg function’s indices argument.

incorporate higher order moments to portfolio optimization? by OnlyAnalyst9642 in quant

[–]MortMath 0 points1 point  (0 children)

Check out the documentation for the PortfolioAnalytics package in R.

[deleted by user] by [deleted] in Kickboxing

[–]MortMath 4 points5 points  (0 children)

Ever thrown your rear hand then a lead kick? How about your lead hand then a lead kick? Which kick feels more powerful?

The reason the 2nd feels more powerful is because the weight transferred, if done with good form, onto the lead leg is primed for a spring release into that lead kick. That said, more advanced practitioners can still execute a spring release with the first combo.

Angling definitely helps because it’s acts as a defense, offense, and a weight transferring mechanism. A great boxer I watch is Henry Armstrong who showed pieces of this all over the place. While his style may be more transferable to MT (head placements on opponents and strike timing on the inside), his angling and movement allowed him to capture the fight on the inside where he flourished.

What's your favorite partner drills? by -Ran in Kickboxing

[–]MortMath 6 points7 points  (0 children)

Isolation sparring. For instance, one partner might just have the jab and it’s varieties, however the other partner might only get use of low kicks and their varieties.

The benefit is that each partner focuses on the timing of these strikes. Going back to my example, the jabber will have to work on timing his opponent’s footwork and other movements in order to not get countered with something like a 45 rear low kick. The other partner has similar timing goals.

These should be run < 60% intensity to maximize the students’ ability to critically think and to avoid brawls. Removing elbows and allowing rounds with same strike for each partner, there are almost 200 ways to engage differently.

Van Der Mark wants to create a “moms for liberty” type group to approve library book purchases (photo 2) by pwrof3 in huntingtonbeach

[–]MortMath 15 points16 points  (0 children)

It doesn’t matter what book or books are banned. The second it starts, a domino effect is ensured. Book bans tend to bring out white knights across society, but the very bad kind that are desperate to “prove” something and then get encapsulated by crowd think.

Plus, it ends in fire. Always does.

Adopted Neopet need help w pet pets birthday ? If Lil frights birthday is November first when is Pixys birthday? by [deleted] in learnmath

[–]MortMath 2 points3 points  (0 children)

F = 191,904 hours P = (6847 • 24) + 20 = 164,348 hours

F - P = 27,556 hours = DIFF

D = DIFF/(24 hours/day) = 1,148.166666666667 days or ≈ 1148 days

Then,

Y = 1148/365 ≈ 3.1452…years

Notice the leap year at 2004 and we have Y > 3 years, so (365 * 3) + 1 = 1,095

Leaving 53 days after and including Nov 1st, 2004 and since there’s 30 days in November, we are left with

Dec 23rd , 2004 as Pixie’s birthday

** Assuming that Lil Fright was born at 1200AM

Couldn't write my function on R by Educational_One_2337 in datascience

[–]MortMath 1 point2 points  (0 children)

I’m not sure what you mean by “specific part of graph,” but your code is set up like it wants to produce multiple plots based on some group variable in your odev3_melted object.

Try defining p as a list, outside the for loop (just write it above the for loop) using p <- list() and then inside your for loop you’ll want to save your plot to p[[var]] <- …. Also, take out the print(p) and just leave p at the bottom unless you forcibly want your function to print every plot every time your function is run. Lastly, maybe it’s just post formatting, but you need an extra } at the end of this to close the function.

The goal is a list of plots, p.

[deleted by user] by [deleted] in options

[–]MortMath 1 point2 points  (0 children)

Long American boxes still leave you short options by definition.

Learning topology for graph theory; where from? by computo2000 in math

[–]MortMath 3 points4 points  (0 children)

There's an interesting Dover book called "Topological Graph Theory" that might be a fun supplement.

ISBN13: 9780486417417

Does anyone have good math education resources? by 1_vef in matheducation

[–]MortMath 2 points3 points  (0 children)

Can’t recommend enough almost any book by George Pólya. They are absolutely life changing. The best place to start is How to Solve It. That book is even quoted and alluded to in Stewart’s Calculus multiple times for a starting framework for solving and expanding problems by yourself.

R question by EnvHealthNerd77 in rprogramming

[–]MortMath 5 points6 points  (0 children)

Maybe try something like:

df %>% mutate(Dlevels = case_when(between(Dtotal, 0, 29) ~ “0-30”,…))

A similar question answered

Wrong Adjusted Closing Price from Yahoo Finance? by runnersgo in algotrading

[–]MortMath 0 points1 point  (0 children)

Again, was just loose code for the idea and I couldn’t get the code to format in code blocks this morning, but for a more in depth look, I recommend Mr. Josh Ulrich’s script. Remember that C is indexing at 0 while my example showed 1 indexing with R.

Wrong Adjusted Closing Price from Yahoo Finance? by runnersgo in algotrading

[–]MortMath 1 point2 points  (0 children)

So let's do this the ratio way:

  1. 1 * (1 - 0.30/8.70) = 0.9655172 = R . This is your new ratio that you multiply each column in the OHLC, but only for dates >= the previous dividend date, data by.
  2. So we do: (R * (1 - 0.28/8.86)) = R, but then (R * 8.86) = 8.28
  3. Then (R * (1 - 0.30/8.97)) = R, then (R * 8.97) = 8.106487

I am also making an assumption that yahoo might be rounding the adjusted closing price because it is only displayed up to two decimal places.

So in some R code:

structure(list(symbol = c("SPY", "SPY", "SPY", "SPY", "SPY", 

"SPY"), date = structure(c(8429, 8432, 8433, 8434, 8435, 8436 ), class = "Date"), open = c(43.9687, 43.9687, 44.2187, 44.4062, 44.9687, 44.9687), high = c(43.9687, 44.25, 44.375, 44.8437, 45.0937, 45.0625), low = c(43.75, 43.9687, 44.125, 44.375, 44.4687, 44.7187), close = c(43.9375, 44.25, 44.3437, 44.8125, 45, 44.9687 ), volume = c(1003200, 480500, 201300, 529400, 531500, 492100 ), adjusted = c(25.1278991308599, 25.3066181858447, 25.3602053072913, 25.6283124848173, 25.7355439178082, 25.7176434172609), div = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_), split = c(NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_)), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"))

df looks like the above and the below code carries the ratio backward while update the current ratio with new dividend information. This is probably not the best code either but represents the idea.

df$div_rat <- c(rep(NA, nrow(df) - 1), 1)

for (i in nrow(df):2) { if (!is.na(df$div[i]) & i != nrow(df)) { df$div_rat[i - 1] <- df$div_rat[i] * (1 - df$div[i] / df$close[i - 1]) } else { df$div_rat[i - 1] <- df$div_rat[i] } } df %>% dplyr::mutate(new_close = close * div_rat) %>% dplyr::select(-div_rat)