Category "r"

For Loop in R to find duplicates in single vector WITHOUT built-in functions

I found this as an interview question and can't seem to work a solution. You can't use any built in R functions. x <- c(77, 12, 4, 8, 77, 2, 4, 12) answer &

minimum value in dataframe greater than 0 in R

I have a dataset with ~2500 columns in R, and I am trying to find the minimum value greater than zero from the entire data frame. Once I have found this number,

Adjust place of downloading buttons of a DT table in Shiny

please see this picture I have a DT table in the shiny. I added buttons for downloading the content of the table (Copy, CSV, Excel, PDF). But I would like to ch

Select set of columns so that each row has at least one non-NA entry

I have a large number of variables (columns), but each has missing values for some of the observations (rows). How can I get a set (or all sets) of columns so t

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