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

Replace month abbreviation with number

For example: df$DateSN Date 1 07-Mar-2019 2 06-Feb-2019 how do I set a condition to replace the value "Mar" = "03" and "Feb" = "02" in df$Date?So that the output will be:SN Date 1 07-03-2019 2...

View Article


Cross validation in R vs scikit-learn for linear regression R2

I have a simple linear regression model as such:Y = Mean_energy , X = A + BMy dataset consist of only 20 rows.Therefore, to obtain R2 of the model, I did a 5-fold cross validation (cv).To do cv in...

View Article


converting month and day column to corresponding numbers in R and divide...

I am reading data from UCI repository into table.forestfire <- read.table(file = "http://archive.ics.uci.edu/ml/machine-learning-databases/forest-fires/forestfires.csv", header = TRUE, sep = ',')...

View Article

Image may be NSFW.
Clik here to view.

Plot has several small graphs on one page

How do I plot only one graph on each page? The plot function plots graph on one page like in the screenshot until it's full. Thanks in advance!

View Article

Count food types by state in R

I would like to find the number of food types sold in each state. So count food per state using R. This requires me to compare between two variables in my dataset. How would I code for this in R?

View Article


Sending R Markdown output as body email via outlook (RDCOMclient) - R version...

I use this exact code (Sending R Markdown output as body email via outlook (RDCOMclient)) and it worked just fine, until I update my version of R to 3.6.1. I also tried the 3.5 version of RDCOMClient...

View Article

How to get classification values in RWeka?

can anybody explain how I get the results of each leave in a decision tree made by J48 from the RWeka package?So for example we have this iris dataset in R: library(RWeka) m1 <- J48(Species ~ .,...

View Article

split the superhero names with their ages in the given vector

Given this vector: vector <- c("Superman1000", "Batman35", "Wonderwoman240") I want to split the superhero's name and age.df=data.frame(vector= c("Superman1000", "Batman35", "Wonderwoman240"))...

View Article


Variable number of arguments in r decision tree

Thanks for any help - I'm building a decision tree in R, and the classic example isiris_ctree <- ctree(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, data=iris)My question is:...

View Article


for loop transferring to foreach in R language

I am trying to find a connection between for loop and foreach function, but all the examples are so basic that I am lost in my huge loop. Can someone help me to understand how to make it?I have these...

View Article

How to make different font sizes on graphs with specific point sizes

I'm trying to get specific font sizes for scatterplots based of Nature guidelines. I'm told to keep all my point sizes for text at 7 so I've used par(ps = 7). However, I need a different font size for...

View Article

Image may be NSFW.
Clik here to view.

Labels overlapping on Stacked bar chart ggplot2

The code below generates an appropriately stacked bar chart. However, I am trying to add labels to show the percentage in each fill location. With the code below, the percentage labels do not align...

View Article

Image may be NSFW.
Clik here to view.

ggplot - geom_segment() with mutiple arrows

I am working on Principal Component Analysis (PCA). I found ggfortify works great but would like to do some manual adjustments.Here then trying to plot the PCA results as below: evec <-...

View Article


session not created: This version of ChromeDriver only supports Chrome...

I'm trying to run RSelenium using the rsDriver function, but when I run rD <- rsDriver() I get a message telling me I need a newer version of Chrome:> rD <- rsDriver() checking Selenium Server...

View Article

twListToDf function not found in TwitteR Package (R)

I would like to enquire why my program couldn't work as I have manually installed the twitteR package.library(twitteR) setup_twitter_oauth(api_key, api_secret, access_token, access_secret) no_of_tweets...

View Article


Image may be NSFW.
Clik here to view.

Using existing lines as geom_ribbon() min and max

So I have three lines that I'm charting. The upper and lower lines are the confidence interval, so I'd like to use geom_ribbon() to fill in the area between the lines with color. But I haven't been...

View Article

fPortfolio: Error when running LPM optimization

When I run a meanLPM optimization I get the following error:Error in match.fun(spec@model$param$tau) : 'spec@model$param$tau' is not a function, character or symbolI have already set the estimator to...

View Article


readxl::read_xls returns "libxls error: Unable to open file"

I have multiple .xls (~100MB) files from which I would like to load multiple sheets (from each) into R as a dataframe. I have tried various functions, such as xlsx::xlsx2 and...

View Article

manipulating glue-generated title on my gganimate

I have created a basketball animation using gganimate, as seen below. You can get the full animation on my blog post (Look at animation under "Paul Pierce Isolation").NBA AnimationNow, there is one...

View Article

Update R base - Ubuntu from 3.4.4 to 3.5.2 - Azure

I'm using Ubuntu 16.04 on Azure Linux Virtual Machinelsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial The current R...

View Article
Browsing all 206180 articles
Browse latest View live


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