Displaying 20 results from an estimated 9000 matches similar to: "Leap year?"
2009 Oct 27
2
Year and Month extraction from Date object.
Hello,
I have seen much discussion on Date. But I can't seem to do this simple operation. I can convert a string to a date:
d <- as.Date(DATE, format="%m/%d/%Y")
But what I want to do is extract the year and month so I can construct an element in a ts object. Ideally I would like to see d$year but that doesn't seem to be available. Once I have a Date object how can I get an
2013 Jan 22
1
How to assign time series to a vector with one leap year
Hello All,
I am trying to do the time series analysis in R and I want to assign a
vector as a time series. The data I provided is hourly. The data is from
Jan 1 2008 to Dec 31 2009. How can I assign the data such that the first
year is leap year and second is not ?
airtemp <- read.csv("airtemp.csv",header=T,sep="")
aw <- ts(airtemp,start=2008,frequency=8784,end=2009)
2011 Jan 31
1
leap year and order function
im trying to write a for loop so that every leap year, the number of days
becomes to 366 instead of 365. could someone help me out?
and also, this set of data has 99.99s I set all the 99.99 ==NA.
however, when im doing the order function to find the max value of that
year, it still reads 99.99 as the max value.
Thank you very much
maxday <- matrix(NA,63,5)
for (a in 1948:2010){
2011 Oct 22
7
"Plotting" text?
I noticed that the text() command adds text to a plot. Is there a way to
either make the plot blank or add text to a "blank sheet". I would like
to "plot" a page that contains just text, no plot lines, labels, etc.
Suggestions?
Kevin
[[alternative HTML version deleted]]
2008 Aug 28
6
Function not returning a vector?
Why does:
(shape/scale) * (1:365/scale)^(shape - 1)
return a vector of numbers but calling a function
hasard(1:365,shape,scale)
defined like:
hazard <- function(x,shape,scale)
{
return (shape/scale) * (x/scale)^(shape - 1)
}
Only return a single value? It is like x becomes a single value passed as an argument.
Thank you.
Kevin
2010 Mar 22
2
Factors attribute?
I noticed that when I fit a linear model using 'lm' there is an attribute called "factors" that is added to the "term". It doesn't seem to appear for 'model.matrix', just 'lm'. I have been unable to find where it gets constructed or what it means? It looks like a two dimensional array that I may be able to use so I would just like to get some
2009 Jan 03
5
Power functions?
I had a question about the basic power functions in R.
For example from the R console I enter:
-1 ^ 2
[1] -1
but also
-1^3
[1] -1
-0.1^2
[1] -0.01
Normally pow(-1, 2) return either -Infinity or NaN. Has R taken over the math functions? If so I would think that -1^2 is 1 not -1 and -0.1^2 is 0.01 not -0.01.
Thank you.
Kevin
2011 Nov 07
3
Upgrade R?
I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the
libraries from the 'library' directory in my existing installation (2.13.1)
to the installed R 2.14. Now I want to uninstall the old installation (R
2.13.1) and I get the error:
Internal Error: Cannot find utCompiledCode record for this version of the
uninstaller.
Any ideas?
Kevin
[[alternative HTML
2011 Feb 16
2
leap years in temporal series command ts
Hi R community!
I'd like to create a temporal series with ts command for the interval
1st January 2002 - 31 December 2008. I have daily values, so this is a
2557 days temporal series. I'm using this command :
ts(observations, start=2002, end=2009, freq=365)
However, I don't get the correct temporal series since both frequency
(365 OR 366 for leap years) and deltat (1/365 OR
2009 Oct 28
5
PDF Corrupted?
I am running R 2.9.2 and creating a PDF that I am trying to open with Adobe Reader 9.2 but when I try to open it the reader responds with
"There was an error opening this document. The file is damaged and cannot be repaired.:
I am using the R command(s):
pdf(file="cat.pdf", title="Historical Sales By Category")
for(j in 1:length(master))
{
d <-
2008 Sep 09
4
Help with 'spectrum'
For the command 'spectrum' I read:
The spectrum here is defined with scaling 1/frequency(x), following S-PLUS. This makes the spectral density a density over the range (-frequency(x)/2, +frequency(x)/2], whereas a more common scaling is 2? and range (-0.5, 0.5] (e.g., Bloomfield) or 1 and range (-?, ?].
Forgive my ignorance but I am having a hard time interpreting this. Does this mean
2008 Aug 03
2
Determining model parameters
This may be a begining question. If so, please bear with me.
If I have some data that based on the historgram and other plots it "looks" like a beta distribution. Is there a function or functions within R to help me determine the model parameters for such a distirbution? Similarily for other "common" distirbutions, Poisson(lambda), Chi-Square(degrees of freedom, chi-square
2010 Jan 03
3
F77_CALL, F77_NAME definition
I give up. Maybe it is my search (Windows) but I cannot seem to find the definition of the F77_CALL or F77_NAME macros. Either there are too many matches or the search just doesn't find it. For example where is the source for:
F77_CALL(dpotri)
?
Thank you.
Kevin
2008 Jul 15
4
Iterations
I have a command that reads in some data:
x <- read.csv("Sales2007.dat", header=TRUE)
Then I try to organize the data:
sc <- split(x, list(x$Category, x$SubCategory), drop=TRUE)
Then I want to iterate through the data. I was able to get the following to run on the R console:
for(i in 1:length(sc))
{
sum(sc[[i]]$Quantity)
}
But notiing is primted on the console. I find
2009 Oct 27
3
Non-normal residuals.
Hello,
I asked a question about what the most likely process to follow if after a time-series fit is performed the residuals are found to be non-normal. One peron responded and offered to help if I supplied a sample data set. Unfortunately now that I have a sample I have lost the emai addressl. If you are that person or have some ideas please email me back at rkevinburton at charter.net.
Thank
2008 Oct 07
4
sort a list?
I am trying to sort a list and the data is obiously not in the right format. I am trying:
x <- list()
x[["A"]] <- 1
x[["B"]] <- 2
order(x)
But am getting:
Error in order(x) : unimplemented type 'list' in 'orderVector1'
How should I change the list so that it can be sorted? What kinds of objects (classes of objects) can be sorted?
Thank you.
Kevin
2009 Mar 17
2
sweep?
I am having a hard time understanding just what 'sweep' does. The documentation states:
Return an array obtained from an input array by sweeping out a summary statistic.
So what does it mean "weeping out a summary statistic"?
Thank you.
Kevin
2009 Aug 03
3
if confusion
Simple question:
Why doesn't the following work? Or what 'R' rule am I missing?
tclass <- "Testing 1 2 3"
if(tclass == "Testing 1 2 3")
{
cat("Testing", tclass, "\n")
}
else
{
cat(tclass, "\n")
}
I get an error 'else' is unexpected.
Thank you.
Kevin
2011 Feb 28
0
MultiDimensional arrays
hello,
I'm working with a 4 dimensional NetCDF file, trying to calculate some
summary statistics on a parameter.
The dimensions are number of rows and columns, time and days. The
attribute in question in this case happens
to be a probability of woodstork foraging success. But it could be anything
My question is whether the following code is efficient to grab the
probability values ? I am
2011 Mar 26
0
NetCDF - rolling means and StdDev
Hello,
I am trying to come up with a routine to calculate a rolling mean and
standard deviation for three parameters stored in a NetCDF file. The NetCDF
file contains 10 years of daily records for each of the three parameters,
and I need the statistics for each of the three parameters.
Below I include some code illustrating what I've done so far. Obviously this
approach does not get at the