Category "r"

dcast warning: ‘Aggregation function missing: defaulting to length’

My df looks like this: Id Task Type Freq 3 1 A 2 3 1 B 3 3 2 A 3 3 2 B 0 4 1 A 3 4 1

How to display all the months (axis ticks/breaks) on the following dygraph? (R)

Following R code and data provided, uses the dygraph library (R interface for the js dygraph) library(xts) library(htmlwidgets) library(dygraphs) date <- c(

Levelplot color key - range and extremes

Is it possible in R to create a color key like the one below? (this one comes from the software Grid Analysis and Display System - Grads). There are two fe

Colors for heatmap in R

I'm making a heatmap in R, but being very new to R, I have some questions: My data is a big matrix 21 columns and 89 rows, containing numbers from 0 to 16. I w

R-Package Building: How to Modify @source Line While Documenting Data to be Included in My R Package

I am trying to include data in a package I am just building, I included the data object as follows: set.seed(289805) x <- room(10, mean = 0, var = 1) I got

How to add a total distance column in 'flights' dataset? DPLYR, Group_by, Ungroup

I am working with 'flights' dataset from 'nycflights13' package in R. I want to add a column which adds the total distance covered by each 'carrier' in 2013. I

R plotly waterfall with offset base: hovertext activated on hover at wrong position

Recently, when using an offset (a non-zero base parameter) in a waterfall plot in plotly, I noticed that the boxes with hoverinfo were activated when the mouse

R: Warning: Error in curl::curl_fetch_memory: Timeout was reached: [www.quandl.com] Connection timed out after 10015 milliseconds

I am facing an issue while importing data from Quandl API in R. I have also tried to use the API key but no matter what i do, everytime i get this same error. I

R:Error in `[.data.frame` undefined columns selected

I have this data sample dput() timeseries=structure(list(sales_point_id = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,

Graph learning in R, igraph, tidygraph

I have a graph with each node having a value (value in red). I would like to do the following two things (I guess 1 is a special case of 2): Each node should b

Removal of constant columns in R

I was using the prcomp function when I received this error Error in prcomp.default(x, ...) : cannot rescale a constant/zero column to unit variance I know I

Adding shading alternate areas for categorical variable in a bar plot in ggplot2

I am trying t o plot a bar plot using ggplot2as follows: library(ggplot2) ggplot(mtcars, aes(factor(carb))) + geom_bar() + coord_flip() x axis is a con

Get response header

I would like to get response headers from GET or POST. My example is: library(httr) library(RCurl) url<-'http://www.omegahat.org/RCurl/philosop

Unable to install R packages due to library not found

In any R package I try to install, I get the following error message: ld: library not found for -lintl collect2: error: ld returned 1 exit status make: *** [utf

ANOVA and Blocking Design

I have a field experiment carried out with trees in which we have planted different genotypes in a little plantation following a randomized complete block desig

R Table Conditional Format applied to cells within a row

I'm trying to apply conditional formatting based on data within a row. I've tried a number of libraries including DT, Reactablefmtr and formatter. The idea is t

Fill white gaps in geom_area

I have a dataframe with daily datas for some factors ("fill" var) I would like to plot an area plot with the ggplot2::geom_area function but there could be miss

How to download files in a moodle course using R?

There is a moodle course with files that I wish to download automatically. I see that there is a python solution for doing so, but I couldn't find an R solution

Error: `t.haven_labelled()` not supported while attempting MICE package in R

Here is my sample code: library(haven) community_surveys <- read_sav("community_surveys.sav") diss_data <- as.data.frame(community_surveys) diss_data$F

How to get exclusive date ranges?

I would like an object that gives me a date range for every month (or quarter) from 1990-01-01 to 2021-12-31, separated by a colon. So for example in the monthl