Quantcast
Channel: Active questions tagged r - Stack Overflow
Browsing all 204742 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

How to highlight a point along a curve in ggplot

I have the below code to plot a probit model comparing the chance of success based on a maximum temperature value. Seems to work well, I'm happy with the plot. But I'm hoping to highlight the point...

View Article


How to use the 'stl' function for seasonal decomposition on training data?

For a school project I have to do some coding in R and comment on the results found. Currently, I am a bit stuck here. Let me show my code first:# Create time series object tsTradeBalance <-...

View Article


Merging data frames with partial Matching using R

Lets say I have data frame df1 with the following variablesContinent Country 1 Europe Russia 2 Asia Myanmar (Burma) 3 africa Benin 4 africa Botswana 5 africa Burkina and df2 with the following...

View Article

Create Extra Large Table in R

I need to generate big table which contents more than billion rows. Existing I use expand.grid(rep(list(n),k)) but the error message raised saying that need to allocate memory. I don't it's a proper...

View Article

I have no idea how this comes as an R function! How would you go about this?...

Create a function in R named counts. This function should take as parameters a numeric vector x and also a number indicating a number of bins n. The function will consider the range [min(x), max(x)],...

View Article


How do I go about resolving "package ‘ddply’ is not available (for R version...

I'm trying to install the package "ddply" but keep getting this responseinstall.packages("ddply") Warning in install.packages : package ‘ddply’ is not available (for R version 3.6.2)Any ideas on how to...

View Article

Calculating lm() within a loop

Objective: The overall objective of the problem is to calculate the confidence interval (CI) of various sample sizes (n=2,4..1024) of rnorm, 10,000 times and then count the number of times each one...

View Article

How to manipulate elements in Rcpp::String

Is there possible to manipulate individual characters with Rcpp::string object? I need to do some string substitutions while keeping encodings, so I think Rcpp::string might help.What I want to achieve...

View Article


Conditionally Remove duplicates and collapse a dataframe

I've a dataframe as under:+------+-----+ | from | to | +------+-----+ | 1 | 3 | | 1 | 5 | | 2 | 1 | | 2 | 3 | | 2 | 6 | | 3 | 6 | | 4 | 5 | | 4 | 8 | | 5 | 9 | | 6 | 10 | | 6 | 2 | | 6 | 4 | | 7 | 5 |...

View Article


Run a reproducable solution

I try to run these command which are from this:library(bibliometrix) # Loading txt or bib files into R environment D <- readFiles("http://bibliometrix.org/datasets/joi.txt") # Converting the loaded...

View Article

Looping over a set of dataframes in R

I an new to R and have a quick doubt (have gone through a lot of questions on stack-overflow but to no avail). I have created a function (as can be seen in my code) where x and y are dates and $z_{1}...

View Article

concatenate a string into a numeric vector

Suppose I have a long string of numbers "1010101010101010100011011". I would like to separate them by a "," like so "1,0,1,0,1,0,1,1,..." and then transform into a numeric vector like this...

View Article

Image may be NSFW.
Clik here to view.

Upload error in basic shiny app in shinyapps.io portal

A very simple shiny app with upload feature is working locally but not on shinyapps.ioCode : ui <- shiny::fluidPage( fileInput("file", "Upload file") ) server <- function(input, output){ }...

View Article


Installing package from source R

I have an R package that I would like to install from here, and as instructed by the authors, the way we should install it is as follows:install.packages("uba_0.7.7.tar.gz",repos=NULL,dependencies=T)...

View Article

convert character column into datetime column in r , "04/19/19 08:46 " this...

i have this "04/19/19 08:46"value in Order.Date column. Order.date column is in character type but i want that column to be in datetime type.how can i do that. the name of the dataframe is...

View Article


mutate_at is not applied to all columns selected

I am trying to subtract one column from all others but not all columns are modified. test <- tibble(a = 1:3, b = 2:4, c = 3:5, d = 4:6, e = 5:7) col = 'd' test %>% mutate_at(vars(-a), funs(. -...

View Article

Image may be NSFW.
Clik here to view.

displaying `shape` values in `ggplot2` plot annotations

I want to display the shape value (shape argument for geom_point function) in the plot annotation.Below, for example, I am just writing 'point shape' where I actually want the shape itself to be...

View Article


making sense of a for loop with an if statement in R

This is a practice question to prep for an exam. We are given this code:x=c(T,T,F,T,F) for (i in 1:5){ if(i > 1 & i < 5){ x[i ] = x[i-1] & x[i+1] & x[i] print(x) } } and asked to...

View Article

Zoom shiny leaflet world map to full width

Does anyone know how to set default render zoom of a Shiny Leaflet map so a full world map zooms to fit the window width (i.e. -180° to 180° properly fits the window)? I can only set zoom to integers,...

View Article

map over and change column names from a data frame

I have a data frame and a list. The list consists of 12 lists and the data frame consists of 12 rows and 2 columns. How can I map over the lists and change each of the list column names according to...

View Article
Browsing all 204742 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>