similar to: Plotting a zoo object: lines and barplot

Displaying 20 results from an estimated 20000 matches similar to: "Plotting a zoo object: lines and barplot"

2012 Apr 23
2
subset daily to monthly in a zoo or xts
Dear R users, I want to subset a daily zoo series according to its month, find % of "NA" in each month. I am finding it difficult to subset the daily dataset into monthly for the given operation.I am planning to do this for a huge dataset. Thanks in advance. Regards Vikram [[alternative HTML version deleted]]
2011 Mar 17
1
Using barplot() with zoo -- names.arg not permitted?
I've used barplot(), including the anmes.arg parameter, on data frames successfully, but I'm even newer to using zoo than I am to R. :-} I am working on a functon that accepts a data frame ("df") as its primary argument, extracts information from it to create a zoo, then generates a plot based on that. The data frame has a column called "time" which is a standard
2010 Jul 08
1
x-axis labels for barplot of zoo object
Hi Let's assume, I have a dataset of 1000 datapoints, which represent daily recordings of a measurement. They are stored as a ts object (see example below) Now I want to represent them as a barplot. I found the barplot in the zoo package, but I have one problem: the x-axis labels. I would like to have the x-axis labels as either years only (located at the beginning of the year), or
2012 Jul 27
1
Working with quantmod chartSeries and plot.zoo
Hi all, I'm a newbie to R and it has been very helpful to use your website. Unfortunately I've been struggling with my code now for two days so I wanted to ask few questions. I've been trying to create nice graphs to put into a pdf sheet but I'm having little problems with all the packages I've been using. So what I want to accomplish is create one pdf sheet with three graphs
2011 Sep 08
1
Seasonal and 11-day subset for zoo object
I have a zooreg object and I want to be able to generate a value for seasons and 11-day composites paste it onto my zoo data frame, along with year, month and days. Right now I have the following to work from: eg. dat.zoo.mdy <- with(month.day.year(time(dat.zoo)), cbind(dat.zoo, year, month, day, quarter = (month - 1) %/% 3 + 1, dow = as.numeric(format(time(dat.zoo), "%w")))) For
2010 Nov 23
2
Plot two zoo object with different indexes
Dear R community, I have the following two zoo objects: MONTHLY CPI > plot(z) > par("usr") [1] 1977.76333 2011.15333 70.39856 227.03744 > z=zooreg(cpius$Value,as.yearmon("1979-11"),frequency=12) > str(z) ?zooreg? series from Nov 1979 to Oct 2010 Data: num [1:372] 76.2 77 77.8 78.5 79.5 80.3 81.1 82 82 82.6 ... Index: Class 'yearmon' num [1:372]
2011 Jan 27
1
Problem converting zoo object (daily data) to a timeSeries object
When I try to convert the zoo object to a timeSeries object, which would allow me to utilize Rmetrics packages, I get an error message. > Data<-read.zoo("c:\\DOWUBSPRICING.txt,na.strings="NA",sep="\t",header=T) > is(Data) "zoo" > as.timeSeries.zoo(Data) Error in .local (.Object, . ) Is this happening because I am using daily data?
2012 May 28
2
zoo: variable gets modified at making zoo object
I'm doing: > alyL32007z <- zoo(alyL32007,alyL32007$time) > range(time(alyL32007z)) [1] "2007-01-01 00:00:00 UTC" "2007-12-31 23:30:00 UTC" But then, while the original variable is: > summary(alyL32007$NEE_st) Min. 1st Qu. Median Mean 3rd Qu. Max. NA's -15.340 -1.615 -0.054 -0.814 0.750 8.965 11124 the variable within the zoo object
2011 Jan 24
2
how to slice a zoo object
Hi Would anyone have any pointers on how to slice up a large zoo table. I have the following structure: - > str(ZOO_OBJ) ?zoo [1:632, 1:83] 30.4 30.4 30.4 30.4 30.3 ... ?- attr(*, "dimnames")=List of 2 ??..$ : NULL ??..$ : chr [1:83] "COL1" "COL2" "COL3" "COL4" ... ?- attr(*, "index")= POSIXct[1:632], format: "2009-05-01
2017 Sep 18
3
Convert data into zoo object using Performance analytics package
Dear All, While i am trying convert data frame object to zoo object I am getting numeric(0) error in performance analytics package. The source code i am using from this website to learn r in finance: https://faculty.washington.edu/ezivot/econ424/returnCalculations.r # create zoo objects from data.frame objects dates.sbux = as.yearmon(sbux.df$Date, format="%m/%d/%Y") dates.msft =
2010 Dec 21
1
How to suppress plotting for "xyplot(zoo(x))"?
Hi, I found the thread http://r.789695.n4.nabble.com/Matrix-as-input-to-xyplot-lattice-proper-extended-formula-syntax-td896948.html I used Gabor's approach and then tried to assign the plot to a variable (see below). But a Quartz device is opened... why? I don't want to have anything plot/printed, I just would like to store the plot object. Is there something like "plot =
2012 Mar 22
1
Questions on plotting using zoo toolbox: (1) dual axes (2)legend
Hi, I have three time series and I would like to plot them on the same graph such that two of them share left y-axis and the third uses right y-axis. rm(list=ls()) library(zoo) x1 <- read.csv(file="120322DBCdata.csv", header=TRUE) x1date<-as.yearqtr(1979)+seq(0,nrow(x1)-1)/4 x1zoo<-zoo(x1, x1date, frequency=4) x1zoodata<-cbind(x1zoo$D4GDP, x1zoo$D4NE,
2011 Sep 19
4
Results of applying na.omit on zoo object
I read in ?na.omit that it returns the object with incomplete cases removed. I interpret this to mean that any zoo object row where any column shows 'NA' will be removed from the data set. That's not what I need, since the 'NA' represents information in my context. However, what I would like to do is eliminate the rows where every column is 'NA'. When I aggregate
2011 May 26
2
zoo column names
I have a zoo object that contains 2 time series named "A-B" and "V1". When I create a third series "V2", the name of the "A-B" series is changed to "A.B". Although I could recreate the names for the 3 series I am wondering if there is a way of preventing the name change from happening ( ... maybe an equivalent of the keep.names=TRUE statement
2012 Feb 17
6
convert zoo object to "standard" R object so I can plot and output to csv file
Another newbie question I got the 1 minute spine interpolation and 15 mean aggregation working with many thanks to Gabor Grothendieck using Zoo functions. I got a tip from Hasan Diwan to look at xts but it seemed I would make better progress using code from Gabor. Now I'm having trouble plotting this zoo object. I'm thinking I want a function to "split" the zoo object back to
2011 Jul 22
2
Picking returns from particular days of the month from a zoo object
Hello, I would like to implement a "turn-of-the-month' trading strategy in R. Given a daily series of stock market return data as a zoo object, the strategy would go long (buy) four trading days before the end of the month, and sell the third trading day of the following month. How can I select these days, particularly the fourth day before and the third day after the turn of the
2011 Nov 13
2
cannot load zoo package
Using: Mac OS 10.7.2 R version 2.13.2 I cannot load the zoo package. The install runs fine but when trying to load it i get the following error: /Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so': dlopen(/Users/ntyhurst/Library/R/2.13/library/zoo/libs/i386/zoo.so, 6): Library not loaded:
2012 Aug 03
1
How can I read time series data to create zoo objects if I have two title lines?
Hello, This is a standard example in which I read the time series data from a csv file and create a zoo object: x0 <- read.csv(file="CPI.csv", header=TRUE) time_0<-as.yearmon("1981-01")+(0:371)/12 x0zoo<-zoo(x0, time_0) The data look like this: TIME CPI CPI_food CPI_Clothes CPI_House CPI_Rent 198101 62.1 55.34 103.45 65.24 61.43 198102 63.16 56.95
2011 Aug 29
3
replacing elements of a zoo object
Why doesn't this work? x = zoo(1:5, as.Date('2001-01-01')+1:5) x[as.Date('2001-01-05')] x[as.Date('2001-01-05')] = 0 x I think this is especially bad because it doesn't cause an error. It lets you do something to x, but then you can't see x again to see what it did. [[alternative HTML version deleted]]
2011 Nov 28
1
Superimpose two graphs
Dear R users, I want to superimpose two graphs as well as ensure that they should have same scale with same x & y axis. I am using following command but it does not ensure same scale. *pdf(file = "../RESULTS/RS1.simulated.pdf", width = 10, height =6)* *plot(Reserves.RS, col = 1:2, screen = 1)* *par(new= TRUE)* *barplot(RS.active, axes = FALSE)* *dev.off()* * * Regards Vikram