Displaying 20 results from an estimated 1700 matches similar to: "Extracting Elements By Date"
2010 Jun 08
1
Filtering out a data.frame
Sample Data.Frame format
Name is Returns.nodup
X id ticker date_ adjClose totret RankStk
427225 427225 00174410 AHS 2001-11-13 21.66 100 1235
"id" uniquely defines a row
What I am trying to do is filter out id's that have less than 1500 data
points (by date)
First, I used
total<-by(Returns.nodup, Returns.nodup$id,nrow)
which subsetted by
2010 Jun 04
5
R Newbie, please help!
Hello Everyone,
I just started a new job & it requires heavy use of R to analyze datasets.
I have a data.table that looks like this. It is sorted by ID & Date, there
are about 150 different IDs & the dataset spans 3 million rows. The main
columns of concern are ID, date, and totret. What I need to do is to derive
daily returns for each ID from totret, which is simply totret at time
2006 Jan 27
1
"Conditional" match?
I have two datasets, big and small.
s_date<-c(?2005-12-02?, ?2005-12-01?,
?2004-11-02?,?2002-10-05?,?2000-12-15?)
s_id<-c(?a?,?a?,?b?,?c?,?d?)
b_date<- c(?2005-12-31?, ?2005-12-31?,
?2004-12-31?,?2002-10-05?,?2001-10-31?,?1999-12-31?)
b_id<-c(?a?,?b?,?c?,?d?,?e?,?c?)
small<-data.frame(date_=as.Date(s_date),id=s_id)
big<-data.frame(date_=as.Date(b_date),id=b_id)
For each row
2006 Jan 03
2
For loop gets exponentially slower as dataset gets larger...
I am running R 2.1.1 in a Microsoft Windows XP environment.
I have a matrix with three vectors (“columns”) and ~2 million “rows”. The three vectors are date_, id, and price. The data is ordered (sorted) by code and date_.
(The matrix contains daily prices for several thousand stocks, and has ~2 million “rows”. If a stock did not trade on a particular date, its price is set to “NA”)
2005 Oct 11
6
adding 1 month to a date
Within an R dataset, I have a date field called “date_”. (The dates are in the format “YYYY-MM-DD”, e.g. “1995-12-01”.)
How can I add or subtract “1 month” from this date, to get “1996-01-01” or “ “1995-11-01”.
---------------------------------
[[alternative HTML version deleted]]
2010 Jun 07
3
Subsetting subsets of data.frames
Hey Everyone,
I have been stumped by this all day.
Basically, I have a data.frame of multiple columns. Of concern are "id" &
"date"
For some reason, oftentimes there are duplicates of data with the same date.
I would like to remove the duplicates per different id (removing duplicate
dates for the entire data.frame would leave nothing since different id's all
have
2012 Nov 28
2
data frame: adding columns from data and file title
Data processing?
I have a large number of csv files from animal tracks that look like this:
Date_ Time_ Speed
Course Type_ Distance
30/03/2012 11:15:05 108
121 -2
2012 May 12
1
access the se of a forecast
Hi everybody,
I am currently trying to forecast some double seasonal time series by using
the function dshw. I want to access the standard errors to build the
confident interval for my forecast. I am using to following code :
fit<-dshw(eem,period1=7,period2=48,h=48)
then by using summary(fit), I see that my se are contained in the vector :
$s20
but when I call fit$s20, I get NULL.
I
2017 Jul 30
1
Add Anova statistics in each figure
Hi R Users,
I created interaction plots in ggplot2 and was trying to add output of two way ANOVA models, especially only interaction ( example treatment*control F(XX, XX) = xxx, p = xxx) into figures, but i was not able to add. Would you mind to help on how I can add information into each figure? I have attached the example data and the code that I used for this.
dat<-structure(list(Sites
2011 Mar 13
1
problem with looping formula through table
Dear useRs,
I am stuck with a piece of code and hope you could give me some pointers.
My aim is to calculate the lm-regression coefficients of individual stocks against an index. I am interested in both the coefficient and the pval. While I could do this manually for a select hand full, I hope to scale this up say for 30+ stocks (DAX-30, FTSE-100 etc.) to eventually have a matrix of coefficients
2008 Mar 15
1
feeding merge.zoo a vector containing the names of zoo objects?
Hi, the snippet of code below works, but I would like to know how to feed the
function merge.zoo the contents of
CADstocknames rather than having to hard code it into the merge.zoo command.
I think I must be missing something simple, but I cannot for the life of me
figure it out. Thanks in advance for any enlightenment offered.
library(zoo)
CADstocknames <-
2011 May 15
4
DCC-GARCH model
Hello,
I have a few questions concerning the DCC-GARCH model and its programming in
R.
So here is what I want to do:
I take quotes of two indices - S&P500 and DJ. And the aim is to estimate
coefficients of the DCC-GARCH model for them. This is how I do it:
library(tseries)
p1 = get.hist.quote(instrument = "^gspc",start = "2005-01-07",end =
2006 Jan 13
0
Controller part of in-place editing
I''m doing some incremental improvements on scaffolding, and want to add
in-place editing to an admin section. I think I may have the view part
working right (at least, the editor pops up as expected) with this in my
view:
###
<% for link in @links %>
<tr>
<td> <div id="<%= ''url'' + link.id.to_s -%>"><%= link.url
2011 May 12
2
DCC-GARCH model and AR(1)-GARCH(1,1) regression model
Hello,
I have a rather complex problem... I will have to explain everything in
detail because I cannot solve it by myself...i just ran out of ideas. So
here is what I want to do:
I take quotes of two indices - S&P500 and DJ. And my first aim is to
estimate coefficients of the DCC-GARCH model for them. This is how I do it:
library(tseries)
p1 = get.hist.quote(instrument =
2011 Jan 29
1
Basic Help with Zoo objects and trading days
All,
I have been just recently working with zoo objects for trading systems.
Can someone please help with these basic questions?
Given a daily time series downloaded using get.hist.quote() from the tseries
package, ie......
startDate= as.Date("2000-01-01")
endDate= as.Date("2011-01-29")
frequency= 'd'
s= get.hist.quote('IWF', start= startDate, end=
2012 Mar 10
1
Generating abnormal returns in R
Hello
This is my first post on this forum and I hope someone can help me out.
I have a datafile (weeklyR) with returns of +- 100 companies.
I acquired this computing the following code:
library("tseries");
tickers = c("GSPC" , "BP" , "TOT" , "ENI.MI" , "VOW.BE" , "CS.PA" ,
"DAI.DE" , "ALV.DE" ,
2017 Jul 30
4
Kalman filter for a time series
I found an example at
http://www.bearcave.com/finance/random_r_hacks/kalman_smooth.html shown
below. But it seems the structSSM function has been removed from KFAS
library so it won't run. Does anyone know how to fix the code so that it
runs?
library(KFAS)
library(tseries)
library(timeSeries)
library(zoo)
library(quantmod)
getDailyPrices = function( tickerSym, startDate, endDate )
{
2010 Dec 02
1
Downloading quote data from yahoo finance
Hi R users,
Thanks in advance.
I am using R 2.12.0 on Windows XP.
May I request you to assist me in the following please.
1. I am getting error while downloading quote data from yahoo finance.
The example code is below (taken from tseries help):
library(tseries)
con <- url("http://quote.yahoo.com")
if(!inherits(try(open(con), silent = TRUE), "try-error")) {
2017 Jul 30
0
Kalman filter for a time series
> structSSM
Is no longer part of KFAS. All you needed to do was:
library(KFAS)
?KFAS
and you would have seen that if you went to the index. A structural state space model is now built up from its components, much like in LM. Look at;
?SSModel
-Roy
> On Jul 29, 2017, at 9:26 PM, Staff <rbertematti at gmail.com> wrote:
>
> I found an example at
>
2007 May 03
1
reshape question
Hello all,
A quick question concerning a behavior of reshape I fail tu understand, probably something obvious but I just can't see it.
With the following data frame further referred to as tab :