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

make a interactive bar chart using plotly and shiny have color and a back button

I created an interactive bar chart in shiny and it is working well however there are 2 things I cannot get working. adding color to the bar chart for each region.having a back button so after you drill...

View Article


Cut nodes from a network

From this script it is possible to create a networklibrary(bibliometrix) D <- readFiles("http://bibliometrix.org/datasets/joi.txt") M <- convert2df(D, dbsource="isi",format="plaintext") M <-...

View Article


Image may be NSFW.
Clik here to view.

Understanding what exactly neural network is predicting in documentation...

I've taken a quick course in neural networks to better understand them and now I'm trying them out for myself in R. I'm following this documentation of Keras.The way I understand what is happening:We...

View Article

Trouble with loop in R

I am still pretty new to programming in R, and loops always seem to trip me up. What I am trying to do is compare my capacity to demand, and take the smaller of the two values to calculate profit. In...

View Article

Rename Columns Based On Vector

set.seed(0) data=data.frame("V1"=sample(1:10,size=4,rep=T), "V2"=sample(1:10,size=4,rep=T), "V3"=sample(1:10,size=4,rep=T), "V4"=sample(1:10,size=4,rep=T)) names = data.frame("vars"=c("V1", "V2", "V3",...

View Article


R: access element in a column of lists with data.table

I'm using data.table to store a big array of objects, and I want to access one of those objects, but it always returns the result wrapped in a list.library(data.table) a1 = hist(1:10) a2 = hist(2:11)...

View Article

Splitting one column into two columns using data wrangling with R

I would really appreciate your help in using R for data wrangling. I have a data where I want to split one column (variable) into two whenever applicable as conditioned by other variables. For example,...

View Article

Rolling median by group

I know variations of this question have been asked and answered 1,000 times. I've read every post and tried to implement what I read without success. I have a dataframe of basketball individual game...

View Article


How to calculate direct and indirect standardized rates by subgroups in R?

Using below example data, I am trying to calculate direct and indirect standardized rates by subgroups such as year, region and sex using "ageadjust.indirect" and "ageadjust.direct" functions in R, but...

View Article


Creating multiple dataframes in a loop in R

I am new to R and I don't know how to create multiple data frames in a loop. For example: I have a data frame "Data" with 20 rows and 4 columns: Data <- data.frame(matrix(NA, nrow = 20, ncol = 4))...

View Article

Overlaying two quick plot all variables from several data frames

I have uploaded a datafame and done a quick plot of all variables using: df %>% keep(is.numeric) %>% gather() %>% ggplot(aes(value)) + facet_wrap(~ key, scales = "free") + geom_histogram()...

View Article

Setup Global Options of RMySQL to use with sqldf in R

I am having a lot of problems with the coding of columns using sqldf and Rpostgree (when I do querys in datasets that contain letters of the Spanish language it converts them into strange characters),...

View Article

transforming R function output to match format of Python function output

translating a Python function to R I try to add more data while iterating through values which I split using strsplit() in R. The return value of the original Python function is a list of lists so this...

View Article


map and store results in nested tibbles

I am trying to map multiple models over some data and store the results in something similar to a nested tibble or multiple lists. I would like to apply the models in the same pipe. I run the...

View Article

Error in ggmap, "must be an array" and "HTTP 400 bad request"

I'm trying to call a map from google maps using ggmap. Example code: get_googlemap(center = c(lon = -56.67, lat = 51.47), zoom = 8, size = c(640, 640), scale = 2, format = "png8", maptype =...

View Article


How can I get info from multiple (435) webpages using readLines and a loop in R?

I am trying to scrape data from the open secrets webpage regarding the 2018 US congressional election. There is a different URL for each district. Using readLines on a single URL give me exactly the...

View Article

Use dplyr's _if() functions like mutate_if() with a negative predicate function

According to the documentation of the dplyr package:# The _if() variants apply a predicate function (a function that # returns TRUE or FALSE) to determine the relevant subset of # columns. #...

View Article


Is there a way to find a two sided confidence interval (by applying a t test)...

I think I worded the question poorly in the title. Basically, I'm supposed to generate 10000 samples (of size 20) from a Laplace/Double Exponential distribution (Laplace(1/2), E[x] = 1/2). I've done...

View Article

Using dplyr instead of lapply

I have a dataframe with a bunch of start and end dates and I am looping through a list of dates and seeing how many rows in my dataframe are 'open' during that date on the list (i.e. the start date has...

View Article

Set a document-persistent ggplot2 color theme

I would like to define a color palette for every plot built in a markdown document. In essence this would overwrite the default choices. There are several very old answers -- thanks for the links here...

View Article
Browsing all 206180 articles
Browse latest View live


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