Category "r"

sparkR sql() returns string

We have parquet data saved on a server and I am trying to use SparkR sql() function in the following ways df <- sql("SELECT * FROM parquet.`<path to parq

Cache data in Shiny Server on Docker

I am currently trying to implement caching on my dockerized shiny app, but i am facing troubles, the app doesn't work and there's no log to trace the problem: S

Add 'total' row for each group in a column in df

I have a dataframe where the column size can be grouped. When the dataframe is arranged by size, I would like to show the totals of each column for each group a

R shiny datable with styleColorBar not aligning the data on the left hand side

I have the following code and my goal is to add styleColorBar to the WGT column, aligning the yellow bars on the left hand side of the column. df = data.frame(W

Fitting a line to the mean values of a multilevel variable using geom_smooth

I have this dataframe. I create a plot representing on the y-axis "value" and on the x-axis each of the levels of "Column_S", which contains levels from S1 to S

Replace NA only within specific range of time series object

I have the following data stored as zoo object: A B C 2017-05-31 NA NA 3.1 2017-06-30 2.5 2.4 3.2 2017-07-

How to change TOC depth in R Bookdown (GitBook)?

I use GitBook format through R bookdown. I need to use at least four levels in the table of contents (TOC). The default is three. How can I change the depth of

How to convert months as factors while still maintaining the months in sequence?

I have a original data frame (df) containing data of around 10 years(1994-2003). The head(df) is as shown below: Sl.no Date Year Month Season

If I imported my dataframe in R and can run associate() why is ALL_CORRELATION giving me an error?

All I have is a simple dataframe with 27 columns and 100 rows I continue to get the following error although the simple line of code works with other example of

Create several folders in a directory with a loop to write the names R

I am trying to create several subfolder in a parent folder. I created this code but it does not create my subfolders. I would like to create subfolders in the f

How to merge output of lapply iterated function into 1 dataframe? [duplicate]

I have a function responses to process some data that is subset into different data frames. I also have a list of these data frames partylist.

Parallelize st_union from R's sf package

I have some large shapefiles with multiple millions of polygons that I need to dissolve. Depending upon the shapefile I need to either dissolve by group or jus

Getting plots from R to powerpoint

I use "ggplot2" to create beautiful plots in R. I want to distribute them; I use "ReporteRs" get them into PowerPoint. When I do this the formatting is somehow

R R6 Inheritance with roxygen2 - class "ParentClass" is not exported by 'namespace:ParentPackage'

I am running into an issue with R6 inheritance. I am writing 2 packages (work related so I have to use fake code but I'll try to keep it accurate). In ParentPac

How to implement regressors in a Hierarchical Series in R, with the Fable package?

I am new to exploring the fable package, and I was wanting to implement Regressors in a Hierarchical Time Series model. How should the Dimensionality of the dat

Is there a way to paste 2 "ftable" object?

I`m using svyby from survey to make some weighted ratios with their standard deviation and coefficient of variation, I use the code below to generate a three wa

Vertical align kable's column name

Suppose the next example: library(knitr) library(kableExtra) df <- data.frame(a = letters[1:10], b = 1:10) names(df) <- c("This is a looooooong title,

How to remove rows with single unique ID in R?

I have the dataset as coded below. For a specific set of treatment pair, year, month, level, I have assigned a unique ID. Ideally, a compelete "set" has two row

Rendering many Rmds from command line using GNU parallel

To knit an Rmd from the command line, you can do the following and it creates an HTML Rscript -e "rmarkdown::knit('test.Rmd')" I want to do this for many Rmds

R Markdown, output test results in loop

I'm looking for a nicely formated markdown output of test results that are produced within a for loop and structured with headings. For example df <- data.f