Category "r"

R CMD CHECK "Found the following assignments to the global environment:" [closed]

Running R CMD check on my package I'm receiving the following warning message: Found the following assignments to the global environment: Fil

How to use write.table to download a dataframe into a nice csv/Excel file?

I am trying to use the write.table() function, within Shiny downloadHandler(), to download the df reactive dataframe as a .csv file, per the reproducible code a

How to obtain RMSE out of lm result?

I know there is a small difference between $sigma and the concept of root mean squared error. So, i am wondering what is the easiest way to obtain RMSE out of l

Two methods of recovering fitted values from a Bayesian Structural Time Series model yield different results

Two conceptually plausible methods of retrieving in-sample predictions (or "conditional expectations") of y[t] given y[t-1] from a bsts model yield different re

Keyboard shortcut for code chunk in R Markdown for windows gives í

Using RStudio for windows. Help says keyboard shortcut for inserting code chunk is Ctrl + Alt + i, which should give me: ```{r} ``` Instead, I get í

How to detect TIME when reading from an excel sheet using R

The issue is that when I read from an excel sheet into R using read.xlsx from openxlsx package, the TIME column is converted into a fraction. Here is an exampl

R package stargazer produces two table outputs instead of one

I'm currently struggling with r markdown, knitr, and, the stargazer package. More specifically, I want to produce the output of a logistic regression: {r table1

URL '/help/library/<package>/r/html/00Index.html' not found when using `devtools::load_all()`

I am using devtools::load_all as a workflow to iteratively make a package. However, I cannot seem to be able to view the package documentation using ? or help(p

Does anyone know how to plot long term spectral averages (LTSA) and PSD in R?

I'm trying to make some plots to document the soundscape of a large dataset of .wav files Essentially, I have a series of consecutive 10-min 24-bit files for ab

Computation failed for stat_summary, 'what' must be a character string or a function

I am trying to following the script/example on ChickWeight plotting raw data in "Independent Group T intervals test", but keeps running into the following error

How to make predictions even with NAs using predict()?

I want to use predict() with a polr() model to predict variable z, as per the following code. This first is the df to train the model and the subsequent test da

Computation failed for stat_summary, 'what' must be a character string or a function

I am trying to following the script/example on ChickWeight plotting raw data in "Independent Group T intervals test", but keeps running into the following error

Is it possible to use geom_insert() in ggtree for circular trees?

I am trying to to include my results of ancestral state estimation as pie charts at the nodes of a phylogenetic tree. It works fine for rectangular trees but I

How to fix 'Error in if (nchar(text.matrix[r, c]) > max.length[real.c]) { : missing value where TRUE/FALSE needed' using stargazer in rstudio?

I'm trying to print a table of combined lm's in Rstudio using Stargazer and I keep getting this message: Error in if (nchar(text.matrix[r, c]) > max.leng

dbAppendTable() error when I try to append data to a local server

I'm just starting my journey with r, so I'm a complete newbie and I can't find anything that will help me solve this. I have a csv table (random integers in eac

Scraping content from urls in dataframe using R

Sorry, I'm relatively new to R and don't know it very well yet. I have also seen that similar questions have been asked more often. However, the corresponding s

How can I freeze the first column in DT without increasing the column width of a table with rotated (90°) column names?

I want a table of the format of table dt1 (rotated and freezed column names, narrow column width, scrollbars horizontally and vertically) plus freezing the firs

Apply a function over all combinations of arguments

I would like to be able to apply a function to all combinations of a set of input arguments. I have a working solution (below) but would be surprised if there'

How to create a range of dates in R

From two integers (1, 5) one can create a range in the following way 1:5 [1] 1 2 3 4 5 How can you make a range of dates if you are give two dates ("201

How to order frequency from highest to lowest for character variable

Suppose my dataframe (df) only includes this single character variable: race.ethnicity<-c("W", "C", "F", "F", "J") I want to create a frequency table for th