Category "r"

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

R ggplot date time major and minor axis breaks not aligning

I'm having a problem that I am surprised I haven't encountered before and that I can't see any answers about. I am plotting some date time data in ggplot and wa

Plotting the “Average ” curve of set of curves in ggplot2

My Question is exactly this one: Plotting the "Average " curve of set of curves but I am looking to implement the accepted answer (below) in ggplot. is it pos

`rgl` crashes R 4.2.0 in RStudio

The new release of R version 4.2.0 will crash when loading the rgl package if in RStudio. What can I do about it?

Compute the size of directory in R

I want to compute the size of a directory in R. I tried to use the list.info function, by unfortunably that follows the symbolic links so my results are biased:

Plotting multiple wordcloud (ggwordcloud) with other types of plots in ggplot2

I am trying to plot several wordclouds in a scatterplot and I wonder if one can control the position of a wordcloud in ggplot? As an example the code below over