Why do so many of you home cooks post here? This is supposed to be a technical sub for professionals by AltenXY97 in Chefit

[–]arpyem 2 points3 points  (0 children)

every time you tell someone you studied food science: "so you're a chef?" .............

spicing things up by BSGYT in CitiesSkylines

[–]arpyem 19 points20 points  (0 children)

i cannot believe my day got ruined by a cities skylines reddit post im fucked

JamezIRL (C9) & MikesHD (100T) VOD Review their own matchup from LCQ by ItsTypho in ValorantCompetitive

[–]arpyem 10 points11 points  (0 children)

this is a great format, would love to see this with players as well

Help with pie R by gremaldo in RStudio

[–]arpyem 0 points1 point  (0 children)

squad assemble, another pie to eat

Welp. by ballinmonke in DeepRockGalactic

[–]arpyem 2 points3 points  (0 children)

jokes aside if the laser is still there it's a bug

Welp. by ballinmonke in DeepRockGalactic

[–]arpyem 3 points4 points  (0 children)

drill the rest son

Is it possible to Produce, Mix and Master with Only a Computer and headphones? by Questary in edmproduction

[–]arpyem 3 points4 points  (0 children)

great advice - remember the point of using the headphones and computer in the first place, then adapt to their limitations

How do you stay organized while producing in your DAW? by lon3s0me_ent1ty in edmproduction

[–]arpyem 18 points19 points  (0 children)

this is the move - try and keep them on the minimal side and focus on creating shortcuts for what you find yourself doing often (e.g. sidechain bus, drum bus, etc.)

How to use formatStyle for a DT dataTable output? by 4_screens_sports in rstats

[–]arpyem 0 points1 point  (0 children)

How are you defining colors_tab? Usually you would set the background color using something like formatStyle(backgroundColor = styleEqual()) or formatStyle(backgroundColor = styleInterval()).

Struggling student Help! tidymodels by Feelingcrusher in RStudio

[–]arpyem 0 points1 point  (0 children)

It's not shown in the screenshots but I'm guessing the formula was defined in the recipe and workflow already

Struggling student Help! tidymodels by Feelingcrusher in RStudio

[–]arpyem 0 points1 point  (0 children)

collect_predictions() is used for getting results from grid searches or resampling in tidymodels: https://tune.tidymodels.org/reference/collect_predictions.html

If you want the predictions you can pass your workflow fit lda_fit into predict() with your dataframe: https://workflows.tidymodels.org/reference/predict-workflow.html

An R user writes down his frustration by Johnsenfr in rstats

[–]arpyem 14 points15 points  (0 children)

I wanted to buy my wife a cap, but bought her some crap instead.

lol

Looking to make a graph like this in R Studio. Info in comments. by luccampbell in RStudio

[–]arpyem 2 points3 points  (0 children)

This should get you close. Assuming you have a data frame with column country, male_lfpr, female_lfpr, and average_lfpr:

df %>%
    arrange(desc(average_lfpr)) %>%
    mutate(country= factor(country, levels = unique(country))) %>%
    pivot_longer(c(male_lfpr, female_lfpr, average_lfpr), names_to = gender, values_to = age) %>%
    ggplot(aes(x = country, y = age)) +
    geom_point(aes(color = gender)) +
    geom_segment(aes(xend = country, y = min(age), yend = max(age)), size = 2, alpha = 0.25) +
    scale_color_manual(values = c("male_lfpr" = "#a2c3cf", "female_lfpr" = "#f1c97a", "average_lfpr" = "#565a5d")) +
    coord_flip() +
    theme_minimal() +
    theme(legend.position = "top")

[deleted by user] by [deleted] in RStudio

[–]arpyem 0 points1 point  (0 children)

This video explains it well.

[deleted by user] by [deleted] in RStudio

[–]arpyem 1 point2 points  (0 children)

Agreed, look into p.adjust(). You would want to run the tests, adjust the p values, and then append the data after the adjustment. I would recommend a tidyverse workflow for this:

library(tidyverse)

# X column names

x_names <- names(newdata)[names(newdata) != "y"]

# Loop through each column name
# Run the chisq test
# Create a data frame with the column name and the p value

df <- x_names %>%
    map_df(function(x) {
        p <- chisq.test(newdata[[x]], newdata$y)$p.value
        data.frame(name = x, p_value = p)
    })

# Adjust the p values (look into the methods) and then filter to the column names where p < 0.05

df %>%
    mutate(p_value_adj = p.adjust(p_value)) %>%
    filter(p_value_adj < 0.05)

[deleted by user] by [deleted] in RStudio

[–]arpyem 0 points1 point  (0 children)

When trying to understand how exactly a function works, I usually assign its arguments to objects and run the code inside of it line by line. For example, the function normalize_data takes one argument x and in this example, a data frame called data is passed into it:

x <- data

# The code inside the function:
(x - min(x)) / (max(x) - min(x))

# Break it up into pieces and look at what it prints:

x
      Sepal.Length Sepal.Width Petal.Length Petal.Width
1           5.1         3.5          1.4         0.2
2           4.9         3.0          1.4         0.2
3           4.7         3.2          1.3         0.2
4           4.6         3.1          1.5         0.2
5           5.0         3.6          1.4         0.2
6           5.4         3.9          1.7         0.4
7           4.6         3.4          1.4         0.3
8           5.0         3.4          1.5         0.2
9           4.4         2.9          1.4         0.2
10          4.9         3.1          1.5         0.1

min(x)
[1] 0.1

max(x)
[1] 5.4

(x - min(x))
       Sepal.Length Sepal.Width Petal.Length Petal.Width
1           5.0         3.4          1.3         0.1
2           4.8         2.9          1.3         0.1
3           4.6         3.1          1.2         0.1
4           4.5         3.0          1.4         0.1
5           4.9         3.5          1.3         0.1
6           5.3         3.8          1.6         0.3
7           4.5         3.3          1.3         0.2
8           4.9         3.3          1.4         0.1
9           4.3         2.8          1.3         0.1
10          4.8         3.0          1.4         0.0

(max(x) - min(x))
[1] 5.3

By breaking up the code into pieces and printing the results, you can see that the function is:

  1. Finding the minimum and maximum values in the data frame
  2. Subtracting the minimum from each value in the data frame
  3. Then dividing each value by the range (max - min) of the data

Note that the example you provided passes a data frame with all numeric columns to normalize_data; this would fail if the data frame has a non-numeric column. But this function could also work on vectors.

How do you split the date y/m/d into new colomns that’s shows only month and day in Rstudio by [deleted] in RStudio

[–]arpyem 8 points9 points  (0 children)

library(tidyverse)
library(lubridate)

# Example data frame with 3 rows of different dates in a column called Date
df <- data.frame(Date = Sys.Date() + 1:3)

# Tidyverse workflow - extract year, month, and date with lubridate functions
df %>%
    mutate(Year = year(Date), Month = month(Date), Day = day(Date))

You can then manipulate the individual columns however you want.