Juli Nagel
-
Hey #rstats modelling people. I wanted to get into #driftdiffusion models, and in several introductions to the topic (such as recent ones like https://www.frontiersin.org/articles/10.3389/fpsyg.2022.1039172/full ), the R package DMC. From the few tutorials I found, it appears the package was never on CRAN (?) but needed to be downloaded from GitHub. However, I can't find a repository or any trace of the package. Does it still exist?
-
Get unique rows of a dataframe in #rstats, but ignore some columns (e.g., ID in this df)?
df1 <-
data.frame(
name = c("apple", "apple", "apple", "orange", "orange"),
ID = c(1, 2, 3, 4, 5),
is_fruit = c("yes", "yes", "yes", "yes", "yes")
)If you're a #baseR fan like me, you might want:
df1[!duplicated(df1[!names(df1) %in% c("ID")]), ]
-
I don't think my #rstats code for day 9 of the #AdventOfCode2022 will win a beauty competition, BUT I saved every position of every knot, just for this #gganimate.
It's too slow for my taste, but any attempt on speeding it up resulted in too many green dots plotted at the same time (I already struggled to make the gold line stay AND have the right number of green dots appear), or the gold line being wonky.
Find the code here:
https://github.com/einGlasRotwein/advent_of_code_2022PS: This beast takes > 30 min to render.
-
:rstats: `paste0()` can help you select columns in a df, base R style.
# generate example data
df <- as.data.frame(matrix(sample(30), nrow = 3))# change last three column names
names(df)[ncol(df):(ncol(df) - 2)] <- c("some", "random", "names")# switch columns up for fun :-)
df <- df[ , sample(10)]# Extract columns V1-V7
df[paste0("V", 1:7)]