Displaying 20 results from an estimated 3000 matches similar to: "unique, but keep LAST occurence"
2005 Nov 16
1
COM dates (was origin and "origin<-" in chron)
I was just looking for an easy way to convert between COM datetime and
chron datetime (both ways.)
I found examples on the list, but they involved origin.
Does anyone have functions for converting COM datetime <-> chron
datetimethat work "safely"?
David L. Reiner
> -----Original Message-----
> From: Gabor Grothendieck [mailto:ggrothendieck@gmail.com]
>
2005 May 06
4
Choices from a matrix
Could someone please suggest a more clever solution to the following problem than my loop below?
Given X a 2xN matrix X, and I a k-subset of N,
Generate the (2^k)xN matrix Y with columns not in I all zero and the other columns with all choices of an entry from the first or second row of X.
For example, with
X <- matrix(1:8, nrow=2)
I <- c(1,3)
X is
1 3 5 7
2 4 6 8
and Y should be
1 0 5
2004 Sep 13
2
Can I find the datetime an object was last assigned to/saved?
I'm using v 1.9.1 under Windoz XP.
Can I do the equivalent of "ls -l" on my R objects? R's "ls()" lists
only the names.
Thanks!
David L. Reiner
Rho Trading
440 S. LaSalle St -- Suite 620
Chicago IL 60605
312-362-4963 (voice)
312-362-4941 (fax)
[[alternative HTML version deleted]]
2005 Nov 15
1
origin and "origin<-" functions on chron
I'm trying to use/modify some code I found (at Omegahat, but I've seem similar usage elsewhere.)
It contains the lines:
if(any(origin(chronDate)!=orig))
origin(chronDate) <- orig
Let's say:
> require("chron")
[1] TRUE
> chronDate <- chron("11/15/2005", format="m/d/y", origin.=c(12,31,1899))
> orig <- c(month=12, day=31,
2006 Jun 15
2
Standard Deviation Distribution
I'm having trouble with the standard deviation distribution
as shown on http://mathworld.wolfram.com/StandardDeviationDistribution.html .
(Eric Weisstein references Kenney and Keeping 1951, which I can't check.)
I believe the graphs they show, but when I code the function in R, according to the listed formula,
I get very different graphs.
Would someone please point out my error or tell
2004 Sep 29
2
How to print landscape from script in Windows: dev.print(win.print, printer="local printer name", ...) does not accept horizontal=TRUE
This is a windows-specific question.
After generating a plot, I can print from scripts or the command line
with
> dev.print(win.print,printer="local windows printer name")
I would like to print in landscape mode. From the menus, I can
accomplish this by changing the properties of the printer before
clicking "print".
However, I tried adding
2005 Apr 21
1
R 2.1.0 for Windows installation error? atanh not in R.dll?
Could someone please tell me what I did wrong to create this message or what I should do to correct this problem?
I downloaded 2.1.0 Windows binary and installed into C:/R/rw2010, using the installer. I ran md5check.exe in C:/R/rw2010/bin/ and got "No errors."
The problem is this:
When I start up Rgui.exe from its shortcut (target= C:\R\rw2010\bin\Rgui.exe --save -sdi, Start in
2005 Apr 28
1
standard errors for orthogonal linear regression
Could someone please help me by giving me a reference to how one computes standard errors for the coefficients in an orthogonal linear regression, or perhaps someone has some R code? (I would accept a derivation or formula, but as a former teacher, I know how that can rankle.) I tried to imitate what's done in the code for lm() but went astray somewhere and got nonsense.
(This type of
2005 Jul 06
1
pretty for date-time?
pretty() works well for numbers and axTicks() can help for potting log axes,
but has anyone written a pretty for chron objects (or other date or date-time classes)?
It would have natural units of years, months, .., days, hours, (minutes?), and
it would choose the appropriate unit based on the date(time) range.
I have searched the archives and documentation to no avail.
(I wrote one of these back
2004 Nov 08
1
can one evaluate an expression in a comment? (or insert results into history?)
I'd like to insert (for example) the current datetime into a comment so
it goes into the history.
I can of course cut and paste the results of date() into a comment line,
but it would be easier and more powerful to be able to type something
like
> hstamp()
and have it go into the history.
More generally, I would like to put any expression to be evaluated into
this function.
For
2004 Oct 01
3
Can grid lines color in a plot be specified?
R-help
Is there any way to specify the color of grid lines in a simple plot?
par(color.tick.marks=c("grey"))
plot(rnorm(10),tck=1)
Thank you
2004 Nov 08
1
can one evaluate an expression in a comment? (or insert resultsinto history?)
But that doesn't put the result into the history buffer, to be written
to a file only later when I savehistory(filename).
Bert Gunter also suggested ?capture.output and ?textConnection,
but I cannot see how to get text into the history buffer as comments,
but with evaluated expressions (values).
I know how to use paste, sink, write, etc. but nothing that I can see
inserts into the history
2005 Jun 29
6
x*x*x*... vs x^n
Hi
I have been wondering if there one can speed up calculating small powers
of numbers such as x^8 using multiplication.
In addition, one can be a bit clever and calculate x^8 using only 3
multiplies.
look at this:
> f1 <- function(x){x*x*x*x*x*x*x*x}
> f2 <- function(x){x^8}
> f3 <- function(x){x2 <- x*x;x4 <- x2*x2;return(x4*x4)}
[so f1() and f2() and f3() are
2005 Jun 29
3
moving correlation coef ?
Hello,
R gives us the correlation functions cor(). (Many thanks ;-))
Does it also exist a "moving correlation" coefficient ?
(like the moving average).
If not, could someone give me some infos or link
on how to practically implement such a function in R.
(I did search for "moving correlation" on the R homepage
but didn't find anything.)
Thank you.
Vincent
2009 Aug 03
3
Help with reshaping data.frame
I'm having trouble reshaping a data.frame from long to wide.
(I think that's the right terminology; feel free to educate me.)
I've looked at the reshape function and package and plyr package,
but I can't quite figure out how to do this after a dozen variations.
I have a data.frame with more levels than this, but similar to:
> tst
K1 K2 K3 V1 V2 V3
1 10 D a 0.08 99
2008 Mar 11
1
plot.zoo warnings - ignore or look for problem?
I'm getting warnings when I plot a zoo object:
> dts <- chron(rep("2007-09-10", 5), paste("00:0", 0:4, ":00", sep=""),
c("y-m-d", "h:m:s"))
> dat.zoo <- zoo(1:5, dts)
> plot(dat.zoo)
Warning messages:
1: In v[[perm[1]]] : partial match of 'm' to 'month'
2: In v[[perm[2]]] : partial match of 'd'
2009 Jan 23
1
list.files changed in 2.7.0
I just noticed a change in the behavior of list.files from 2.6.1pat to
2.7.0
(I noticed it in 2.8.1 and traced back.)
Previously, if the directory ended with a slash, and full.names=TRUE,
the names
returned had a single slash at the end of the directory,
but now there are two. I noticed since I was getting a list of certain
files and
then grepping in the list for a full name formed with a
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select
statements on one or more R data frames. It is
optimized for convenience making it useful
for ad hoc queries against R data frames.
Given an SQL select statement whose tables
are the names of R data frames it:
- sets up the database (by default it transparently
sets up an in memory SQLite database using RSQLite;
however, MySQL via RMySQL, can be
2008 Sep 05
1
casting help please
I have a data.frame which I believe is melted already and am having
trouble casting it to 'wide' format.
It looks something like
> (x <- data.frame(ticker=c(rep("A",5),rep("B",6)), date=c(1:5, 1:6),
value=c(NA,100*exp(rnorm(10,0,.1)))))
> cast(x, date ~ ticker) # this does what I want with toy data
But when I use my real data frame
>