Category "r"

Does the caret package for R properly implement repeated CV when passed a multifold object to trainControl's index option?

I'm hoping the answer to this question is a quick "yes" or "no" but I cannot find it explicitly in the caret documentation or elsewhere online. I want to perfor

Changing values in a raster

I have a raster file (created in QGIS, from a vectorial file). I would like to know if it is possible, in R: 1) to change the values of the pixels? (I believ

Find closest datapoint to a date in another dataframe

I have two data frames. One data frame is called Measurements and has 500 rows. The columns are PatientID, Value and M_Date. The other data frame is called Pati

Finding the turning point (inflection point) of COVID-19 infections using inflection package

I am not sure if I have done my inflection point calculation correctly. Based on lab confirmed cumulative case data in the epicenter of the current epidemic, we

What does the %||% operator do in R? Percent Pipe Pipe Percent

I came across this code when reviewing the R plotly library: modify_list <- function(x, y, ...) { modifyList(x %||% list(), y %||% list(), ...) } What d

How do I remove Japanese characters?

I have some data with Japanese characters from survey data. Some of the survey questions and answers (multiple choice) are given in both English and Japanese, e

Sliding window algorithm to analyze values of fasta segments

I have two segments of a random fasta file 1 Segment1 AAGGTTCC 2 Segment2 CCTTGGAA I have another random data set containing dinucleotides' energy values as A

Finding increases from 'baseline' in the graph, not sure how to do

I want to write an algorithm that spits out the points highlighted by arrows. I've tried using a second derivative but it returns a similar plot to the one ab

How to replace a value with NA across an entire dataframe

Is there any way to replace all the "-95" that can possibly exist in a dataframe with NA across all the columns?

Extract time (HMS) from lubridate date time object?

I have the following datetime: t <- "2018-05-01 23:02:50 UTC" I want to split it to time and date. When I apply date(t) I get the date part. But when

How to generate multivariate normal data in R?

I'm completing an assignment, in which I have to generate a sample X = (X1, X2) from a bivariate normal in which each marginal is N(0,1) and the correlation bet

using the uniroot function with dplyr pipes

I'm trying to utilize the uniroot function inside a piping scheme. I have root data by depth, and I fit a model for each crop-year set and put the fitted parame

using the uniroot function with dplyr pipes

I'm trying to utilize the uniroot function inside a piping scheme. I have root data by depth, and I fit a model for each crop-year set and put the fitted parame

Nested list to dataframe [using purrr + map]

I've looked at a lot of posts so I'm sorry if this is redundant, but was hoping to get some help flattening a nested list: test <- list() test <- c( li

Specify order after gather and spread

I want to keep the order of the output variables the same as the order they were created in the mutate statement. How do I accomplish this? It seems to be reor

Download A File Generated Within An R Shiny App

I am currently trying to generate a Shiny App that at the press of a button generates and downloads data for a user. I have a user defined function that pulls d

Arranging bars in multi-panel Lollipop chart using ggplot2

I am trying to plot a multi-panel Lollipop chart using ggplot2 using the following code #Data df =structure(list(Indices = c("Time", "Z11", "Z51", "Z61", "Z161"

How to do a "Select * from" query using odbc

I'm using the odbc package in R, and I have an SQL Server database with a table that has a Name column that is nvarchar(max) and a PublishStatus column that is

How to combine countpct and binomCI into the same summary statistic to be used in tableby function?

I'm using the tableby function from the arsenal package to create summary tables. For most of the statistics I need to generate, this package gives me exactly t

how can i insert a google sites into jupyter notebook with R

Is there any command to insert a sites.google into a notebook with IRkernel? I can find just the method to get the visible hyperlink with markdown cell: IRdispl