Displaying 20 results from an estimated 3000 matches similar to: "How to manipulate the time data without the date?"
2008 Nov 18
2
error in function: nls (urgent)
Hi,all:
I am running a nonlinear regression and there is a problem.
There is a data frame: data
p s x t
1 875.0 12392.5 11600 0.06967213
2 615.0 12332.5 12000 0.06967213
3 595.0 12332.5 12000 0.06967213
4 592.5 12337.0 12000 0.06967213
5 650.0 12430.0 12000 0.06967213
6 715.0 12477.5 12000 0.06967213
.
.
.
.
str(data):
'data.frame': 234 obs. of 4 variables:
2009 Mar 19
2
find the index of the smallest or biggest number in a vetor or data.frame
Dear R experts,
How to find out the index of minimum or maxmum number in a vetor or
data.frame?
For example,
a=
n price
1 50
-2 100
0 200
-1 300
......
I want to find out the row which the n is the smallest or largestest and
extract the price.
Thanks
Ted
--
View this message in context:
2009 Feb 23
3
Help in writing my own function
Dear all
I am very intersted in writing my own function to deal with some complicated
task, but I don't know how to start. I can't find detial material with
examples teaching me how to write my own functions. Can anyone help me and
recommend me some learning material?
Many Thanks
Ted
--
View this message in context:
2009 Apr 30
2
problem in reading data
Dear R users
I am runing into a problem in reading data in R
This is the error information
a<-read.table("tt_mb_200409.txt",as.is=T)
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
:
line 1653997 did not have 5 elements
It seams that some lines don't have equal variables. I want to try
>
2008 Nov 11
2
Manipulation in timeSeries object:how to use the function "applySeries" by daily?
Hi all
I have some tick-by-tick data and I have calculated the intraday returns. I
want to sum up the intraday squared returns to calculate the daily
volatility(or daily variance). I know that the s-plus FinMerics has the
function aggregateSeries function that can be apply to daily data:
aggregateSeries(x, Fun, by="daily"), but the counterpart function in
R:applySeries can not be apply
2009 Mar 12
3
batch process file in R
Dear R experts,
I have a folder names "200209" and in this folder there are many data files,
such as:
"BA020902.txt","BA020903.txt","BA020904.txt",
"BA020905.txt","BA020906.txt","BA020909.txt",
"BA020910.txt","BA020911.txt","BA020912.txt",
2004 Nov 22
7
timeDate
what package should I include to use timeDate? I want to convert a
double (num of millis) into date object.
2004 Mar 07
2
Excel files
Hello,
I was trying to import data from an Excel file. After I imported the data, I was trying to make a scatter plot.
The X axes variable is a time variable, which occupies two columns, one is date, another one is time. Example 21-Apr-03, 4:10 PM. My qestion is:
1. How can I access the data of certain column? I mean how can I refer it in R?
2. How can I make the two column character
2003 Nov 11
4
HMisc describe -- error with dates
Hello,
I am trying to use HMisc describe on a data frame. I have specified certain
variables as dates using, for example:
df1$aidsdate <- dates(aidsdate,format="day.mon.year", origin=c(month = 1,
day = 1, year = 1960))
When I use describe on the dataframe I get this error:
Error in Ops.dates(weights, x) : * not defined for chron objects
Has anyone had this problem? I had
2005 Jul 17
1
Where to learn how to deal with time class variable?
Dear R-helpers,
In my data set, I have a time variable 'RecordTime'
whose class property is 'times'. When I list my data
set, I see the values of RecordTime is like 10:20:30
in a 'h:m:s' format. Suppose I want to choose all the
data after 10 o'clock, then use
subset(data,RecordTime>10:20:30)
just doesn't work. I noticed that all the values of
RecordTime seem
2011 Aug 01
1
Identifying US holidays
Hello!
I am trying to identify which ones of a vector of dates are US
holidays. And, ideally, which is which. And I do not know (a-priori)
which dates those should be.
I have, for example:
x<-seq(as.Date("2011-01-01"),as.Date("2011-12-31"),by="day")
(x)
I think chron should help me here - but maybe I am not using it properly:
library(chron)
is.holiday(chron) #
2010 May 18
2
Function that is giving me a headache- any help appreciated (automatic read )
note: whole function is below- I am sure I am doing something silly.
when I use it like USGS(input="precipitation") it is choking on the
precip.1 <- subset(DF, precipitation!="NA")
b <- ddply(precip.1$precipitation, .(precip.1$gauge_name), cumsum)
DF.precip <- precip.1
DF.precip$precipitation <- b$.data
part, but runs fine outside of the function:
days=7
2005 Jul 19
2
Problems with date-format (R 2.1.1 + chron)
Hello,
today I've updated on the newest R-Version. But sadly a function I needed
didnt want to work:
The input is e.g.
days(as.Date("21-07-2005","%d-%m-%y"))
the error is: Fehler in Math.Date(dts): floor nicht definiert f??r Date
Objekte
(Error in Math.Date(dts): floor not defined for date objects)
Same for year. Only months gives me the correct output.
In Version
2008 Aug 26
1
bug in package chron (PR#12599)
Full_Name: Zeng, zhenxing
Version: 2.7.1 (2008-06-23)
OS: windows XP
Submission from: (NULL) (158.182.1.30)
Dear Author
I have run into a trouble in using chron package
The data frame: a
date time_fut expiry_day bid ask trade_day
1 2004-09-01 09:45:00 2004-10 12860 12889 38
2 2004-09-01 09:45:01 2004-10 12885 12890 38
3 2004-09-01 09:45:04 2004-10 12883 12887
2009 Oct 06
1
ggplot2 applying a function based on facet
Look at the bottom of the message for my question
#here is a little function that I wrote
USGS <- function(input="discharge", days=7){
library(chron)
library(gsubfn)
#021973269 is the Waynesboro Gauge on the Savannah River Proper (SRS)
#02102908 is the Flat Creek Gauge (ftbrfcms)
#02133500 is the Drowning Creek (ftbrbmcm)
#02341800 is the Upatoi Creek Near Columbus (ftbn)
#02342500 is
2011 Feb 11
2
tzone and DST
I'm reading in ~3 years worth of data that includes hourly timestamps.
Presumably to avoid DST confusion, all the data is in PST time zone -- no
discontinuities in the spring or fall.
The data comes in a csv file, which I'm reading with
myvariable <- read.csv("my_data_file.csv",header=FALSE,
2007 Dec 14
3
calculating the number of days from dates
Hello,
I gather variants of this question have been asked previously. I have
done some reading but only became more confused, as I suspect what I
am trying to do is more basic than other applications.
The following code readily calculates the difference in days between two dates:
newdays <- ISOdate(2005, 5,12) - ISOdate(2006, 12, 22)
However, I wanted to be able to deduct the dates in
2008 Apr 15
1
by inconsistently strips class - with fix
summary:
The function 'by' inconsistently strips class from the data to which
it is applied.
quick reason:
tapply strips class when simplify is set to TRUE (the default) due to
the class stripping behaviour of unlist.
quick answer:
This can be fixed by invoking tapply with simplify=FALSE, or changing
tapply to use do.call(c instead of unlist
executable example:
2009 Jul 16
6
Best way to replace :SS with :00
Not sure if there is an R way to do this or a regular express way, but here is what I am trying to do.
I've got lots of data where the format is HH:MM:SS, but I need to format it like HH:MM:00, i.e. round the second down to zero.
What is the best way to do this?
Thanks again.
Jason
2010 Feb 11
2
ZOO object colnames refering to Dates
Hello,
I have large zoo objects (about 100 or more time series merged next to
eachother). Example:
X05.Oct.99 X05.Nov.99 X05.Dec.99 X05.Jan.00 X05.Feb.00 X05.Mar.00
X05.Apr.00 X05.May.00 X05.Jun.00
[1,] 5649.3 5679.4 5679.4 5679.4 5679.4
5679.4 5679.4 5679.4 5679.4
[2,] 5682.7 5719.2 5719.2 5719.2 5719.2
5719.2 5719.2