Category "r"

R : Loop to keep only one specific value

I have a dataset and I would like to keep the value in a column of this dataframe (test_masses) for the mass having the highest intensity for masses close to th

aggregate methods treat missing values (NA) differently

Here's a simple data frame with a missing value: M = data.frame( Name = c('name', 'name'), Col1 = c(NA, 1) , Col2 = c(1, 1)) # Name Col1 Col2 # 1 name NA

Error in asMethod(object): Cholmod error 'problem too large'

I have the following object Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:120671481] 0 2 3 6 10 13 21 22 25 36 ... ..@ p

Remove pattern that occurs outside of words

I am trying to remove pattern 'SO' from the end of a character vector. The issue I run into with the below code is that it will remove any sequence of 'SO' case

Docker image has error when running from R Studio

My Dockerfile contains the exact code as shown in the statworx website to build an image for a Shiny app. Whenever I run the following code however: # Base imag

SVM doesn't plot in R

I'm doing predictive analytics on R, and I executed a plot command with neither an error message nor an output. I'll reproduce my code from a stroke dataset. st

How do I create my own Oauth app for R script?

Hey im using the 'rgoogleads' library in R. https://github.com/selesnow/rgoogleads The problem im facing is that the app is able to access the googleads api fro

How can I pass function to formulas?

guys: I want to use systemfit to estimate a set of formulas which is composed by two parts,as the picture showing: there are four equations needed to be estima

Is there a way in R to add a row underneath that calculates difference of above rows (tidyr/dplyr)?

I have a really simple question but am not able to figure out at all. animal age cat 12 dog 8 Normally I'd apply data %>% mutate(diff = age[1] - age[2]), b

R current time in milliseconds

How can I get the current time in milliseconds? I tried the below without success: > strptime(Sys.time(), "%Y-%m-%d %H:%M:%OS") [1] "2022-05-14 19:42:53 CEST

Remove duplicate among consecutive values within a dataframe in R

I have a datafram such as COL1 COL2 COL3 G1 1 6 G1 2 6 G1 3 7 G1 4 9 G1 5 9 G1 6 9 G1 7 6 G1 8 6 G1 9 7 G1 10 7 G1 11 7 G1 12 8 G1 13 7 and I would like to rem

R crashed when plotting Lidar points with lidR

I had to re-downloaded the latest R and Rstudio with all previous packages deleted... Now I cannot plot 3D Lidar points with the lidR package, but plotting othe

Any packages for producing risk-of-bias assessment figures for the Joanna Briggs Institute's (JBI) critical appraisal tools?

I am conducting a meta-analysis. I am using JBI tools for the risk of bias assessment of the selected studies. Study types- randomized controlled trials, quasi-

what are these gray lines inside the bars of my ggplot bargraph?

I wanted to create a graph to show which continent has the highest co2 emissions total per capita over the years, so I coded this: barchart <- ggplot(data =

How to delete label above bar chart in R that's already in the legend?

this is my first post! Just wondering how to remove these titles above the charts: Here's the code for the diagram! I imagine I'll have to use something like:

R reticulate specifying python executable to use

First, I'm working on a Windows machine. I would like to specify a specific version of python to use in RStudio. I would like RStudio to use python 3 in the Arc

R reticulate specifying python executable to use

First, I'm working on a Windows machine. I would like to specify a specific version of python to use in RStudio. I would like RStudio to use python 3 in the Arc

python does not recognize R functions with ”.“ in the function name

When I call the contrasts.fit function in the R package, limma, I get an error, which I suspect is due to the "." reason, python may not recognize contrasts.fit

fancy pie chart in R using ggplot2

I have a pie chart below, and I would like to leave extra white space between each pie and paste the value of each letter in each pie (A=25). how to get around

Duplicate rows based on common value in other column?

I have a data frame which includes: one column having individual ID's (unique), and a second column showing a common unique variable. That is, everyone in colum