R: get_googlemap() only works for square maps
I have been using the R package ggmap version 3.0.0 to download and plot google images in R. Recently I have discovered an issue when the map is not square. It seems that the size argument is not...
View ArticleFor loops for running a function on columns
I would like to run a test for each species of ant that I have (columns 9-13) that compares values in the following columns: Attack_count, Attack_percent, Survival_count, and Survival_percent. I want...
View Articleshell script with read input from R
I have a shell script #!/bin/sh read -p 'My_date : ' mydate echo $mydate and I want to run it from R, I've tried system(myshell_script.sh) but it doesn't seem to work, my Rstudio crashes.
View ArticleCreating tables using dbplyr::copy_to and RJDBC
Just trying to create a table through dbplyr using the copy_to function in a vertica database.I set up the database connection:vDriver <- JDBC(driverClass="com.vertica.jdbc.Driver",...
View ArticleHow to find the best Moving-average Crossings?
I want to filter out the best MA-Crossing (short/long-term) based on the Sharpe ratio. If possible, best with a heatmap. Can anyone help me with this?library(quantmod) getSymbols("^GSPC", src = "yahoo")
View ArticleFactor Analysis Between Cryptocurrencies and Fiat Currencies
I am currently working on a project that requires me to determine whether or not cryptocurrencies may be used as a global currency. I am working with a dataset which includes variables such as bitcoin,...
View ArticleNon-Latin characters show as question marks when using rodbc/odbc/dbplyr with...
I'm using dbplyr to get data from SQL-Server into R, but Chinese, Japanese and other non-Latin characters are appearing as "?". I'm using a windows machine.I've read through the following threads:How...
View ArticleSelect after a join with conflicting columns with dtplyr
If I run the following trivial example, I get the expected output:library(dplyr) library(dtplyr) library(data.table) dt1 <- lazy_dt(data.table(a = 1:5, b = 6:10)) dt2 <- lazy_dt(data.table(a =...
View ArticleProblem with shiny app creation and output in R
I'm very new in creating a shiny app. Need some help in resolving the errors. So, I have some data like below in file final.csv:structure(list(Samples = structure(c(1L, 12L, 23L, 34L, 45L, 46L, 47L,...
View ArticleCreate vector from split dataframe elements
I am using igraph and I would like to use the mark.groups function to specify some groups within the network. The function requires groups to be specified by vectors of numerical Node identifiers -...
View ArticleSourcing data into rstudio
My mentor and I ran through this code and now I need to find out how to access it from rstudio. Here's what he did:load first Excel file containing sample IDs, and Iowa Gambling Task scores (latency,...
View ArticleHow to calculate share rate in R?
I have a dataset as I've shown below:data <- tribble( ~id, ~click, ~engagement, 1, 1, 0, 2, 2, 3, 3, 3, 5, 4, 4, 6, 5, 5, 2, 6, 3, 4, 7, 8, 7, 8, 6, 1, 9, 7, 6, 10, 7, 3, ) My desired data is...
View ArticleMLM vs. MLMVS estimators in lavaan
I am conducting SEM with R lavaan package.When trying to estimate model parameters with:estimator="MLM" (ML with robust standard errors and a Satorra-Bentler scaled test statistic)andestimator="MLMVS"...
View ArticleRenegeIn other trajectory R (simmer package)
I'm new in R.I'm trying to simulate queueing with simmer.I want to enable Renege from "Typhon" to "Tornado". BUT my code creates a new trajectory to "Tornado" and what I need is just one "Torando"...
View Articleapplying regular expression keeping commas in R
I want to apply text cleaning with regular expressions on a dataset. However I want to keep commas because I will need to divide the text after cleaning it based on the commas (,). the problem is that...
View ArticleConditional mutating with regex in dplyr using rowSum
Let's say I have the following dftest = read.table(text = "total_score_1 total_score_2 partner_total_score_1 total_score_3 total_score_4 letter 1 -1 1 1 -1 B 1 1 1 -1 1 C -1 -1 -1 -1 1 A", header = T)...
View ArticleIs there a R function for reversing ad-stocked values, or converting ad-stock...
I have a vector of numeric values (a time series) where I know that an ad-stock carry-over transformation of 20% is applied to it. For instance, X1, X2, X3, … Xn (Pre-transformed time series) P1, P2,...
View ArticleAn alternative to `accumulate` that allows cumulative filtering?
I'm looking for an approach to do something like this# this doesnt work # accumulate(1:8, ~filter(mtcars, carb >= .x)) So that I can examine some summary statistics at different cutoff values. I...
View ArticleHow to summarise overlaps between data points
I have a data set of animals passing an RFID reader, it looks like this - ID date_time A 2019-11-02 08:07:47 B 2019-11-02 08:07:48 A 2019-11-02 08:07:49 A 2019-11-02 08:07:50 A 2019-11-02 08:09:12 A...
View ArticleR Can i store a location in something so i can reference it multiple times...
I have five files that are all part of the same thing and intermingled in them are occasional exports of csv files. Currently, i have the full path written out for each of them, but i had to change a...
View Article