Category "r"

Dropping NA-values with a MAX threshold and not MIN threshold

Is there any way to remove columns from a dataframe that has LESS NA-values than for instance 200? So instead of df.dropna(threshold = 200) we want the opposite

What function in R extracts the dB values from a .wav file

I have some sound data in .wav format and I would like to extract Sound Pressure Level data from this file in dB for different timepoints of the recording so I

Remove not increasing rows based on other columns values

I have a data frame on R and I want to remove all rows that are not increasing in my column 3. Each row have to be higher or equal than the previous one. But m

How to recover fitted values from BSTS poisson model (in R)?

I am trying to recover in-sample predictions (fitted values) from a bsts model with a specified poisson response using the bsts package in R. The following res

Subset with only consecutive numbers

I want to generate all subset of {1,2,3,4} with only consecutive numbers. (For example I want subset {1}, {1,2} or {2,3,4} but not {2,4}. ) This is what I have

How to correctly use data in extdata/data folder

I am working on an R package that I would like to submit to CRAN and have had issues with the size of the data, therefore I moved it into the extdata/data folde

lme4 1.1-27.1 error: pwrssUpdate did not converge in (maxit) iterations

Sorry that this error has been discussed before, each answer on stackoverflow seems specific to the data I'm attempting to run the following negative binomial m

R - Use Twitter API to get every tweet from an account

My goal is to get EVERY tweet ever for any twitter account. I picked the NYTimes for this example. The code below works, but it only pulls the last 100 tweets.

Issue installing spacyr on R 4.2

I am having trouble installing spacyr on R version 4.2. What is strange is that I've used this package in the past just fine. The installation is pretty basic.

1 of the 5 plots are missing in the graphic

I want to plot all ROC curves in one graphic with the plot function, but the first plot (tree.perf in blue) is separate from the others. Can someone help me out

Convert data frame into adjacency matrix format in R

My data looks like this: Sample_A Sample_B Value Rabbit Mouse 1.2 Mouse Tiger 7.89 Tiger Lion -0.9 Mouse Rabbit

How do I assign group level value - based on row level values - to df using dplyr

I have the following decision rules: RELIABILITY LEVEL DESCRIPTION LEVEL I Multiple regression LEVEL II Multiple regression + mec

Formatting the elements of a panel

This is a snippet of my interface (if choices = c () it means that the choice is managed on the server side): sidebarPanel( selectizeInput( "s1",

extract_parameter_set_dials() fails for self-written gbm engine for boost_tree()

I followed this vignette of the tidymodels package to make the gbm an engine for the boost_tree() function. I came up with the following for regression tasks: l

Calculation between vectors in nested for loops

I am struggling with an issue concerned with nested for loops and calculation with conditions. Let's say I have a data frame like this: df = data.frame("a" = c(

Pivot Longer in R Issues

I've looked quite a few different questions on here around Pivot Longer but I can't seem to figure out how to get my scenario to work. For example R Pivot multi

Column name being duplicated in recipe

This is the piece of code i'm having troubles with: pump_recipe <- recipe(status_group ~ ., data = data) %>% step_impute_median(all_numeric_predictors()

Randomizing within and across groups using group_by and sample

I'm running a study in which each participant will be presented with stimuli that have been randomized at two different levels: blocks (3 unique blocks) and tri

How do I fix this error for reticulate in Rstudio?

I searched Stack Overflow for fixes to this error and will put all the things that I have tried below that did not solve the issue. I have not had an issue on o

Add specific hovering behaviour to R plotly graphic

I am having troubles defining a specific behaviour when hovering an R Plotly graphic. Here is what I would like to do : I would like the full arrow to be respon