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

Image may be NSFW.
Clik here to view.

R Prophet add_regressor giving strange results

I'm trying (for the first time) to add an external variable to prophet with the add_regressor function, but the results I'm getting look wild. The dataset I'm using is freely available on kaggle (the...

View Article


Random Forest, SVM and Multinomial Logistic Regression with R

I know next to nothing about r or any type of coding. I am taking a class that requires analysis of data using r. My final project is to download and partition accelerometer data from smart watches. I...

View Article


Adding labels to individual % inside geom_bar() using R / ggplot2

bgraph <- ggplot(data = data, aes(x = location)) + geom_bar(aes(fill = success)) success is a percentage calculated as a factor of 4 categories with the varying 4 outcomes of the data set. I could...

View Article

Remove rows contains certain value from spatial dataframe

I want to remove the rows have certain values from the spatial dataframe since the standard R grep() seems not propagate through all slots of an sp class object. bd@data[- grep("xcluded",...

View Article

Image may be NSFW.
Clik here to view.

Draw a line between points of different shapes in ggplot2

Here is some dummy datad = data.frame( x = rep(1:8,2), y = c(1,1.2,1.5,2,2.6,2.9,3.1,3.2,0.7,1,1.2,1.9,2.4,2.62,2.95,2.95), color = rep(LETTERS[1:2], each=8), shape = c(rep("a",6), rep("b",2), rep("a",...

View Article


Image may be NSFW.
Clik here to view.

Is there way to calculate multiple new rows of a data frame based on previous...

I am creating a data frame (hoops) with three columns (t, x, y) and 700 rows. See code at bottom. In the first row, I have set column t to equal 0. In the second row, I want to have the column t be...

View Article

Week of year using bigquery / bigrquery and dbplyr? (equivalent of...

I'm trying to use bigrquery and dbplyr to get the week of the year that a date corresponds to (i.e. the same as lubridate::week(), i.e. library(lubridate) library(dbplyr) library(bigrquery)...

View Article

Can't access R plumber API on EC2 from local machine

Tried to build proof-of-concept for plumber API running on AWS EC2 instance.I successfully (I hope I did!) followed this post (Deploying a Plumber API on AWS EC2 Instance) up to step 7, with the...

View Article


R Bookdown - Customize width of TOC/Sidebar

Although I can change the width and position of different elements in the body of an r bookdown doc by modifying the page wrapper in the .css, is there a way to change the width of the sidebar by...

View Article


How to make dataframe out of lists?

I'm working on creating a dataframe with information from wikipedia pages. 1905 wikipedia pages to be exact. I'm using the following function with a list of page titles I have, under the dataframe...

View Article

dplyr: Is it possible to return two columns in summarize using one function?

Say I have a function that returns two scalars, and I want to use it with summarize, e.g.fn = function(x) { list(mean(x), sd(x)) } iris %>% summarize(fn(Petal.Length)) # Error: Column...

View Article

Rcpp::compileAttributes() not updating .R file

I am trying to build a package in R involving the Rcpp package. When I generated the package using the command Rcpp.package.skeleton("pck338").By default, the files rcpp_hello_world.cpp is included,...

View Article

Importing and merging files in loop

I have to combine datasets. They are .sav files, and I have 6-7 datasets per month, per year - a total of 13 years. That's a lot of datasets to import and combine, and I want to automate this using...

View Article


Image may be NSFW.
Clik here to view.

how to save an Cimg object with NAN value in r?

when manipulating images with {imager}, I subtract an image from the other, and shockedly found I can't save the image. After converting the image into data.frame, I conclude when NAN appears, the it...

View Article

Creating and saving multiple .xlsx files using for loop openxlsx

I am attempting to create save multiple formatted Excel files, each of which are subsetted from a certain data frame by a factor.This is an example of what I have tried so far# Create data df <-...

View Article


filtering dataframes from JSON inputs

I am trying to filter a data frame based on user input via a JSON file parsed into the script. Given the following inputs:#tibble to be filtered: > database # A tibble: 11 x 6 strain genotype...

View Article

Image may be NSFW.
Clik here to view.

Index in plot in R

I plotted the following data in R data$cm [1] 55.5 68.0 65.0 67.7 70.0 66.0 60.0 62.0 52.0 50.0 62.0 16.0 15.0 17.0 16.0 17.0 17.0 Using the plot function. plot(data$cm ,type = "l",col="red",...

View Article


How to sum df when it contains characters?

I am trying to prep my data and I am stuck with one issue. Lets say I have the following data frame:df1 Name C1 Val1 A a x1 A a x2 A b x3 A c x4 B d x5 B d x6 ... and I want to narrow down the df todf2...

View Article

dbplyr, dplyr, and functions with no SQL equivalents [eg `slice()`]

library(tidyverse) con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") copy_to(con, mtcars) mtcars2 <- tbl(con, "mtcars") I can create this mock SQL database above. And it's very cool that I can...

View Article

Is there a way to dynamically build the x axis variables

Set up a date frame a <- c(5, 10, 15, 20) b <- c(50, 100, 150, 200) c <- c(150, 200, 250, 300) d <- c("A", "B", "C", "D") df <- data.frame(a, b, c, d) names(df) <- c("XData1",...

View Article
Browsing all 201839 articles
Browse latest View live


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