Forum Discussion
pch and col function not working in R using Power BI
- 9 years ago
Hi abhishekpati86,
The chart is only able to show the year range under R when using the as.date (date format) function in R.
d1 <- aggregate(dataset$sales ~as.Date(dataset$date, orgin="%m/%d/%Y"), data=dataset,FUN=sum)
plot(d1,main="date Vs sales",pch=22,col="blue",xlab="date", ylab="sales",ylim=c(500,800))
The below is the as.date function reference:
https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.Date.html
See the result:
Check and see if this would be helpful. I will also take a further look into the X range part, and if any helpful things, I will post back.
Regards
Hey,
Below is the rcode I am using.
d1 <- aggregate(dataset$Count ~ dataset$Completed_Date,data = dataset,FUN=sum)
plot(d1,main="Completed Date Vs Count of Course Test Takers",pch=22,col="blue",xlab="Completed Date",ylab="Count of Course Test Takers",ylim=c(0,1000))
I have loaded a bunch of packages on R (version 3.3.1) and here goes the sample data.
OK, just as another quick question, in your R IDE outside of Power BI Desktop does it work correctly?
- abhishekpati869 years agoHelper III
Hi,
I haven't uploaded this particular dataset but normal pch and col commands works fine on other dataset in my R Desktop.
Thanks,
Abhishek
- abhishekpati869 years agoHelper III
Hi All,
I was able to solve the last issue but now I am not able to format the X axis dates to mm-dd-yyyy format.
Currently my date field in x axis is showing in yyyy-mm-dd hh:mm:ssss.
Thanks,
Abhishek
- v-micsh-msft9 years agoMicrosoft Employee
Hi abhishekpati86,
The chart is only able to show the year range under R when using the as.date (date format) function in R.
d1 <- aggregate(dataset$sales ~as.Date(dataset$date, orgin="%m/%d/%Y"), data=dataset,FUN=sum)
plot(d1,main="date Vs sales",pch=22,col="blue",xlab="date", ylab="sales",ylim=c(500,800))
The below is the as.date function reference:
https://stat.ethz.ch/R-manual/R-devel/library/base/html/as.Date.html
See the result:
Check and see if this would be helpful. I will also take a further look into the X range part, and if any helpful things, I will post back.
Regards