joshuaulrich / joshuaulrich/quantmod
[R-Forge #5757] Adding option to turn off na removal (default is on)
- Dominant language
- R
- Stars
- 906
- Forks
- 233
- PR merge metrics
- No merged PRs in 30d
Description
Submitted by: Jonathan Flint
Assigned to: Nobody
[R-Forge link](http://r-forge.r-project.org/tracker/index.php?func=detail&aid=5757&group_id=125&atid=546)
This patch adds an option to `chartSeries` which allows the default behaviour with regard to removing NAs to be changed. The default is to remove NAs (`na.omit` behaviour); this change would allow for `na.omit = FALSE` to be explicitly set.
This is useful for cases where data gaps should be graphically represented.
```diff
Index: pkg/R/chartSeries.R
===================================================================
--- pkg/R/chartSeries.R (revision 611)
+++ pkg/R/chartSeries.R (working copy)
@@ -378,7 +378,7 @@
major.ticks='auto',minor.ticks=TRUE,
yrange=NULL,
plot=TRUE,
- up.col,dn.col,color.vol=TRUE,multi.col=FALSE,...
+ up.col,dn.col,color.vol=TRUE,multi.col=FALSE, na.omit=TRUE,...
) {
#sys.TZ <- Sys.getenv('TZ')
#Sys.setenv(TZ='GMT')
@@ -386,9 +386,9 @@
#if(!is.xts(x)) x <- as.xts(x)
x <- try.xts(x, error='chartSeries requires an xtsible object')
-
- x <- na.omit(x)
-
+ if(na.omit==TRUE){
+ x <- na.omit(x)
+ }
indexClass(x) <- "POSIXct"
if(!is.null(subset) & is.character(subset)) {
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in pkg/R/chartSeries.R at the chartSeries entry point and inspect the existing na.omit call. Verify the default behavior still removes NAs and that setting na.omit=FALSE preserves gaps in the plotted data. Done means both option behaviors work without changing other chartSeries options.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100