Category "r"

Retrieving the values from the paramHankel.scaled() function (mixComp package)

paramHankel.scaled() is a function in mixComp package to be used for determining the components of a finite mixed model. For example, the following piece of cod

indexing column name in the dataframe in r

> df A B C 1 1 2 3 2 4 5 6 3 7 8 9 This is an example from another stack over flow question. Actually, in my dataset, there are 301 columns. I wonder How

Build an Authenticated GET API in R

I can't figure out how to set up an API correctly. I have an example in Python and would like to understand how to reproduce it with R, how to correctly choose

Performance indices for unequal datasets in R

I wanted to do the performance indices in R. My data looks like this (example): enter image description here I want to ignore the comparison of values in Time 2

Removing rows based on column conditions

Suppose we have a data frame: Event <- c("A", "A", "A", "B", "B", "C" , "C", "C") Model <- c( 1, 2, 3, 1, 2, 1, 2, 3) df <- data.frame(Event, Model)

How to extract the largest polygon in a raster?

I can read a rastre and exrec polygones likes: If I have this code to read a raster and shapefile: library(raster) library(geojsonsf) library(sf) librar

Include extra bibliography in R Markdown

I am writing my dissertation using R Markdown (output: Word) and have my primary bibliography from which all citations are based. This renders with no issue: ya

Bar plots in dygraphs

I am trying to replicate the below graph to my dataset (df) dyBarChart <- function(dygraph) { dyPlotter(dygraph = dygraph, name = "BarChart",

Flask Unique SQLAlchemy with Flask-LImiter

I want to make a project with flask where you sign up and sign in and then you can make new posts. I use flask-limiter to prevent users from making new posts. A

How do i set a timeout for utils::download.file() in R

I'm trying to download a file that requires more than 60 seconds using download.file() function. The documentation mentions the timeout option e.g. The time

Group classification considering the state and date of data with other states in the middle in R

'''library(tidyverse)''' df=structure(list(ID = c(348L, 348L, 348L, 348L, 348L, 348L, 348L, 348L, 348L, 348L, 348L, 348L, 348L, 348L, 348L, 533L, 533L, 533L,53

pivot_wider does not keep all the variables

I would like to keep the variable cat (category) in the output of my function. However, I am not able to keep it. The idea is to apply a similar function to m &

calculate weighted average over several columns with NA

I have a data frame like this one: ID duration1 duration2 total_duration quantity1 quantity2 1 5 2 7 3 1

flatten a list of lists without recursive=FALSE

I have a list that contains some other lists, but also contains additional objects that aren't lists such as data frames. I want to flatten this to a single lis

How to make leaflet map and absolutePanel of inputs / outputs full screen in shiny

I want to click a button to make a leaflet map and all overlayed inputs full screen. Using the following example, I can make the map full screen but I lose the

Error using data.table for output table generation

I would like some help regarding the adjustment of the second code. Codes are intended to do the same thing. The first code is generating the output table corre

Convert dataframe to time series

Is there a way to convert dataframe to time series (same like mdeaths) df1 <- structure(list(Year = c(2021, 2022, 2020, 2021, 2022, 2020, 2021, 2020, 2021,

sivs R package Error in apply(coef.df, 1, function(f) { : dim(X) must have a positive length

In the documentation of sivs the example looks like this: ***sivs_obj <- sivs(x = tmp[, c("Sepal.Length", "Sepal.Width", "Petal.

I am to extract data from netCDF file using R for specific loaction the code i've written as showen and I have an error at the end of the code

I need some help with extracting date from NetCDF files using R , I downloaded them from cordex (The Coordinated Regional climate Downscaling Experiment). In to

How to set the width of an error message in R?

I know you can set the width of your R output > options(width = 20) > 1:30 [1] 1 2 3 4 5 [6] 6 7 8 9 10 [11] 11 12 13 14 15 [16] 16 17 18 19 20