Category "r"

How do i fix error: data.frame: replacement has 148 rows, data has 1 (shiny and R)

I'm new to R and I'm trying to make my chart interactive using shiny and leaflet in R. however I can't seem to run my map_data() under reactive ({ code }) becau

How to change 1.3445 to 13445, 2.4444 to 24444 , and keep 1.20 not change

How to change 1.3445 to 13445, 2.4444 to 24444 , and keep 1.20 not change. Thanks! md <- data.frame(value=c('1.3445','1.20','2.4444'))

Using R to decrypt messages encrypted in PHP

my brain hurts, I can't figure it out, I would be tremendously thankful for your help. I have a database that gets encrypted at storage using PHP. I need to dec

Portfolio dataset from investing.com

I'm new at web scraping an I'm stuck with this. My goal is to generate a table with historical data from '2018-01-01' to '2021-12-31' but I have 0 idea of how t

KableExtra conditional tables in R

I am working on replicating in a Rmarkdown a report I made in Excel. In some of the results I have tables with conditional columns with color formatting, from r

In read_csv(), how to combine use `col_names = TRUE` and `col_character`

In readr, where combine using parameter col_names = TRUE and col_character as below code3, it's failed and the error message as attached image. Anyone can help

Plain code chunks for R input in knitr output

Goal In an R/Markdown document that I want to convert to LaTeX I want to set knitr options so that the entire document uses plain code chunks for all code input

Print a selected range of column names

I found how to print selected column by their names on R but not how to print the column names. My data set is called t and I tried that : print(colnames(t[3:nc

How to changes words in a charts title based on condition?

I would like the title of my plot to change based on if the supply is over or under the estimate. The estimate of the supply is in DF$Supply.. If it is positive

How to run reactive background process in shiny R?

I've written code that runs a long calculation in which, as part of it, several UI elements are updated showing part of the progress and results of the calculat

smartEDA - Assign unique color to target categories

I was exploring the capabilities of the smartEDA package and stuck with a challenge. The target column "US" has 2 categories - "Yes" and "No". The output (below

Two random unique samples of the same pool

I am trying to get two samples with unique elements in each sample. That is, the strings on the "first" vector cannot be in the "second" vector. Unfortunately,

R - get value of one variable for maximum value of another variable INSIDE a ggplot call

I have some code like this: seq(0, 2*pi, length.out = 100) %>% cbind.data.frame(t = ., Y = sin(.)) %>% qplot(t, Y, data = ., geom = "line")+ geom_

compute with R commands?

how in Rstudio, I can compute the below command?.

Extracting index value from a list in R?

I want to extract the random effects from my lmer model, including the person this random effect belongs to. My goal is to create a tibble that has one column f

How to add a column name inside a case_when when using mutate_all and across?

I have the following dataframe and I want to mutate all the columns in ENV dataframe to substitute some value with case_when function: metrics <- stru

data column not recognized in the ggplot geom_hline

I was wondering why variable mean_y is not recognized by my geom_hline(yintercept = unique(mean_y)) call? library(tidyverse) set.seed(20) n_groups <- 2 n_in

How to make default of parent function run if not specified in a wrapper function

I am writing a wrapper function where I am linking multiple steps of a pipeline. I would like to make it so the user can input multiple options where the value

Apply linear stretch to Landsat 8 images in the tmap R package

I have a Landsat 8 dataset downloaded from the USGS. I import into R using the following code: library(raster) library(tmap) B1 <- raster("LC08_L2SP_166072_

Summarising movements of individuals spread over several rows

I am a newly self-taught user of R and require assistance. I am working with a dataset that has captured location of residence and whether the locality is metro