Category "r"

How does the overloading of the assignment operator in combination of the length function work?

How does the mutating implementation of length() actually work? Example: Given a vector v, how does this set the length to 12? length(v) <- 12 Can I create

Interpretation of a binary regression plot

I'm new to R and I created an avplot of a linear binary regression. I was wondering how do I interpret the regression residuals in the corner like that? Would y

Git tab missing in RStudio after git installed on Windows

Installed R, R Studio, Git but when I opened R Studio, there was no Git tab, like the screenshot below: Windows 8.1, x64 R version: 3.5.1 R Studio version: 1.

R - pass a global variable to a function, modify it and save

I'm trying to build a dynamic function utilizing eval,parse, or whatever works Intention of a function: a value setter. Parameter input: list, name of list it

Figure captions with multiple plots in one chunk

I label my figures like this. --- title: "xxx" output: pdf_document: fig_caption: true --- And then in each chunk ```{r, fig.cap="some caption"} qplo

how to measure correlation between two nonlinear timeseries datasets

I have two datasets with millions of y-values. (They are in chronological order so the X values have been omitted as they become merely an index.) >>>

Determine transects perpendicular to a (coast)line in R

I'd like to automatically derive transects, perpendicular to the coastline. I need to be able to control their length and spacing and their oriëntation nee

Which is the correct encoding for a degree character?

I have a line of code that alters text temperature<-as.numeric(gsub("°.*","",temp)) R does not like the "°" character. When I save the file it says

2D Spline and Nearest-Neighbor Adjustment examples not running in sommer package

I recently installed the sommer package, but the 2D Spline and nna examples provided would not run for me. I updated my version of R to see if that would resolv

Stacked bar chart with OTUs identified to different taxonomic levels

I have microbiome data with OTUs identified to the lowest taxonomic level possible. Some of the OTUs are identified to genus, others to family, order, etc. I ne

Insert the number of slides up to a final slide in a rmarkdown::beamer_presentation

In a beamer presentation generated with rmarkdown::beamer_presentation, I currently have \insertframenumber/\inserttotalframenumber which shows the current page

How to calculate similarity for pre-trained word embeddings

I want to know the most similar words to another from a pretrained embedding vectors in R. E.g: words similar to "beer". For this, I download the pretrained emb

Call R object from Python with r. in a Quarto document

I try to call an R object from Python inside a Quarto document: --- title: "pandas" format: html jupyter: python3 --- ```{r} data("penguins", package = "palmer

How to fix dbWriteTable error "unable to find an inherited method for function 'dbWriterTable' for signature...?"

I want to insert data in MySQL from a dataframe in R. I managed to connect without problems from R to MySQL using dbConnect, however when I try to insert my dat

How to fix dbWriteTable error "unable to find an inherited method for function 'dbWriterTable' for signature...?"

I want to insert data in MySQL from a dataframe in R. I managed to connect without problems from R to MySQL using dbConnect, however when I try to insert my dat

fread does not read character vector

I am trying to download a list using R with the following code: name <- paste0("https://www.sec.gov/Archives/edgar/full-index/2016/QTR1/master.idx") master

R Session Aborted and R encountered a fatal error

I have been using Rstudio for a while and there was no problem until I was trying to install rJava and xlsx package in R. I had updated both my RGui and Rstudio

How to use location marking in leaflet package in R

I have added two markers on leaflet map, and I want to link those markers (like travelling from one location to the other). How can I do that? The code that I u

Remove parentheses and text within from strings in R

In R, I have a list of companies such as: companies <- data.frame(Name=c("Company A Inc (COMPA)","Company B (BEELINE)", "Company C Inc. (Coco)", "Company

Rolling mean, standard deviation in dbplyr

I want to set a new variable with rolling function (rolling mean, stdev...etc.) in dbplyr Here is a database library(odbc) library(DBI) library(tidyverse) libra