What version of R are you using? When I copy and paste that into
R 2.4.1 on Windows XP I get 2001, 2002, ..., 2007
On 4/3/07, Henrik Andersson [EMAIL PROTECTED] wrote:
Hello fellow R people,
I don't understand the default behavior of the axis labeling when
plotting dates.
I would expect
$IDorder1 - unlist(sapply(y$lengths, FUN=function(x) seq(1,x)))
dat
# 2st (by Chaliraos Skiadas)
dat$IDorder2 - unlist(tapply(dat$ID,factor(dat$ID), function(x)
1:length(x)),use.names=FALSE)
dat
#3rd (Jim Holtman)
dat$IDorder3 - ave(dat$ID, dat$ID, FUN=seq)
#4 (Gabor Grothendieck
On 4/1/07, Laurent Valdes [EMAIL PROTECTED] wrote:
Hi everybody,
really sorry !!!
this is RODBC indeed. But I'm not sure if the package or R version makes a
real difference.
In fact, I used fast=FALSE, and I'm now pretty sure the error is due to that
parameter.
It may be working far better
See gpar in grid:
library(grid)
?gpar
library(lattice)
xyplot(rivers ~ rivers, type = l, lwd = 10, lineend = 1)
On 4/1/07, John Bullock [EMAIL PROTECTED] wrote:
I would like to use llines() to draw lines with
square endings in lattice plots. But the default
behavior seems to be to draw
Assuming the ID's are contiguous, as in your example:
transform(dat, IDorder = seq(ID) - match(ID, ID) + 1)
On 4/1/07, Nguyen Dinh Nguyen [EMAIL PROTECTED] wrote:
Dear R helpers
I have a data set sth like this:
set.seed(123);dat - data.frame(ID= c(rep(1,2),rep(2,3), rep(3,3), rep(4,4),
Try this:
'my dog named Spot and my cat named Kitty fight like cats and dogs'
On 3/31/07, Laurent Valdes [EMAIL PROTECTED] wrote:
Hi everybody,
I'm doing a sqlSave() in R, to insert a big data frame of 1 rows.
However, there is problems, since several rows contains quotations marks,
On 3/31/07, Martin Maechler [EMAIL PROTECTED] wrote:
SteT == Stephen Tucker [EMAIL PROTECTED]
on Fri, 30 Mar 2007 18:41:39 -0700 (PDT) writes:
[..]
SteT For dates, I usually store them as POSIXct classes
SteT in data frames, but according to Gabor Grothendieck
SteT
is in GMT
Sys.putenv(TZ = GMT)
dp - seq(Sys.time(),len=10,by=day)
plot(dp,1:length(dp))
Sys.putenv(TZ = )
# Looks okay
--- Gabor Grothendieck [EMAIL PROTECTED] wrote:
On 3/31/07, Martin Maechler [EMAIL PROTECTED] wrote:
SteT == Stephen Tucker [EMAIL PROTECTED]
on Fri, 30 Mar
Try this:
aggregate(a[3], a[1:2], max)
On 3/31/07, Deepak Manohar [EMAIL PROTECTED] wrote:
Hi team,
I have the data of the form:
a- data.frame(x=c(1,2,1,4,3), y=c(1,2,1,4,3), z=c(1,2,3,4,5))
I need the output of the form
b- data.frame(x=c(1,2,3,4), y=c(1,2,3,4), z=(3,2,5,4) )
As
I assume you are referring to na.roughfix in randomForest. I don't think it
works for logical vectors or for factors outside of data frames:
library(randomForest)
DF - data.frame(a = c(T, F, T, NA, T), b = c(1:3, NA, 5))
na.roughfix(DF)
Error in na.roughfix.data.frame(DF) : na.roughfix only
- factor(DF$c)
DF - na.roughfix(DF)
DF$c - as.character(DF$c)
DF
On 3/30/07, Sergio Della Franca [EMAIL PROTECTED] wrote:
This is that i obtained.
There isn't a method to replace the NA values only for character variable?
2007/3/30, Gabor Grothendieck [EMAIL PROTECTED]:
I assume you
The unit of time for a ts class object is deltat(ldeaths).
See the
?deltat
help page.
On 3/29/07, tom soyer [EMAIL PROTECTED] wrote:
Hi,
I am using ccf but I could not figure out how to calculate the actual lag in
number of periods from the returned results. The documentation for ccf
The solution in my post has the advantage of not using
eval or character conversions (except in setting up
L where you want such character conversions to
build up the names, as your more general sitution
shows). The following is the same as in that post except
the line setting L in that post is
I am not 100% sure of what you want but maybe this will help. I
have modified your example data to omit one point so that there
is a holiday among the rows:
library(zoo)
# read data
Lines - DateOpenHigh Low CloseNifty
2004-01-01 1880.35 1917.05 1880.351912.25
2004-01-02 1912.25
Try this:
library(gsubfn)
pat - ([[:upper:]][[:lower:]]*)
s - Aaaa 3 x 0 Bbbb
strapply(s, pat, backref =-1)[[1]]
or (not quite as general but works in this case):
pat - ([[:upper:]][[:lower:]]*)
s - Aaaa 3 x 0 Bbbb
s.idx - gregexpr(pat, s)[[1]]
substring(s, s.idx, s.idx + attr(s.idx,
Please read the last line on every post to r-help.
On 3/28/07, Alfonso Sammassimo [EMAIL PROTECTED] wrote:
Is there a way of aggregating 'zoo' daily data according to day of week? eg
all Thursdays
I came across the 'nextfri' function in the documentation but am unsure how
to change this so
You could use RDCOMClient or rcom packages to update an Excel
spreadsheet in place and you would not need any VBA at all. Search
through the archives for the keyword Excel.Application .
On 3/27/07, Moshe Olshansky [EMAIL PROTECTED] wrote:
OK.
By the way, I only thought that I could do what I
Try substitute:
e - expression(u1 + u2 + u3)
L - list(u2 = as.name(x), u3 = 1)
as.expression(do.call(substitute, list(as.call(e), L))[[1]])
On 3/27/07, Daniel Berg [EMAIL PROTECTED] wrote:
Dear all,
Suppose I have a very long expression e. Lets assume, for simplicity, that it
is
e =
As indicated in ?boxplot it passes certain arguments to bxp so check out
?bxp where you will find various out... arguments:
boxplot(c(1:10, 20), outlty = 2, outcex = 0 )
On 3/27/07, AA [EMAIL PROTECTED] wrote:
Dear Users
Is there any way to generate lines instead of points for outliers in
Try these:
search()
sessionInfo()
loadedNamespaces()
The first two show the attached packages (and some other info) and the
last one shows the namespaces that are loaded. Note that detaching
a package does not unload its namespace and unloading a namespace
does not de-register its methods.
Try adding this argument to your xyplot call:
par.settings = list(axis.line = list(col = 0))
The subparameters oif axis.line are:
trellis.par.get()$axis.line
in case you want to temporarily set others.
On 3/25/07, John Bullock [EMAIL PROTECTED] wrote:
I am trying to eliminate panel
Try this:
aggregate(atest[3:4], atest[1:2], sum)
Use a data base and SQL is you don't otherwise have enough
computer resources.
On 3/24/07, Delcour Libertus [EMAIL PROTECTED] wrote:
Hello!
Given is an Excel-Sheet with actually 11,000 rows and 9 columns. I want
to work with the data in R.
Looks like there is code in the appendix.
On 3/23/07, Jan Wijffels [EMAIL PROTECTED] wrote:
Dear useRs,
I very much like the effect display of the proportional odds model on
page 29 (Figure 8) of the following paper by John Fox:
http://socserv.mcmaster.ca/jfox/Papers/logit-effect-displays.pdf
See:
?R.home
?dput
On 3/23/07, Alberto Monteiro [EMAIL PROTECTED] wrote:
Is there any generic function that gets the home directory? This
should return /home/user in Linux and
x:/Documents and Settings/user (or whatever) in Windows XP.
Another (unrelated) question: what is the _simplest_
On 3/23/07, Liaw, Andy [EMAIL PROTECTED] wrote:
From: Gabor Grothendieck
See:
?R.home
That's not what Alberto wanted: It gives the location of the R
installation, not where user's home directory is. AFAIK Windows does
not set the HOME environment variable by default.
ok. Try
path.expand(~) also seems to work on Windows XP.
On 3/23/07, Prof Brian Ripley [EMAIL PROTECTED] wrote:
But the request was for a *generic* solution. On Windows there
might not be anything corresponding to a home directory (and the rw-FAQ
discusses the concept and how R resolves this).
The
Read the help desk article in R-News 4/1 and see
?as.Date
?strptime (for setting the as.Date format= argument)
Also, you might be interested in the zoo package
library(zoo)
?read.zoo
vignette(zoo)
vignette(zoo-quickref)
On 3/23/07, Andreas Tille [EMAIL PROTECTED] wrote:
Hi,
I'm on my very
Package dynlm (and dyn) are used to align the time series in the dependent
and independent portions of the equations so that one can perform regressions
on lagged and differenced versions of the dependent and independent variables.
They compensate for the fact that lm (and in the case of dyn lm,
Try
sprintf(%.2f, m)
On 3/22/07, Baoqiang Cao [EMAIL PROTECTED] wrote:
Dear All,
I was trying to format a numeric vector (100*1) by using
outd - format(x=m, sci=F, digits=2)
outd[1:10]
[1] 0.01787758 -0.14760306 -0.45806041 -0.67858525 -0.64591748
[6] -0.05918100 -0.25632276
Try pt.lwd= instead of lwd= in your legend call.
On 3/22/07, Robin Hankin [EMAIL PROTECTED] wrote:
Hi
I have a scatterplot of points with pch=1 and a single point with
pch=3, lwd=3.
It has a high line width to attract attention to it.
The following script
Sometimes but its also easy to forget about simple solutions.
On 3/21/07, Alberto Monteiro [EMAIL PROTECTED] wrote:
Gabor Grothendieck wrote:
Could you call yours Edges?
Is it a good idea to have two different functions, whose name
differs by case sensitivity? I believe
On 3/20/07, enrico.foscolo [EMAIL PROTECTED] wrote:
Dear participants to the list,
this is my problem: I want to obtain an expression that represents the second
derivative of one function.
With deriv3 (package stats) it is possible to evaluate the second
derivative, but I do not know how I
Could you call yours Edges?
On 3/20/07, Søren Højsgaard [EMAIL PROTECTED] wrote:
I am writing a package which uses the Rgraphviz package which in turn uses
the graph package, but my question does not (I believe) pertain specifically
to the these packages so therefore I dare to post the
Here is one way. This matches strings which contain those characters
found in a number, converting each such string to numeric.
library(gsubfn)
strapply(x, [-0-9+.E]+, as.numeric)
On 3/19/07, Robin Hankin [EMAIL PROTECTED] wrote:
Hi.
Is there a straightforward way to convert a character
On 3/19/07, Thomas Lumley [EMAIL PROTECTED] wrote:
On Thu, 15 Mar 2007, Andrew Perrin wrote: (in part)
2.) Yes, by all means you should use linux instead of windows. The
graphics output is completely compatible with whatever applications you
want to paste them into on Windows.
This
On 3/19/07, Marc Schwartz [EMAIL PROTECTED] wrote:
On Mon, 2007-03-19 at 11:43 -0400, Gabor Grothendieck wrote:
On 3/19/07, Thomas Lumley [EMAIL PROTECTED] wrote:
On Thu, 15 Mar 2007, Andrew Perrin wrote: (in part)
2.) Yes, by all means you should use linux instead of windows
On 3/19/07, Thomas Lumley [EMAIL PROTECTED] wrote:
On Mon, 19 Mar 2007, Gabor Grothendieck wrote:
On 3/19/07, Thomas Lumley [EMAIL PROTECTED] wrote:
On Thu, 15 Mar 2007, Andrew Perrin wrote: (in part)
2.) Yes, by all means you should use linux instead of windows. The
graphics output
I think there are a lot of misconceptions regarding what is possible on Windows.
On Windows you just right click the graphic in R and choose Copy as Metafile
which puts a vector graphic representation on the clipboard and then
ctrl-V in Word to copy it in. (Alternately save all your graphics as
Along the lines you mention, check out:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/32297.html
On 3/19/07, Dalphin, Mark [EMAIL PROTECTED] wrote:
On Mon, 19 Mar 2007, Thomas Lumley wrote:
On 3/19/07, Thomas Lumley [EMAIL PROTECTED] wrote:
On Thu, 15 Mar 2007, Andrew Perrin wrote: (in
Sorry, legend= was omitted:
plot(1:10)
legend(topleft, legend = This ~ study ~ italic(n) == 3293)
On 3/18/07, Chabot Denis [EMAIL PROTECTED] wrote:
Thank you Marc, Jim and Gabor,
I like the solution with expression, nice and simple. Gabor, your
solution did not work, probably just a matter
to
be within quotes. What is happening here, exactly? Why the use of
~? I tried without and it no longer works.
Thanks in advance,
Denis
Le 07-03-18 à 08:59, Gabor Grothendieck a écrit :
Sorry, legend= was omitted:
plot(1:10)
legend(topleft, legend = This ~ study ~ italic(n) == 3293)
On 3
You could do this:
f - function(x) {
This is some
text that I
would like to
have here.
x + 1
}
f(2) # 3
On 3/18/07, Wensui Liu [EMAIL PROTECTED] wrote:
Dear Lister,
I understand I can put '#' to put comment line by line. But is there a
way to put comment with multiple lines without having to
Try this:
plot(1:10)
legend(topleft, This ~ study ~ italic(n) == 3293)
On 3/17/07, Chabot Denis [EMAIL PROTECTED] wrote:
Hi,
As part of the legend to a plot, I need to have the n in italics
because it is a requirement of the journal I aim to publish in:
This study, n = 3293
Presently I
Lists are not good for this. There is an example in section 3.3 of
the proto vignette of using proto objects for this. That section
also references an S4 example although its pretty messy with S4.
You might want to look at the graph, RBGL and graphviz packages
in Bioconductor and the
it via references as requested then lists
are not appropriate.
On 3/16/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
Lists are not good for this. There is an example in section 3.3 of
the proto vignette of using proto objects for this. That section
also references an S4 example although its
/ similar
code examples?
Thanks.
Gabor Grothendieck wrote:
Lists are not good for this. There is an example in section 3.3 of
the proto vignette of using proto objects for this. That section
also references an S4 example although its pretty messy with S4.
You might want to look
On 3/16/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
1. Here is your example redone using proto:
library(proto)
parent - proto()
child - proto(a = 1)
parent$child1 - child
child$parent.env - parent
This last line should have been:
parent.env(child) - parent
# also just
Try this (or use xyplot.zoo and write a panel function for that):
library(zoo)
set.seed(1)
tt - as.Date(paste(2004, rep(1:2, 5), sample(28, 10), sep = -))
foo - zoo(matrix(rnorm(100), 10), tt)
pnl - function(x, y, ...) {
lines(x, y, ...)
abline(h = mean(y))
}
plot(foo, panel =
Regarding time series manipulation in R you could read the
two vignettes that come with the zoo package:
library(zoo)
vignette(zoo)
vignette(zoo-quickref)
Note that zoo is an entirely different system than rmetrics and timeDate so
if your question is specifically aimed at timeDate this does not
On 3/9/07, Maciej Radziejewski [EMAIL PROTECTED] wrote:
Hello,
I do some computations on datasets that come from climate models. These data
are huge arrays, significantly larger than typically available RAM, so they
have to be accessed row-by-row, or rather slice-by slice, depending on the
Read the FAQ 7.21:
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f
Note that it points out that you don't really want to do this anyways.
On 3/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi All
I am pretty new to R but saw stata and sas's
Such a calculation would be dominated by the time spent inside a call
to an offf-the-shelf C matrix inversion library used by R and is not really
any test of R itself.
On 3/9/07, Richard Morey [EMAIL PROTECTED] wrote:
My adviser has a Mac notebook that he bought 6 months ago, and I have a
PC
Try this:
library(gsubfn)
x - CB01_0171_03-27-2002-(Sample 26609)-(126)
unlist(strapply(x, ..-..-))
The gsubfn home page is at:
http://code.google.com/p/gsubfn/
On 3/9/07, Shawn Way [EMAIL PROTECTED] wrote:
I have a set of character strings like below:
data3[1]
[1]
This does not really answer the specific question you posted but
gsubfn can do it without using \\1 and \\2 like this (you probably
realized that already but I thought I would point it out just in case):
library(gsubfn)
gsubfn((?month\\d+)/(?day\\d+)/,
month + day ~ sprintf(%s/%s/, day,
Sorry. An extra line got in there. It should have been:
library(gsubfn)
gsubfn((?month\\d+)/(?day\\d+)/,
month + day ~ sprintf(%s/%s/, day, month),
backref = -2, British.dates, perl = TRUE)
On 3/8/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
This does not really answer the specific
Read R News 4/1 help desk article about dates.
Also see ?as.yearmon in the zoo package.
library(zoo)
dd - Sys.Date() + seq(1, 1000, 100)
dd
[1] 2007-03-09 2007-06-17 2007-09-25 2008-01-03 2008-04-12
[6] 2008-07-21 2008-10-29 2009-02-06 2009-05-17 2009-08-25
ym - as.yearmon(dd)
ym
[1] Mar
Try this:
C1 - 1:3
C2 - 4:6
sapply(ls(pattern = C), get)
On 3/8/07, BOISSON, Pascal [EMAIL PROTECTED] wrote:
Dear all,
It seems to be a recurrent problem to me and I am asking your help to
get over it once for all ...
My idea is :
I have variables C_1, C_2, C_3 ... that corresponds
Try na.locf from the zoo package and then use merge with specified suffixes:
library(zoo)
f - function(x) {
rownames(x) - NULL
merge(x, na.locf(x[-1], na.rm = FALSE), by = 0, suffixes = c(, .by))[-1]
}
do.call(rbind, by(x, x$id, f))
On 3/7/07, Jon Olav Vik [EMAIL PROTECTED] wrote:
Dear
Decompose your code into small understandable functions.
On 3/7/07, Aimin Yan [EMAIL PROTECTED] wrote:
Dear R list,
I have a question in R, it could be very simple, but I don't know how to do
it?
for example:
I assign 6 to x in beginning of of my R script code
x-6
..
After many
If your problem is small enough just use a grid of starting values
and run your optimization on each one and then take the best.
On 3/6/07, Dae-Jin Lee [EMAIL PROTECTED] wrote:
Hi all !
I've been trying to maximize a likelihood using optim( ) function, but it
seems that the function has
Hi, Your response to my post was EXTREMELY useful.
For georegistering I used the site:
http://www.runningmap.com
which lets one click on a a Yahoo! map and get lat/long in lower right.
As my data is in UTM I converted the lat/long to UTM using:
Is there any R software that create an image from Yahoo maps together
with points of known UTM coordinates (or lat/long marked? Note that
my region of interest is not covered in sufficient detail by Google maps.
It actually does not have to be Yahoo maps as long as it has sufficient
coverage of
There is an example in the example section of plotting two time series
on the same plot with different left hand and right hand scales here:
library(zoo)
?plot.zoo
On 3/2/07, Berta [EMAIL PROTECTED] wrote:
Hi R-Users,
I am trying to plot two time series in the same plot, but they measure
Suggest you review the help desk article on dates in
R News 4/1. It mentions that POSIXlt objects are
lists with 9 components and other facts about date
objects in R.
On 3/2/07, Sérgio Nunes [EMAIL PROTECTED] wrote:
Hi,
I'm having a weird result with the length() function:
a
[... omited
Please read the last line of every message to r-help and follow it when
posting. You ought to have provided small examples for A and B and
the result.
The following lists every row in z that is at a date in zs or is up to
4 rows later:
library(zoo)
z - zoo(matrix(101:148, 24), 2001:2024)
zs -
Check out:
https://stat.ethz.ch/pipermail/r-help/2006-October/114431.html
On 3/2/07, Ido M. Tamir [EMAIL PROTECTED] wrote:
Charilaos Skiadas wrote:
On Mar 2, 2007, at 9:42 AM, Ido M. Tamir wrote:
But how do I get from a function to its name?
Can you do this with any object in R?
In
See the aspect argument, asp, in ?plot.default . Also eqscplot in MASS.
On 3/2/07, Thomas Steiner [EMAIL PROTECTED] wrote:
I want to plot something (eg a circle) with a fixed ratio of the x and
y axis, or (even better) with a fixed size when I print it. Output
should then be a circle
Change the name of n to something else. Also please using spacing
in your code for readability.
x - c(10.2, 7.7, 5.1, 3.8, 2.6)
y - c(9, 8, 3, 2, 1)
n. - c(10, 9, 6, 8, 10)
derfs4 - function(b, x, y, n.)
+ {
+ b0 - b[1]
+ b1 - b[2]
+ c=b0 +b1 * x
+ d -
On 3/2/07, Ted Harding [EMAIL PROTECTED] wrote:
I think the first developments which could be recognised as
statistical cmputing (as opposed to using computers to do
statistics) were the pioneering GENSTAT and GLIM (1973-4,
though developed over some years previously). Possibly
what
Read in the data using readLines, extract out
all desired lines (namely those containing only
numbers, dots and spaces or those with the
word Time) and remove Retention from all
lines so that all remaining lines have two
fields. Now that we have desired lines
and all lines have two fields read
On 3/1/07, Bart Joosen [EMAIL PROTECTED] wrote:
Dear All,
thanks for the replies, Jim Holtman has given a solution which fits my
needs, but Gabor Grothendieck did the same thing,
but it looks like the coding will allow faster processing (should check this
out tomorrow on a big datafile
On Windows XP it worked for me on both 2.4.1 and 2.5.0. I did notice
that on 2.4.1 it says using Synchronous WinInet calls but does not
say this on 2.5.0. See below for the two transcripts.
ftp - ftp://anonymous:[EMAIL PROTECTED]/edgar/full-index/company.idx
download.file(url=ftp,
Try rq in quantreg using the default value for tau.
On 2/28/07, lalitha viswanath [EMAIL PROTECTED] wrote:
Hi
I am looking for suitable packages in R that do
regression analyses using least median squares method
(or better). Additionally, I am also looking for
packages that implement
You can evaluate it, differentiate it, pick apart its components,
use it as a title or legend in a plot, use it as a function body
and probably other things too:
e - expression(x+y)
eval(e, list(x = 1, y = 2)) # 3
D(e, x)
e[[1]][[1]] # +
e[[1]][[2]] # x
e[[1]][[3]] # y
plot(1:10, main = e)
Try this:
plot(cbind(observed = z$random +
z$trend * z$seasonal, trend = z$trend, seasonal = z$seasonal,
random = z$random), main = My title)
Change the * to + if your setup is additive.
On 2/27/07, Alberto Monteiro [EMAIL PROTECTED] wrote:
Is there any way to give a decent title
The FAQ does mention your point already.
On 2/27/07, Greg Snow [EMAIL PROTECTED] wrote:
Others have pointed you to the answer to your question, but both FAQ
7.21 and the assign help page should really have a big banner at the top
saying Here Be Dragons.
Using a loop or other automated
On 2/26/07, Thaden, John J [EMAIL PROTECTED] wrote:
I had written
...someattributes() does not seem to exist.
And Haris Skiadas replied
My help shows it as moreattributes, not
someattributes. (MacOSX), though doesn't
sound like it should be platform-specific).
Thanks for correcting
You can use par(usr) to get the min/max coords of the plot and then
use that. For example, this will plot a red dot in the middle of the
plot area regardless of the coordinates:
plot(1:10) # sample plot
usr - par(usr)
points(mean(usr[1:2]), mean(usr[3:4]), pch = 20, col = red) # red dot
See
Try this:
plot(1)
mtext(quote(A ~ bold(bold) ~ word), cex = 1.3)
On 2/24/07, Joseph Retzer [EMAIL PROTECTED] wrote:
Hi everyone,
I suspect this is an easy task however I've not been able to accomplish it.
I'd like to create an mtext title which has certain words bold, the rest not
bold.
There is a fourth possibility too:
4. `scale colour`
I guess my preference is #1, #2, #3 and #4 in that order with #1 best. Even
though #1 can conflict with S3 it usually does not and its historically what R
used so I usually just stay consistent with historical precedent. #2 is
otherwise best
Its a FAQ.
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f
On 2/25/07, Monika Kerekes [EMAIL PROTECTED] wrote:
Dear members,
I have started to work with R recently and there is one thing which I could
not solve so far. I don't know how to define
double-check
to make sure this doesn't happen.
Do you have any control on where those XML files are generated
though? It sounds to me it might be easier to fix the utility
generating those XML files, since it clearly is doing something wrong.
On Feb 24, 2007, at 11:07 AM, Gabor Grothendieck
Try this:
tab - crossprod(as.matrix(ratings[,-1]))
tab - tab - diag(diag(tab))
tab
tab / nrow(ratings)
On 2/22/07, Michael Wexler [EMAIL PROTECTED] wrote:
Using R version 2.4.1 (2006-12-18) on Windows, I have a dataset which
resembles this:
idatt1att2att3
111
Its not clear from your post what the framework is that you are working with
but assuming that you have sourced a file and want its name place this
fn - parent.frame(2)$ofile
# other code
in a file a.R, say, and from within R source it:
source(a.R)
This is not very safe and could
Try this:
DF[c(FALSE, tail(DF$Open, -1) head(DF$High, -1)), ]
or using zoo objects just compare the Open to the reverse lag of the High.
Lines - Date Open HighLowClose
1/15/2000 10 11 8 10
1/16/2000 12 12 10 11
1/17/2000 12 12 10
If you call splom with do.call then your solution should work:
do.call(splom, list(~data[cols], groups = as.symbol(groups), data = data,
panel = panel.superpose, col = colors))
or use as.name where as.symbol is which also works.
On 2/14/07, Roberto Perdisci [EMAIL PROTECTED] wrote:
The call to library(splines) is missing and also try replacing the
line b - ... with
fo - as.formula(sprintf(y ~ s(x0) + s(x1) + ns(%s, 3), names(Mydata)[i]))
b - do.call(gam, list(fo, data = Mydata))
to dynamically recreate the formula on each iteration of the loop
with the correct name, x2
Actually this simpler replacement for the b - ... line would work just as well:
fo - as.formula(sprintf(y ~ s(x0) + s(x1) + ns(%s, 3), names(Mydata)[i]))
b - gam(fo, data = Mydata)
On 2/13/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
The call to library(splines) is missing and also try
Also try gplot in the sna package to see if it does what you want.
Here are some examples from the r-help archives:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/87003.html
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/84442.html
On 2/13/07, Jarrett Byrnes [EMAIL PROTECTED] wrote:
Hey,
Suppose our data frames are called DF1, DF2 and DF3. Then
find the least number of rows, n, among them. Create a
list, DFs, of the last n rows of the data frames and another
list, mats, which is the same but in which each component is a
matrix. Create a parallel median function, pmedian,
)
On 2/13/07, Gabor Grothendieck [EMAIL PROTECTED] wrote:
Suppose our data frames are called DF1, DF2 and DF3. Then
find the least number of rows, n, among them. Create a
list, DFs, of the last n rows of the data frames and another
list, mats, which is the same but in which each component
Try:
aa[, !seq(ncol(aa)) %in% NULL]
On 2/11/07, Pierre Lapointe [EMAIL PROTECTED] wrote:
Hello,
I need to remove columns in a matrix. The number of columns varies from 0
to n. I can't figure out how to specify the zero case.
aa -matrix(runif(5^2),5,5)
#remove column 3
aa[,-3]
Try this:
my.data - M3[[sprintf(N%04d, 1)]]
On 2/11/07, Robert McFadden [EMAIL PROTECTED] wrote:
I would like to merge two parts of words to get a name of the data. First
M3$N (invariable) and second is a number from 0001 to 3003 -
M3$N0001,M3$N0002,...,M3$N3003. For example if I do it like
Check out:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f
On 2/9/07, Albert Vilella [EMAIL PROTECTED] wrote:
Hi all,
I am trying to plot a list of densityplots as png files, but when I do
it in a for loop, I get empty png files as a result.
Try this:
A * M[as.matrix(expand.grid(x,x))[,2:1]]
On 2/9/07, Robin Hankin [EMAIL PROTECTED] wrote:
Hi
Given an n-by-n matrix A, say n=10 and
A - matrix(1:100,10,10)
and a vector x of length n where 1 =x[i] = n for i=1..n
say
x - c(1,1,1,2,4,3,3,3,4,4)
and a matrix M of size
Try this:
fa$sum - ave(fa$X1, fa$X3, FUN = sum)
On 2/8/07, sun [EMAIL PROTECTED] wrote:
Hi,
Maybe this is a trivial question but I can not figure out a good solution.
I have a data frame fa and want to add a new column sum with the sum value
of fa$X1 grouped by fa$X3.
fa
X1 X2 X3
You can assign the environment within main to a variable in
the global environment and that will make it accessible even
after main terminates:
main - function() {
assign(main.env, environment(), .GlobalEnv)
x - 1; y - 2
}
main()
main.env$x
main.env$y
# or
attach(main.env)
search() # note
On 2/8/07, Albrecht, Dr. Stefan (AZ Private Equity Partner)
[EMAIL PROTECTED] wrote:
Dear all,
thanks a lot for your comments.
You raise several important points. I also think that depending on a certain
person maintaining a package can be dangerous, since this person might stop
working on
This may not be exactly the same to the last decimal but is nearly
twice as fast again:
set.seed(1)
n - 100
x - rnorm(n)
y - rnorm(n)
system.time({z - x y; z*x+(!z)*y})
user system elapsed
0.640.080.72
system.time({z - x y; z * (x-y) + y})
user system elapsed
Try this:
DF - data.frame(
col1 = factor(c(31*, 0, 102*, 71*, 31, 66, 47)),
col2 = factor(c(66, 0*, 66, 80, 2*, 31*, 38))
)
replace(DF, TRUE, as.numeric(sub(*, , as.matrix(DF), fixed = TRUE)))
On 2/6/07, Dale Steele [EMAIL PROTECTED] wrote:
Given two columns of type character
401 - 500 of 3333 matches
Mail list logo