Question
Hello I'd like to plot my data frame using R programming. my data frame is in csv file, so I imported into my R studio.
Hello
I'd like to plot my data frame using R programming.
my data frame is in csv file, so I imported into my R studio.
I used codes
library(zoo)
month = as.yearnom(data$Month)
newdata= data.frame(Month,Sales) par(mfrow=c(2,2),oma=c(0,0,0,0)) plot(newdata,type='l',xlab='year and month', ylab='Log of sales')
However, the code month = as.yearnom(data$Month) generates
month [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [22] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [43] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [64] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA [85] NA NA NA NA NA NA NA NA NA NA NA NA
I'd like to plot so that i can see the date according to months.
How do I do this ?
These are the data I used
Month Sales Jan-62 2.851 Feb-62 2.672 Mar-62 2.755 Apr-62 2.721 May-62 2.946 Jun-62 3.036 Jul-62 2.282 Aug-62 2.212 Sep-62 2.922 Oct-62 4.301 Nov-62 5.764 Dec-62 7.132 Jan-63 2.541 Feb-63 2.475
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started