Anyone got a neat way to chop a vector up into smaller subvectors?
This is what I have now, which seems inelegant:
chop <- function(v, counts) {
stopifnot(sum(counts)==length(v))
end <- cumsum(counts)
beg <- c(1, 1+end[-length(end)])
begend <- cbind(beg, end)
apply(begend, 1, function(x)
Deepayan Sarkar writes:
> You can specify a fixed-width fontfamily if that helps:
>
> levelplot(matrix(seq(4,120,l=9),3,3),
> colorkey = list(at = seq(0, 120, 20),
> labels = list(labels = c(' 0',' 20',' 40','
> 60',' 80','100','120'),
>
>
> This is slightly simpler:
>
> levelplot(matrix(1:9,3,3), ylab.right = "title here",
> par.settings = list(layout.widths = list(axis.key.padding = 0,
>ylab.right = 2)))
That's good enough for me - thanks!
___
>
> Justification is hard-coded, and that's not easy to change. This is
> not only for the colorkey; e.g.,
>
> xyplot(y~1, scales = list(alternating = 3))
>
> will also give you left-aligned axes on the right.
>
> My only suggestion (other than custom labels as suggested by ilai) is
>
> levelplo
A recent paper on visualisation (in Neuron, a leading neuroscience
journal) surveyed how well previous articles in this journal labelled their
graphs (e.g. axis labelling and describing their error bars). Of
particular interest is that (only) 40% of plots labelled what their
colorkey was showing
R does a great job with the fine details regarding plots. e.g in the
following:
library(lattice)
y <- -4:4/10
xyplot(y~1, las=1)
the y axis is labelled with numbers -0.4, -0.2, 0.0, 0.2, 0.4 with the
numbers aligned on the decimal point.
How do I get the same behaviour in the colorkey of a lev
> I could of course do this the tedious way by simply entering
> the name-strings "G1", "G2" as arguments as well as the variable
> names G1, G2, in a call like
>
> meds3x3(G1,G2,"G1","G2")
>
> But I'd like to simply be able to pick up, within the function,
> the names of the variables that were
>> On 12/08/2011 03:45 AM, Xavier Fernández i Marín wrote:
>> > Hello,
>> >
>> > Although I have used a general search engine, r-seek, and browsed
>> > CRAN for contributed packages and R Gallery, I have not been able
>> > to find an implementation of Hinton Diagrams for representing
>> > weightin
Has anyone got a neat way in R to handle scientific units along with numeric
vectors? e.g. in mathematica, there is a Units package to allow you to
do the following:
85 Meter/Second * 10 Second
answer: 850 Meter
(taken from http://library.wolfram.com/howtos/units/)
Thanks, Stephen
___
Dear all,
I'm thinking of organising a tutorial on Emacs Speaks Statistics (ESS)
for next year's useR meeting.
http://www.warwick.ac.uk/statsdept/useR-2011/
Tony (Rossini) organised one a few years ago which covered the following
topics:
\begin{enumerate}
\item Introduction (now, 15 minu
Frank Liu wrote:
>
> I and some students built an "Emacs + ESS + R" installer, which allows
> users to download and install the newest version of Emacs, ESS, and R
> with little pain.The size of the installer is about 8Mb.
>
> http://sourceforge.net/projects/emacs-for-r/
>
> Please feel free t
ac.uk/user/sje30/downloads.html)
Stephen
--
Stephen Eglen, DAMTP, Centre for Mathematical Sciences
Wilberforce Road, Cambridge CB3 0WA, U.K.
Tel +44 (0)1223 765 761 s.j.eg...@damtp.cam.ac.uk
Fax +44 (0)1223 760 419 http://www.damtp.cam.ac.uk/user/
When drawing a graph, I'd like the unicode character 'middle dot'
(or something else similar to \cdot in latex) to be used when writing
numbers. Something like the following works for me:
x <- 1:10
y <- runif(length(x))
par(las=1, bty='n')
plot(x,y, ylim=c(0,1), yaxt='n')
p <- pretty(y)
axis(2,
Prof Brian Ripley writes:
> I realize I didn't give a solution:
>
> scan(con, "", sep="\n")
>
Thanks for this (and for correcting the help page); this works. I
also found a workaround using read.table which also allows gzfile
connections with an incomplete last line.
Stephen
_
Hi,
I have some text files that do not have trailing \n on the last
(incomplete) line; how do I read in the last line?
e.g. here is a test case: [linux + R version 2.6.1 (2007-11-26) ]
z <- gzfile("short.gz", open="w")
cat("7\n5\n3", file=z)
close(z)
z <- gzfile('short.gz')
readLines(z)
[1] "
15 matches
Mail list logo