How to code temporal auto-correlation for irregular-spaced observational data...
I have irregular-spaced observational count data that I'm testing for a statistically significant annual trend (by season). I want to include a temporal auto-correlation term in my model as well, but...
View ArticleWhy does load() not return the data saved with save()?
When I save a data.frame in R's internal format with save() and then reload it with load(), I do not obtain the saved data:> head(iris, n=1) Sepal.Length Sepal.Width Petal.Length Petal.Width...
View ArticleHow to solve rotl/Rcpp "package or namespace load failed for 'rotl'" error...
install.packages("rotl")The downloaded binary packages are in /var/folders/88/_6w75n9j3r37kp0783xz43z80000gn/T//RtmpdtGKWZ/downloaded_packageslibrary(rotl)Error: package or namespace load failed for...
View ArticleHow do I stop a chart from showing on R markdown?
AimsI have got the ouput that I want i.e. an interactive tree map. Yet, the R Markdown output also shows the static tree map, which I do not want to include.I also want to adjust the font size on the...
View ArticleGetting an error "number of items to replace is not a multiple of replacement...
I'm trying to convert a record into a date and time format using the strptime function. However, I'm not sure why I'm getting the error: number of items to replace is not a multiple of replacement...
View ArticleYear column and Month column into Date column R
I have a dataframe with 2 date columns (year and month), and I would like to merge them into 1 (I will use that column on the x-axis for plotting).How can I merge them so the values in it will look...
View ArticleHow do I write a function that takes a matrix and a vector as inputs, loops...
The function should perform t-tests on the data in each of the matrix's columns, testing the mean of the control group against the mean of the treatment group, and return a vector of t-statistics.My...
View ArticleHow to save a dm package visualization
How do I save a visualization from the dm package? I am currently using the viewer to save images made with dm_draw, but this is producing low resolution images, which is not...
View ArticleHow to copy multiple data frames to a SQLite database in R
I have ~ 250 CSV files I want to load into a SQLite database. I've loaded all the CSVs into my global environment as data frames. I'm using the following function to copy all of them to db but get an...
View ArticleHow do I resolve "Error: invalid version specification ‘0,2’" when I use the...
I want to use the function dm_draw() to visualize a DM package object, but when I ran the command I get the error messageError: invalid version specification ‘0,2’I've tried the code included in the...
View ArticleHow to view specific ERD from Postgres database in R using the dm package
I have built a database with a handful or schemas that have separate entity relationship diagrams (ERDs). I can view those ERDs in my database GUI (dbeaver) but I would like to view schema specific...
View ArticleCenter output from dm_draw
It seems like the output from the datamodeler package (dm) doesn't respect rmarkdown chunk option fig.align. Any suggestions on how to center the output?---title: "dm_draw test"output:...
View ArticleUsing apply() and only base R, how do I write a function that takes a matrix...
The function takes these inputs:A 200x1000 matrix (200 individuals, 1000 experiments)A vector of length 200 with group assignments 0 ("control") and 1 ("treatment")Performs t-tests on the data in each...
View ArticleError in cor(x, use = use) : supply both 'x' and 'y' or a matrix-like 'x'
I am using the psych package,following code I tried:library(psych)str(price_per_d)Least_appealing <-subset(zdf_base, select=c("price_per_h", "price_per_d", "mileage", "one_way_option",...
View Articleno method for coercing this S4 class to a vector for utilization of mclust
I'm trying to use the mclust method on an .FCS format file (which is a flow cytometry format file) and I read this file into R as flowFrame object. install.packages("openCyto") # since the old version...
View ArticleRandom lines on geom_tile plot
I'm trying to make a heatmap geom_tile plot of a large number of sequential scans. This is what I have right now:The thick horizontal lines are genuine missing observations which need to remain as...
View ArticleLooking for advice on how to work with json files that sort data in atypical...
I'm working with a json file in R that seems to have a somewhat odd format for a class assignment in both R and Python:{"data": [ { "British Columbia": "BC", "BC": "4.63" }, { "Alberta": "AB", "AB":...
View ArticleR Markdown won't knit even though my code chunks work
For some reason, my code chunks work but when I try to knit the file, I have an "object not found" error. Here's the chunk which causes the error:library(ggplot2)library(tidyverse)library(dplyr)chart2...
View ArticleHow to access the entire source code of a function that has...
I am trying to extend the functionality of the RQuantLib package and need to access the entire code behind the DiscountCurve function.The result I get is:library(RQuantLib)DiscountCurvefunction...
View ArticleIs there a way to print an empty vector as 'zero' in R?
I am creating a monthly report to summarise the field sites where certain data were collected, since the last month. I am currently using R Markdown and knitting to a word.docx.Each field site has a...
View Article