Displaying 20 results from an estimated 4000 matches similar to: "Problem in reading data"
2008 Sep 10
2
Woring message in as.yearmon()
I have following dataset:
> res
[,1] [,2] [,3]
[1,] 1946 4 1.27
[2,] 1946 5 1.27
[3,] 1946 6 1.27
[4,] 1946 7 1.27
[5,] 1946 8 1.52
[6,] 1946 9 1.52
[7,] 1946 10 1.52
[8,] 1946 11 1.52
[9,] 1946 12 1.62
[10,] 1947 1 1.62
[11,] 1947 2 1.62
[12,] 1947 3 1.62
[13,] 1947 4 1.87
[14,] 1947 5 1.87
[15,] 1947 6 1.87
Now I write following code
2009 Sep 13
3
How to get last day of a month?
Is there any R function to calculate automatically the last day of a
particular month? For example "sep2009" should be converted to last day of
September of 2009?
Thanks
--
View this message in context: http://www.nabble.com/How-to-get-last-day-of-a-month--tp25425645p25425645.html
Sent from the R help mailing list archive at Nabble.com.
2008 Mar 03
1
Formating a zoo dataset .
Suppose I have following dataset :
> head(data1)
Date Return
1 03/31/00 0.14230650
2 04/28/00 -0.03276228
3 05/31/00 -0.06527890
4 06/30/00 -0.04999873
5 07/31/00 -0.01447902
6 08/31/00 0.22265729
Now I convert it to zoo object :
> data11 = zoo(data1[,2], as.Date(data1[,1], format="%m/%d/%y"))
> head(data11)
2000-03-31 2000-04-28 2000-05-31
2010 Oct 15
7
Problem with merging two zoo objects
Dear all, I have following 2 zoo objects. However when I try to merge those 2 objects into one, nothing is coming as intended. Please see below the objects as well as the merged object:
> dat11
V2 V3 V4 V5
2010-10-15 13:43:54 73.8 73.8 73.8 73.8
2010-10-15 13:44:15 73.8 73.8 73.8 73.8
2010-10-15 13:45:51 73.8 73.8 73.8 73.8
2010-10-15 13:46:21 73.8 73.8 73.8 73.8
2009 Sep 24
2
Downloading data from from internet
Hi all,
I want to download data from those two different sources, directly into R :
http://www.rateinflation.com/consumer-price-index/usa-cpi.php
http://eaindustry.nic.in/asp2/list_d.asp
First one is CPI of US and 2nd one is WPI of India. Can anyone please give
any clue how to download them directly into R. I want to make them zoo
object for further analysis.
Thanks,
--
View this message in
2008 Oct 11
5
Extracting subset of a vector
I have 2 vecros :
x<-c(100,96,88,100,100,96,80,68,92,96,88,92,68,84,84,88,72,88,72,88)
x1 = sample(x, 5, replace=FALSE)
Now i want to get remaining values of vector "x" those are not member of vector "x1". Can anyone please tell me how to do that?
2010 Jan 01
1
Chainging monthly data to daily data
Hi, I have a zoo object with monthly frequency :
library(zoo)
dat <- zooreg(rnorm(50), as.yearmon("2000-01-01"), frequency=12)
Now I want to make a zoo object with daily frequency from "dat" wherein
value for a each day for a particular month will be value of "dat" at that
particular month.
Is there any easy way to do that?
Thanks,
--
View this message in
2010 Jul 12
3
How to create sequence in month
Hi all, can anyone please guide me how to create a sequence of months? Here
I have tried following however couldn't get success
> library(zoo)
> seq(as.yearmon("2010-01-01"), as.yearmon("2010-03-01"), by="1 month")
Error in del/by : non-numeric argument to binary operator
What is the correct way to do that?
Thanks for your time.
2010 Apr 18
4
confused with yearmon, xts and maybe zoo
R-listers,
I am using xts with a yearmon index, but am getting some inconsistent
results with the date index when i drop observations (for example by using
na.omit).
The issue is illustrated in the example below. If I start with a monthly
zooreg series starting in 2009, yearmon converts this to "Dec-2008". Not
such a worry for my example, but strange. Having converted to xts, i drop
2008 Nov 04
2
ggplot & annotating charts
Dear "R-listers"
I've been trying to figure out how to annotate charts in ggplot (ie add text
to line charts, highlighted boxes etc). By and large, I can get close to
what i want with base graphics, but would ideally like to use ggplot
whenever possible (additionally, i would like to add text labels
automatically to the chart). The code is below
I suspect I need to use geom_rect,
2010 Apr 08
2
xts off by one confusion or error
Hullo
I may have missed something blindingly obvious here. I'm using xts to
handle some timeseries data. I've got daily measurements for 100
years. If I try to reduce the error rate by taking means of each
month, I'm getting what at first sight appears to be conflicting
information. Here's a small subset to show the problem:
A small set of data:
> vv
x
2012 Nov 17
3
Reshaping a dataframe
Seems like this should be easy but I'm struggling a bit. How do I rearrange a
data frame to go from the first one to the second shown below ?
State Date lbs
TX 200701 400
TX 200702 650
TX 200703 950
TX 200704 1000
FL 200701 200
FL 200702 300
FL 200703 500
FL 200704 333
NJ 200701 409
NJ 200702 308
NJ 200703 300
NJ 200704 800
Date TX FL NJ
200701 400 200 409
200702 650
2011 May 19
1
Creating a "shifted" month (one that starts not on the first of each month but on another date)
Hello!
I have a data frame with dates. I need to create a new "month" that
starts on the 20th of each month - because I'll need to aggregate my
data later by that "shifted" month.
I wrote the code below and it works. However, I was wondering if there
is some ready-made function in some package - that makes it
easier/more elegant?
Thanks a lot!
# Example data:
2009 Jan 23
1
extract certain months toyears (zoo)
Dear useRs and developeRs,
In my diploma thesis I work with a daily time series of glacier runoff
data.
I did already aggregate them to monthly means etc.
Now i want to use just the summer values (I am indecisive by now what
that means, but let's make it easy and use months like June).
Is there a way to extract the data off this zoo into another zoo with
frequency=1 ?
Do you have
2005 Dec 19
3
given a mid-month date, get the month-end date
I have a vector of dates.
I wish to find the month end date for each.
Any suggestions?
e.g.
For 12/15/05, I want 12/31/05,
For 10/15/1995, I want 10/31/1995, etc
__________________________________________________
[[alternative HTML version deleted]]
2011 Aug 24
1
setMethods/setGeneric problem when R CMD CHECK'ing a package
R-helpers:
I'm trying to build a package, but I'm a bit new to the whole S3/S4
methods concept. I'm trying to add a new definition of the zoo
function "as.yearmon", but I'm getting the following error when it
gets to this point during a package install:
***
R CMD INSTALL STARStools
* installing to library
2010 Oct 25
3
finding the year of a date
I know that I can use as.yearmon in the package "zoo" to find the year
and the month of a date.
I can use as. yearqtr to find the year and the quarter.
But how can one find just the year of a date?
Thanks a lot!
--
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com
2008 Mar 15
1
Fwd: Re: How to create following chart for visualizing multivariate time series
Thanks David, It is working. Holtman's also gave me a solution but, I wanted to have a color pallet for description of colors, that was not in his solution.
However I need one small modification. If I want to plot only lower diagonal elements of 'dat' then how should I proceed? What I want is, to visualize only lower diagonal elements and having the color pallet on them only. Also
2010 Aug 13
3
transforming dates into years
Hello!
If I have in my data frame MyFrame a variable saved as a Date and want
to translate it into years, I currently do it like this using "zoo":
library(zoo)
as.year <- function(x) as.numeric(floor(as.yearmon(x)))
myFrame$year<-as.year(myFrame$date)
Is there a function that would do it directly - like "as.yearmon" -
but for years?
Thank you!
--
Dimitri
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 =