Mark Leeds [EMAIL PROTECTED] wrote:
could someone explain the difference between
do.call(cbind,list(a,b,c,d)) and cbind(a,b,c,d).
do.call(cbind, list(a=a, b=b, c=c, d=d)) is indeed the same as
cbind(a, b, c, d). But suppose you wanted a function to cbind any
number of vectors in reverse order:
I have a daily job that attaches hundreds of pseudo-packages containing
data as promise objects (DDP's, ref: g.data package), and plots the
results to a multi-page pdf device. Sometimes it fails. Under R-2.2.1
it just gave segfaults. Under R-2.3.1 it gave this error message:
*** caught
After upgrading to R-2.3.1 on Linux Redhat, I was suprised by this:
R x - c(721.077, 592.291, 372.208, 381.182)
R sum(x) - 2066.758
[1] 4.547474e-13
Now I understand that floating point arithmetic is not precise, but
1) the result is exactly 0 in R-2.2.1 (patched) on the same machine,
2)
I was concerned by this result (new in R-2.3.1):
R x - c(721.077, 592.291, 372.208, 381.182)
R sum(x) - 2066.758
[1] 4.547474e-13
But after Roger Peng's [EMAIL PROTECTED] insightful comment that the
relative difference (sum(x)/2066.758 - 1) is exactly what is expected,
I'm convinced that sum()
Hans-Peter,
In my office, files are stored on an EMC shared server which is
used by both our Windows PC's and our Linux machines. So it is common
for us to process spreadsheet data using R on Linux. A Linux version
of your package would be very welcome. Thanks!
-- David Brahm ([EMAIL
as.character.factor contains this line (where cx=levels(x)[x]):
if (NA %in% levels(x)) cx[is.na(x)] - NA
Is it possible that this is no longer the desired behavior? These
two results don't seem very consistent:
as.character(as.factor(c(AB, CD, NA)))
[1] AB CD NA
is.na(.Last.value)[3]
[1]
Larry Howe [EMAIL PROTECTED] wants to:
1. read in a 2-column data file, e.g.
status tab new
db tab green
title tab Most Significant Excursions
2. end up with an R list such that I can write e.g.
lst$title
and have R return Most Significant Excursions.
I call this reading a hash table
I've written a rowVars function, but I don't think it throws the error
you mention. You're welcome to use it if you like.
rowVars - function(x, na.rm=FALSE, dims=1, unbiased=TRUE,
SumSquares=FALSE, twopass=FALSE) {
if (SumSquares) return(rowSums(x^2, na.rm, dims))
N -
sudoku_2.0 is now available on CRAN and mirrors.
Thanks to some terrific contributions and suggestions, especially by
new co-author Greg Snow, this version has a full GUI interface (native
on Windows, or using tkrplot), a puzzle generator, and a function to
fetch recently published puzzles. The
Any doubts about R's big-league status should be put to rest, now that
we have a
Sudoku Puzzle Solver. Take that, SAS! See package sudoku on CRAN.
The package could really use a puzzle generator -- contributors are
welcome!
-- David Brahm ([EMAIL PROTECTED])
[[alternative HTML
Under R-2.2.1, a POSIXlt date created with strptime has an unknown
Daylight Savings Time flag:
strptime(20051208, %Y%m%d)$isdst
[1] -1
This is true on both Linux (details below) and Windows. It did not
occur under R-2.1.0. Any ideas? TIA!
Sys.getenv(TZ)
TZ
Version:
platform =
Albert Vilella [EMAIL PROTECTED] wrote:
I would like to ask about how to disable the ess emacs shortcut that
converts shift+- to '-' instead of _ symbols.
Put this in your .emacs file (after ess is loaded):
(ess-toggle-underscore nil)
By the way, check out the ESS-help mailing list:
Trevor Hastie [EMAIL PROTECTED] wrote:
It would be nice to have a date stamp on an object.
In S/Splus this was always available, because objects were files.
The g.data package on CRAN stores R objects in individual files,
like the (old) S-Plus model. The timestamp on a file tells you the
last
Jason Horn [EMAIL PROTECTED] wrote:
Can anyone think of a way to create a pretty() sequence that excludes
zero?
You could use except(pretty(x), 0), if you first defined the (quite
useful) set-operation function:
R except - function(a,b) unique(a[!match(a, b, 0)])
(Consider this a plug to
Shengzhe Wu [EMAIL PROTECTED] wrote:
In the Unix environment, I open a window by x11(). May I specify the
position of this window by specifying the position of the top left of
the window as in Windows environment?
I use xwit (version 3.4), a system command which manipulates existing
X
In a clean environment under R-2.1.0 on Linux:
x - 1:5
x[3] - 9
Error: Object x not found
Isn't that odd? (Note x - 9 works just fine.)
Why am I doing this? Because I'm stepping through code that
normally lives inside a function, where - is appropriate.
-- David Brahm ([EMAIL PROTECTED])
Scot,
Here is your toy example in more condensed form:
x11()
par(mar=c(0.5, 1, 5, 5))
par(mfrow=c(3,2))
plot(1:10)
par(mex) # mex=1.0 here
par(cex.axis=1.0, mex=0.5) # Now you change it
for (i in 1:5) plot(1:10)
When you build your first plot (effectively at the plot.new()
The following code produces 6 plots on a page, but the first is
distorted and different from the others:
par(mfrow=c(3,2), las=2)
for (i in 1:6) {
frame()
par(mar=c(7, 7, 1, 1))
axis(2); box(); abline(h=seq(0,1,.5), col=2:4)
}
The first plot's axes are mis-aligned with the plotting area
I wrote:
par(mfrow=c(3,2), las=2)
for (i in 1:6) {
frame()
par(mar=c(7, 7, 1, 1))
axis(2); box(); abline(h=seq(0,1,.5), col=2:4)
}
The first plot's axes are mis-aligned with the plotting area...
Uwe Ligges [EMAIL PROTECTED] replied:
Yes expected, at first you generate the plot, then
Bogdan Romocea [EMAIL PROTECTED] wrote:
Hypothetically, if whatever=T/F were forbidden and only
whatever=TRUE/FALSE were allowed, all the code could be fixed with
a simple sed script: [deleted]
As Bogdan is lobbying hard for disallowing T/F, I wanted to speak up
for the other side. Please
I view plots on my screen with X11(width=.455*11, height=.455*8.5),
which creates a small window with the American standard aspect ratio.
Under R-2.0.1 and earlier, the default fonts were a reasonable size,
but under R-2.1.0 they are too big and fat. I now have to either set
pointsize=10 in
Thanks very much to Prof Brian Ripley [EMAIL PROTECTED] for
the quick and illuminating reply:
We have corrected a bug: you now get the size you ask for...
DId you think to actually measure the sizes? Might be interesting
(although you may need to measure the window too).
Sticking a ruler up
charles loboz [EMAIL PROTECTED] wrote:
A gstring is a string with variable names embedded and replaced by
values(converted to strings, lazy eval) before use.
I use the following function, which will take variables either from
named arguments or from the environment. It also concatenates all
Greg,
Assign the output of persp to a variable pmat:
R pmat - persp(X.grid, Y.grid, pred.loess1, theta=0, phi=12)
Now you can add points to your plot with the usual points command.
But you have to translate your 3D coordinates (x,y,z) into 2D
coordinates for points to understand, and that's what
Fernando Saldanha [EMAIL PROTECTED] wrote:
I am trying to find a way to assign values to elements of a vector
that will be defined by a user.
a - c(1,2,3)
get('a')[1] - 0
Error: Target of assignment expands to non-language object
Try this function:
g.assign - function(i, pos=1, ...,
Version 1.6 of the g.data package is available on CRAN.
The g.data package is used to create and maintain delayed-data
packages (DDP's). Data stored in a DDP are available on demand, but do
not take up memory until requested. You attach a DDP with
g.data.attach(), then read from it and assign to
peng shen [mailto:[EMAIL PROTECTED] wrote:
R - 4
testString - I love $R
So the final string I want to get is I love 4. How can I implement?
I've written an interpolater function g.p with these additional
features:
- Loops through all occurences of the escape character ($) rather than
all
I have never understood the difference between
R CMD BATCH --vanilla --slave myScript.R outFile.txt
and
R --vanilla --slave myScript.R outFile.txt
I use the latter method, and then the --args construction works great:
R --vanilla --slave --args myArg1 myArg2 myScript.R outFile.txt
In
Georg Hoermann [mailto:[EMAIL PROTECTED] wrote:
www.hydrology.uni-kiel.de/~schorsch/statistik/erle_stat.csv ...
contains a 10 year dataset.
We often need cumulative *annual* sums (sunshine, precipitation), i.e.
the sum must reset to 0
at the beginning of the year. I know of cumsum(), but I do
R x - 0. + 1:8000
R y - outer(-x, x, pmin)
Error: cannot allocate vector of size 100 Kb
Why does R need to allocate a gigabyte to create an 8000 x 8000 matrix?
It doesn't have any trouble with outer(-x, x, +). Thanks.
-- David Brahm ([EMAIL PROTECTED])
Version:
platform =
Paul Schwarz [EMAIL PROTECTED] wrote:
Is there an R function for calculating moving averages of time series
objects?
Others have replied, but here's the simple answer for a trailing 5-day
moving average, no non-standard packages needed:
R x - 1:20
R filter(x, rep(1/5,5), sides=1)
-- David Brahm
31 matches
Mail list logo