Or str_locate:
library(stringr)
str_locate(aabcd, bcd)
Hadley
On Mon, Oct 25, 2010 at 5:53 AM, jim holtman jholt...@gmail.com wrote:
I think what you want is 'regexpr':
regexpr(bcd, aabcd)
[1] 3
attr(,match.length)
[1] 3
On Mon, Oct 25, 2010 at 7:27 AM, yoav baranan
git is where the world is headed. This video is a little old:
http://www.youtube.com/watch?v=4XpnKHJAok8, but does a good job
getting the point across.
And lots of R users are using github already:
http://github.com/languages/R/created
Hadley
--
Assistant Professor / Dobelman Family Junior
On Tue, Oct 26, 2010 at 11:55 AM, Dennis Murphy djmu...@gmail.com wrote:
Hi:
When it comes to split, apply, combine, think plyr.
library(plyr)
ldply(split(afvtprelvefs, afvtprelvefs$basestudy),
function(x) coef(lm (ef ~ quartile, data=x, weights=1/ef_std)))
Or do it in two steps:
1. What is everyone else using? The network effect is important since
you want people to be able to access your repository and you want to
leverage your knowledge of the version control system for other
projects' repositories. To that extent Subversion is the clear choice
since its used on
Note how S3 methods are dispatched only by reference to the first
argument (on the left of the operator). I think S4 beats this by
having signatures that can dispatch depending on both arguments.
That's somewhat of a simplification for primitive binary operators. R
actually looks up the method
Beware of facile comparisons of this sort -- they may be apples and nematodes.
And they also imply that the main time sink is the computation. In my
experience, figuring out how to solve the problem using takes
considerably more time than 18 / 1000 seconds, and so investing your
energy in
It's hard to know without a minimal reproducible example, but you
probably want scale_fill_gradient or scale_fill_gradientn.
Hadley
On Thu, Oct 28, 2010 at 9:42 AM, Struchtemeyer, Chris
stru...@okstate.edu wrote:
I am very new to R and don't have any computer program experience
whatsoever. I
This is on my to do list:
https://github.com/hadley/ggplot2/issues/labels/facet#issue/107
Hadley
On Thu, Oct 28, 2010 at 11:51 AM, Matthew Pettis
matthew.pet...@gmail.com wrote:
Hi All,
Here is the code that I'll be referring to:
p - ggplot(wastran.data, aes(PER_KEY, EVENTS))
(p - p +
Hi all,
What's the equivalent to length(unique(x)) == 1 if want to ignore
small floating point differences? Should I look at diff(range(x)) or
sd(x) or something else? What cut off should I use?
If it helps to be explicit, I'm interested in detecting when a vector
is constant for the purpose
I think this does what you want (borrowing from all.equal.numeric):
all(abs((x - mean(x))) .Machine$double.eps^0.5)
with a vector of length 1 million, it took .076 seconds on a fairly old
system.
Hmmm, maybe I want:
all.equal(min(x), max(x))
?
Hadley
--
Assistant Professor / Dobelman
Where the value of exp(1) as computed by R is concerned, you have
been deceived by what R displays (prints) on screen. The default
is to display any number to 7 digits of accuracy, but that is not
the accuracy of the number held internally by R:
exp(1)
# [1] 2.718282
exp(1) - 2.718282
rowsum(value, paste(factor1, factor2, factor3))
That is dangerous in general, and always inefficient. Imagine factor1
is c(a, a b) and factor2 is (b c, c). Use interaction with
drop = T.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
res - function(x) resid(x)
ds_test$u - do.call(c, llply(mods, res))
I'd be a little careful with this, because there's no guarantee the
results will by ordered in the same way as the input (and I'd also
prefer ds_test$u - unlist(llply(mods, res)) or ds_test$u -
laply(mods, res))
In your case,
Since roxygen is a great help to document R packages, I am wondering
if there exists an approach to go back from the raw Rd files to
roxygen-documentation? E.g. turn \author{Somebody} into @author
Somebody. This sounds ridiculous, but I believe it helps in the long
term for me to maintain R
You may find it easier to use a frequency polygon, geom = freqpoly.
Hadley
On Tue, Nov 30, 2010 at 2:36 PM, Small Sandy (NHS Greater Glasgow
Clyde) sandy.sm...@nhs.net wrote:
Hi
With ggplot2 I can very easily create beautiful histograms but I would like
to put two histograms on the same
strings - replicate(1e5, paste(sample(letters, 100, rep = T), collapse = ))
system.time(strings[-1] == strings[-1e5])
# user system elapsed
# 0.016 0.000 0.017
So it takes ~1/100 of a second to do ~100,000 string comparisons. You
need to provide a reproducible example that illustrates
On Wed, Jul 14, 2010 at 7:39 AM, thmsfuller...@gmail.com
thmsfuller...@gmail.com wrote:
Hi All,
The last line if the following code returns the error right below this
paragraph. Essentially, I use the operator %:% to retrieve a variable
in a nested frame. Then I want to use the same operator
For some reason package writers seem to prefer maximally uninformative
names for their packages. To take some examples of recently announced
packages, can anyone guess what packages 'FDTH', 'rtv', or 'lavaan'
do? Why the aversion to informative names along the lines of
For a quick fix, you probably need to reinstall plyr.
Hadley
On Wed, Jul 14, 2010 at 11:03 PM, stephen sefick ssef...@gmail.com wrote:
This is the first time that I have tried to update packages with a
tinkered around with .Rprofile. I start R with R --vanilla and it
does not load my
So distributing code to other people is preferably done using R packages,
which gives you this option.
However (as far as I am aware), note that this option is checked at
package build time, not at load time.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
Department of
On Wed, Jul 14, 2010 at 1:32 AM, Ian Bentley ian.bent...@gmail.com wrote:
I've got a couple of more changes that I want to make to my plot, and I
can't figure things out. Thanks for all the help.
I'm using this R script
library(ggplot2)
library(lattice)
# Generate 50 data sets of size 100
On Thu, Jul 15, 2010 at 11:08 PM, Dennis Murphy djmu...@gmail.com wrote:
Hi:
I sincerely hope there's an easier way, but one method to get this is as
follows,
with d as the data frame name of your test data:
d - d[order(with(d, Age, School, rev(Grade))), ]
d$Count - do.call(c, mapply(seq,
The problem is in data.frame[ and any NA in a logical vector will return a
row of NA's. This can be avoid by wrapping which() around the logical vector
which seems entirely wasteful or using subset().
The basic philosophy that causes this behaviour is sensible in my
opinion: missing values
ddply(ma, .(variable), summarise, mean = mean(value), sd = sd(value),
skewness = skewness(value), median = median(value),
mean.gt.med = mean.gt.med(value))
In principle, you should be able to do:
ddply(ma, .(variable), colwise(each(mean, sd, skewness, median, mean.gt.med)))
but
Did you look at the examples in sample?
# sample()'s surprise -- example
x - 1:10
sample(x[x 8]) # length 2
sample(x[x 9]) # oops -- length 10!
sample(x[x 10]) # length 0
## For R = 2.11.0 only
resample - function(x, ...) x[sample.int(length(x), ...)]
resample(x[x 8]) # length
What is your null hypothesis? What is your alternate hypothesis? What
is the test statistic? Why do you want a p-value?
Hadley
On Thu, Jul 22, 2010 at 5:40 PM, jd6688 jdsignat...@gmail.com wrote:
Here is my dataframe with 1000 rows:
employee_id weigth p-value
100
On Sat, Jul 24, 2010 at 2:23 AM, Jeff Newmiller
jdnew...@dcn.davis.ca.us wrote:
Fahim Md wrote:
Is there any function/way to merge/unite the following data
GENEID col1 col2 col3 col4
G234064 1 0 0
plyr is a set of tools for a common set of problems: you need to break
down a big data structure into manageable pieces, operate on each
piece and then put all the pieces back together. For example, you
might want to:
* fit the same model to subsets of a data frame
* quickly calculate
Here's one way, using a function from the plyr package:
TheLittleOne-data.frame(cbind(c(2,3),c(2,3)))
TheBigOne-data.frame(cbind(c(1,1,2),c(1,1,2)))
keys - plyr:::join.keys(TheBigOne, TheLittleOne)
!(keys$x %in% keys$y)
TheBigOne[!(keys$x %in% keys$y), ]
Hadley
On Thu, Jul 29, 2010 at 1:38
Well, here's one way that might work (explanation below):
The ideas is to turn each row into a character vector and then work with the
two character vectors.
bigs - do.call(paste,TheBigOne)
ix - which(bigs %in% setdiff(bigs,do.call(paste,TheLittleOne)))
TheBigOne[ix,]
However, this may
On Fri, Aug 6, 2010 at 9:24 AM, W Eryk Wolski wewol...@gmail.com wrote:
Hi,
Would like to make an image
however the values in z are not on an uniform grid.
Have a dataset with
length(x) == length(y) == length(z)
x[1],y[1] gives the position of z[1]
and would like to encode value of z by
On Sat, Aug 7, 2010 at 2:54 AM, Michael Bedward
michael.bedw...@gmail.com wrote:
On 7 August 2010 06:26, Hadley Wickham wrote:
library(ggplot2)
qplot(x, y, fill = z, data = df, geom = tile)
Hi Hadley,
I read the original question as being about irregularly spaced data.
The above method
With sweave, you need to explicitly print() the output of ggplot2 and
lattice plots.
Hadley
On Mon, Aug 9, 2010 at 6:32 AM, W Eryk Wolski wewol...@gmail.com wrote:
qplot does (?) what I was looking for!
At least it plots what I want to plot in the interactive modus.
However, it seems not to
On Mon, Aug 9, 2010 at 9:29 AM, David Winsemius dwinsem...@comcast.net wrote:
If you look at the output (as I did) you should see that despite whatever
expectations you have developed regarding plyr, that it did not produce a
grouping variable:
ldply(dl, function(x) coef(summary(x)) )
fac
There is one further improvement to consider. When I tried using dlply to
tackle a problem on which I had been bashing my head for the last three days
and it gave just the results I had been looking for, I also noticed that the
dlply function returns the grouping variable levels in an
That's exactly what dlply does - so you should never have to do that
yourself.
I'm unclear what you are saying. Are you saying that the plyr function
_should_ have examined the objects in that list and determined that there
were 4 rows and properly labeled the rows to indicate which list
On Mon, Aug 9, 2010 at 4:30 PM, Matthew Dowle mdo...@mdowle.plus.com wrote:
Another option for consideration :
library(data.table)
mydt = as.data.table(mydf)
mydt[,as.list(coef(lm(y~x1+x2+x3))),by=fac]
fac X.Intercept. x1 x2 x3
[1,] 0 -0.16247059 1.130220
When ggplot2 verifies the widths before stacking (the default position for
histograms), it computes the widths from the minimum and maximum values for
each bin. However, because the width of the bins (0.28) is much smaller
than the scale of the edges (6.8e+09), there is some underflow and the
On Wed, Aug 11, 2010 at 10:14 PM, Brian Tsai btsa...@gmail.com wrote:
Hi all,
I'm interested in doing a dot plot where *both* the size and color (more
specifically, shade of grey) change with the associated value.
I've found examples online for ggplot2 where you can scale the size of the
You may find a close reading of ?merge helpful, particularly this
sentence: If there is more than one match, all possible
matches contribute one row each (so check that you don't have
multiple matches).
Hadley
On Sat, Aug 21, 2010 at 10:45 AM, Cecilia Carmo cecilia.ca...@ua.pt wrote:
Hi
Hi all,
Is there a function to determine whether a set of vectors is cleanly
recyclable? i.e. is there a common function for detecting the
error/warnings that underlie the following two function calls?
1:3 + 1:2
[1] 2 4 4
Warning message:
In 1:3 + 1:2 :
longer object length is not a multiple
I should note that I realise this function is pretty trivial to write
(see below), I just want to avoid reinventing the wheel.
recyclable - function(...) {
lengths - vapply(list(...), length, 1)
all(max(lengths) %% lengths == 0)
}
Hadley
On Mon, Aug 23, 2010 at 10:33 AM, Hadley Wickham had
Hi all,
all.equal is generally very useful when you want to find the
differences between two objects. It breaks down however, when you
have two long strings to compare:
all.equal(a, b)
[1] 1 string mismatch
Does any one know of any good text diffing tools implemented in R?
Thanks,
Hadley
On Mon, Aug 23, 2010 at 1:02 PM, Alison Macalady a...@kmhome.org wrote:
Hi,
I have a 5-paneled figure that i made using the facet function in qplot
(ggplot). I've managed to arrange the panels into two rows/three columns,
but for the sake of easy visual comparisons between panels in my
On Tue, Aug 24, 2010 at 11:25 AM, Martin Morgan mtmor...@fhcrc.org wrote:
On 08/24/2010 07:27 AM, Doran, Harold wrote:
There is the stringMatch function in the MiscPsycho package.
stringMatch('Hadley', 'Hadley Wickham', normalize = 'no')
[1] 8
stringMatch('Hadley', 'Hadley Wickham
On Wed, Aug 25, 2010 at 6:05 AM, abotaha yaseen0...@gmail.com wrote:
Woow, it is amazing,
thank you very much.
yes i forget to attach the dates, however, the dates in my case is every 16
days.
so how i can use 16 day interval instead of month in by option.
Here's one way using the lubridate
Strings are not glamorous, high-profile components of R, but they do
play a big role in many data cleaning and preparations tasks. R
provides a solid set of string operations, but because they have grown
organically over time, they can be inconsistent and a little hard to
learn. Additionally, they
It's not just that counts might be zero, but also that the base of
each bar starts at zero. I really don't see how logging the y/axis of
a histogram makes sense.
Hadley
On Sunday, August 29, 2010, Joshua Wiley jwiley.ps...@gmail.com wrote:
Hi Derek,
Here is an option using the package
I have counts ranging over 4-6 orders of magnitude with peaks
occurring at various 'magic' values. Using a log scale for the
y-axis enables the smaller peaks, which would otherwise
be almost invisible bumps along the x-axis, to be seen
That doesn't justify the use of a _histogram_ - and
That doesn't justify the use of a _histogram_ - and regardless of
The usage highlights meaningful characteristics of the data.
What better justification for any method of analysis and display is
there?
That you're displaying something that is mathematically well founded
and meaningful - but
first ddply result did I see that some sort of misregistration had occurred;
Better with:
res -ddply(egraw2, .(category), .fun=function(df) {
sapply(df,
function(x) {mnx - mean(x, na.rm=TRUE);
sapply(x, function(z) if
# testthat
Testing your code is normally painful and boring. `testthat` tries to
make testing as fun as possible, so that you get a visceral
satisfaction from writing tests. Testing should be fun, not a drag, so
you do it all the time. To make that happen, `testthat`:
* Provides functions that
One common way around this is to pre-allocate memory and then to
populate the object using a loop, but a somewhat easier solution here
turns out to be ldply() in the plyr package. The following is the same
idea as do.call(rbind, l), only faster:
system.time(u3 - ldply(l, rbind))
user
Have a look at match and merge.
Hadley
On Wednesday, September 8, 2010, Michael Haenlein
haenl...@escpeurope.eu wrote:
Dear all,
I'm working with two data frames.
The first frame (agg_data) consists of two columns. agg_data[,1] is a unique
ID for each row and agg_data[,2] contains a
Why don't you read the answers to your stackoverflow question?
http://stackoverflow.com/questions/3665885/adding-a-list-of-vectors-to-a-data-frame-in-r/3667753
Hadley
On Wed, Sep 8, 2010 at 1:17 AM, raje...@cse.iitm.ac.in
raje...@cse.iitm.ac.in wrote:
Hi,
I have a preallocated dataframe to
daply(data.test, .(municipality, employed), function(d){mean(d$age)} )
employed
municipality no yes
A 41.58759 44.67463
B 55.57407 43.82545
C 43.59330 NA
The .drop argument has a different meaning in daply. Some R functions have
plyr is a set of tools for a common set of problems: you need to
__split__ up a big data structure into homogeneous pieces, __apply__ a
function to each piece and then __combine__ all the results back
together. For example, you might want to:
* fit the same model each patient subsets of a data
Reshape2 is a reboot of the reshape package. It's been over five years
since the first release of the package, and in that time I've learned
a tremendous amount about R programming, and how to work with data in
R. Reshape2 uses that knowledge to make a new package for reshaping
data that is much
I'm having trouble parsing this. What exactly do you want to do?
1 - Put a list as an element of a data.frame. That's quite convenient for my
pricing function.
I think this is a really bad idea. data.frames are not meant to be
used in this way. Why not use a list of lists?
It can be very
I think this is a really bad idea. data.frames are not meant to be
used in this way. Why not use a list of lists?
It can be very convenient, but I suspect the original poster is
confused about the different between vectors and lists.
I wouldn't be surprised if someone were confused, since
On Fri, Sep 10, 2010 at 10:23 AM, Henrik Bengtsson h...@stat.berkeley.edu
wrote:
Don't underestimate the importance of the choice of the algorithm you
use. That often makes a huge difference. Also, vectorization is key
in R, and when you use that you're really up there among the top
Hi Uwe,
The problem is most likely because the original poster doesn't have
the latest version of plyr. I correctly declare this dependency in
the DESCRIPTION
(http://cran.r-project.org/web/packages/reshape2/index.html), but
unfortunately R doesn't seem to use this information at run time,
Have a look at:
Computing Thousands of Test Statistics Simultaneously in R by Holger
Schwender and Tina Müller, in
http://stat-computing.org/newsletter/issues/scgn-18-1.pdf
Hadley
On Mon, Sep 13, 2010 at 4:26 PM, Alexey Ush usha...@yahoo.com wrote:
Hello,
I have a question regarding how to
Yes, this was a little bug that will be fixed in the next release.
Hadley
On Thu, Sep 16, 2010 at 1:11 PM, Dylan Beaudette
debeaude...@ucdavis.edu wrote:
Hi,
I have been trying to use the new .parallel argument with the most recent
version of plyr [1] to speed up some tasks. I can run the
That implies you need to update your version of plyr.
Hadley
On Wed, Sep 22, 2010 at 4:10 AM, RaoulD raoul.t.dso...@gmail.com wrote:
Hi,
I am using ggplot2 to create a boxplot that summarizes a continuous
variable. This code works fine for me on one PC however when I use it on
another it
Forgive me if this question has been addressed, but I was unable to find
anything in the r-help list or in cyberspace. My question is this: is there a
function, or set of functions, that will enable a script to detect its own
path? I have tried file.path() but that was not what I was
You might want to check out the plyr package.
Hadley
On Fri, Oct 1, 2010 at 6:05 AM, Werner W. pensterfuz...@yahoo.de wrote:
Hi,
I was wondering if there is an easy way to accomplish the following in R:
Often I want to apply a function, e.g. weighted.quantile from the Hmisc
package
to
That is, I want to define something like the
following using an a*ply method, but aaply gives a result in which the
applied .margin(s) do not appear last in the
result, contrary to the documentation for ?aaply. I think this is a bug,
either in the function or the documentation,
but perhaps
RFF-function(qtype, qOpt,...){}
i.e., I have two args that are compulsary and the rest are optional. Now when
my user passes the function call, I need to see what optional args are
defined and process accordingly...what I have so far is..
RFF-function(qtype, qOpt,...){
mc -
I'm not sure this will solve the issue because if I move the script, I would
still have to go into the script and edit the /path/to/my/script.r, or do
I misunderstand your workaround?
I'm looking for something like:
file.path.is.here(myscript.r)
and which would return something like:
[1]
On Wed, Oct 6, 2010 at 4:05 PM, Michael Friendly frien...@yorku.ca wrote:
I'm giving a talk about some aspects of language and conceptual tools for
thinking about how
to solve problems in several programming languages for statistical computing
and graphics. I'm particularly
interested in
Do you also know more references about variables? Unfortunately this was a
little bit short so I do not feel 100% sure I completely got it.
Try here:
http://github.com/hadley/devtools/wiki/Scoping
It's a work in progress.
Hadley
--
Assistant Professor / Dobelman Family Junior Chair
My guess is you are using an outdated R version for which the rather new
reshape2 package has not been compiled.
I wonder if install.packages() could detect this case (e.g. by also
checking if the source version is not available), and offer a more
informative error message.
Hadley
--
On Thu, Oct 14, 2010 at 11:56 AM, Joshua Wiley jwiley.ps...@gmail.com wrote:
Hi,
I do not believe you can use the save.image() function in this case.
save.image() is a wrapper for save() with defaults for the global
environment (your workspace). Try this instead, I believe it does
what you
Have you used persp or trans3d before? Here is a little piece of data that I
am want to convert to 2d. I can plot (x,z) or (z,y). I know there is a better
way to convert it to 2d. I did it long time back in my 3d geometry class.
http://en.wikipedia.org/wiki/3D_projection ?
Hadley
--
On Tue, Sep 29, 2009 at 6:58 AM, xavier.char...@free.fr wrote:
Apologies for the misunderstanding. I can come up with a solution that might
suit your needs:
library(plyr)
out - ddply(test, .(nr), function(x) data.frame(date=x$date,
index=rank(-as.integer(x$date
out[is.na(out$nr) |
On Wed, Sep 30, 2009 at 2:32 PM, Ista Zahn istaz...@gmail.com wrote:
An extremely verbose, but (in my view) easy to understand approach is:
data.f - data; data.f[which(data = 10)] - levs[1]; data.f[which(data
10)] - levs[2]; data.f - factor(data.f)
All those which()s are unnecessary. And
On Fri, Oct 2, 2009 at 4:24 AM, jim holtman jholt...@gmail.com wrote:
try this:
x - read.table(textConnection(x1 x2 x3
+ A 1 1.5
+ B 2 0.9
+ B 3 2.7
+ C 7 1.8
+ D 7 1.3), header=TRUE)
closeAllConnections()
do.call(rbind, lapply(split(seq(nrow(x)), x$x1),
The point Duncan was making was
What other value would you expect it to have after incrementing from 1 to
200 and stopping?
Well, depending on the scoping rules of the language you are used to,
you might expect i at the top-level to remain undefined.
Hadley
--
http://had.co.nz/
Whether or not what follows is to be recommended I don't know, but it
seems to work,
p - ggplot(diamonds, aes(carat, ..density..)) +
geom_histogram(binwidth = 0.2)
x = quote(cut)
facets = facet_grid(as.formula(bquote(.~.(x
p + facets
That's what I'd recommend. You can also just do
It is much easier to do you data preparation before plotting.
Cummul - ddply(subset(DF, precipitation!=NA), gauge_name,
function(x){
x$Cummul - cumsum(x$precipitation)
x
})
With a little less typing:
Cummul - ddply(subset(DF, precipitation!=NA), gauge_name, transform,
Please provide a reproducible example. I've had problems with
multcompLetters in the past, because I was giving it slightly
incorrect input.
Hadley
On Tue, Oct 6, 2009 at 7:41 AM, goz garbage.collec...@hotmail.fr wrote:
hello,
i try to use the multcomp letters, but i have problems with my
On Tue, Oct 13, 2009 at 6:57 AM, Ista Zahn istaz...@gmail.com wrote:
I'm sure there's a really cool way to do this with plyr, although I
don't know if my particular plyr version is much better. Anyway here
it is:
cmbine - read.csv(textConnection('names, mass, classes
apple,0.50,1
Can I use (a) the logo and/or (b) the slogan for the KCL R workshops?
I think it is quite clear from my website that this is neither about
the Springer book series nor about an R user conference.
No, sorry, the logo/name should be used exclusively for the Springer series
and the R User
Neither a1 nor 2:100 are lists, so it would seem that sapply would be more
appropriate.
The difference between lapply and sapply is the output, not the input.
Hadley
--
http://had.co.nz/
__
R-help@r-project.org mailing list
Is there a way to have some points solid and some points hollow? I have two
classes of points and there are so many points, that it's hard to see just
the difference in shapes. I'd like to have one of the classes be hollow in
addition to being a different shape. Any help would be grand.
Just a note: this technique is called memoisation.
Hadley
On Wed, Oct 14, 2009 at 3:42 PM, Benilton Carvalho bcarv...@jhsph.edu wrote:
Thank you very much, Martin. :)
b
On Oct 14, 2009, at 5:23 PM, Martin Morgan wrote:
Steve Lianoglou wrote:
Very clever, that looks to do the trick!
I
To answer one of your other questions: ggplot (and lattice) is/are
very powerful, but base graphics are (a) easier to get your head around
and (b) easier to adjust if you don't like the defaults. Changing things
just a little bit in ggplot can be difficult (as an example, the answer to
your
On Sun, Oct 18, 2009 at 10:29 AM, John Kane jrkrid...@yahoo.ca wrote:
Thanks Stefan, the annotate approach works beautifully. I had not got that
far in Hadley's book apparently :(
I'm not convinced though that the explaination
you shouldn't use aes in this case since nampost,
temprange,
What are the values of
length((Ht_cm[type=='SD'][from_treeline=='above'])[1])
I suspect the error is in the subsetting - the following seems more plausible:
Ht_cm[type=='SD' from_treeline=='above']
Hadley
--
http://had.co.nz/
__
Hi John,
Could you please provide a small reproducible example?
Thanks,
Hadley
Sent from my iPhone
On 26/10/2009, at 6:50 PM, Jonathan Bleyhl jonathan_ble...@affymetrix.com
wrote:
I'm trying to plot values based on a date and then overlay a
histogram also
by date. The problem is that
Hi Bryan,
Thanks for the reproducible example. The problem is actually in your
code, not mine ;) You probably want: y = min(res, na.rm = TRUE) - 0.1
* diff(range(res, na.rm = TRUE))
Hadley
(drop = TRUE solves a difference problem - it controls whether or not
to remove bins with zero count)
Do you have write permission in C:\Program Files\R\R-2.9.2\library? It
could be that the installer just tried to create the QRMlib subdir, and
failed, and that's why it doesn't exist.
One possible reason for failure is that your virus checker prevented
the R installer from creating a new
I can reproduce it with for example
x=c(-9.23, -9.56, -1.40)
But adding a single positive number, even .001, fixes it, while
adding a similar negative number introduces a new error message, so it
really looks like a bug in ggplot2 when all the values are negative.
Report it to the
On Wed, Oct 28, 2009 at 8:19 PM, Bill Gillespie bi...@metrumrg.com wrote:
I currently use lattice functions to produce multiple pages of plots using
the layout argument to specify the number of rows and columns of panels,
e.g.,
xyplot(price ~ carat | clarity, diamonds, layout = c(2, 2))
If you package depends on another package, it will be automatically installed.
Hadley
On Mon, Nov 2, 2009 at 12:56 PM, Jonathan Greenberg
greenb...@ucdavis.edu wrote:
R-helpers:
I'm working on an r-package that I want to make as easy-to-use as possible
for a novice R-user, which includes
Hi Paul,
You might want to try the gray colour scale - scale_fill_grey()
Unfortunately grid (the underlying graphics library that ggplot2 uses)
does not currently support patterns.
Hadley
On Wed, Nov 4, 2009 at 4:17 AM, Paul Chatfield p.s.chatfi...@rdg.ac.uk wrote:
Am trying to produce a
If readShapePoly() (deprecated - use readShapeSpatial() instead) says that
the data are not polygons, then they are not. If you want to fill
administrative boundaries polygons, you need polygons, not lines. The source
you are using is based on OpenStreetMaps, so more likely to be lines, and as
Hi all,
Is there a tool in base R to extract matched expressions from a
regular expression? i.e. given the regular expression (.*?) (.*?)
([ehtr]{5}) is there a way to extract the character vector c(one,
two, three) from the string one two three ?
Thanks,
Hadley
--
http://had.co.nz/
:
Is this what you want:
x - ' one two three '
y -
sub(.*?([^[:space:]]+)[[:space:]]+([^[:space:]]+)[[:space:]]+([ehrt]{5}).*,
+ \\1 \\2 \\3, x, perl=TRUE)
unlist(strsplit(y, ' '))
[1] one two three
On Sun, Nov 8, 2009 at 1:51 PM, Hadley Wickham had...@rice.edu
1 - 100 of 1414 matches
Mail list logo