Displaying 20 results from an estimated 9000 matches similar to: "what can one do with (to) '..." ?"
2011 Dec 13
2
axis tick colors: only one value allowed?
Hi,
So far as I can tell, the 'col.ticks' parameter for axis() only uses the
first value provided. E.g.:
plot(0:1,0:1, col.ticks=c('blue','red','green')) #all ticks are blue
Just wondering if there's a different option in the basic plot commands
that can handle multiple colors, and also whether ggplot and/or lattice
allow for multiple tick colors.
2012 Apr 03
2
Looking for the name of a certain kind of quantile plot
Hi,
While playing with quantile-quantile plots, I wrote up some code which
plots something strangely different. Here's the pseudocode:
testhist <- hist(sample_data)
refhist <- hist(rnorm(n, mean=0,sd=1)) # for some large-ish n
cumtest <- cumsum(testhist)
cumref <- cumsum(refhist)
plot(cumref,cumtest)
This produces a straight line of slope 1 for a sample with the same
2011 Oct 13
2
how to plot two surfaces with lattice::wireframe
Hi all,
I'd like to plot the Real and Imaginary parts of some f(z) as two
different surfaces in wireframe (the row/column axes are the real and
imag axes). I know I can do it by, roughly speaking, something like
plotz <- expand.grid(x={range of Re(z)}, y={range of Im(z), groups=1:2)
plotz$func<-c(Re(f(z),Im(f(z))
wireframe(func~x*y,data=plotz,groups=groups)
But that seems like a
2011 Dec 01
1
strange row numbering after rbind-ing a list
"Not that it really matters, but"
Can someone explain how the row numbers get assigned in the following
sequence? It looks like something funky happens when rbind() coerces
'bar' into a dataframe.
In either sequence of rbind below, once you get past the first two rows,
the row numbers count normally.
Rgames> (foo<-data.frame(x=5,y=4,r=3))
x y r
1 5 4 3
Rgames>
2011 Sep 13
1
stupid lm() question
I feel bad even asking, but:
Rgames> data(OrchardSprays)
Rgames> model<-lm(decrease~.,data=OrchardSprays)
Rgames> model
Call:
lm(formula = decrease ~ ., data = OrchardSprays)
Coefficients:
(Intercept) rowpos colpos treatmentB treatmentC
22.705 -2.784 -1.234 3.000 20.625
treatmentD treatmentE treatmentF treatmentG treatmentH
2011 Oct 07
1
round() and negative digits
Just wondering here -- I tested and found to my delight that
% round(325.4,-2)
[1] 300
gave me exactly what I would have expected (and wanted). Since it's not
explicitly mentioned in the documentation that negative 'digits' is
allowed, I just wanted to ask whether this behavior is intentional or a
happy turn of events. I'm always paranoid that something not explicitly
2011 Nov 20
1
place values into a matrix efficiently?
This question attacked me as I was thinking about matrix value updates.
I probably will never need to do this, but wanted to ask if there are
efficient methods to perform the for-loop in the following sequence.
%xymat<-matrix(rep(0,100) nr=10,nc=10) # empty matrix
%x<-1:10
%y<-sample.int(10,10,rep=T)
%for (j in 1:10) xymat[x[j],y[j]] <- some_function(x[j],y[j]) #to create
either
2009 Nov 29
4
lm() notation question
Hi,
A recent thread provided a (working) construct for lm:
lm(as.matrix(freeny[ix]) ~., freeny[-ix])
Can someone explain what is meant by the formula in that expression,
that is, what does "mymatrix~." do? I couldn't find any such example
in the lm() or formula() help pages.
thanks
Carl
2008 Nov 01
2
Hidden line algorithms and a different kind of waterfall
This is not the same as the recent thread on a waterfall graph.
I'm thinking about the rolling FFT display used in acoustics and other
spectrum analysis tasks.
Here's an example of a very fancy 3-D waterfall display:
http://www.ultimaserial.com/UltimaWaterfall.html
I was just wondering if there are any simple hidden-line tools in R that
I could use to draw simple waterfall displays.
2009 Jun 18
3
How to parse and eval a collection of items
Let's say I have, for some reason, a bunch of scalars (i.e.
single-valued variables) and I want to merge them all into a single
vector of values. Can someone recommend a better function, or simpler
way, to do so than the following?
Suppose my scalars' names are foo1, foo2, foo3, foo1high, foo2high,
foo3lo2, etc. Then I can do:
>ls(pat='foo')->thels
2008 Oct 14
2
list syntax question: which subscript is which
Hi,
Sorry to bother with something that should be simple, but I can't find it.
Suppose I have a list, each element of which is a 2xN dataframe, where N
could be different for each element.
Is there some simple structure to let me examine all the elements of
each element's first column? For example:
>foo
$first
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
$second
2011 Mar 30
3
how about a "<p-" operator?
I was cursing Matlab again today (what else is new) because the default
action for every Matlab command is to spew the result to the console,
and one must remember to put that darn ";" at the end of every line.
So I just wondered: was there ever a discussion as to providing some
modified version of the "<-" and "->" operators in R to do the reverse?
2008 Jun 07
3
favorite useful tools?
Hi,
I'm relatively new to R, so I don't know the full list of base (or
popular add-on packages) functions and tools available. For example, I
tripped across mention of rle() in a message about some other problem.
rle() turned out to be a handy shortcut to splitting some of my data by
magnitude (vaguely like a sequence-based histogram).
So I thought I'd ask: what small, or
2011 Feb 02
4
testing randomness of random number generators with student t-test?
Hi, subject more or less says it all.
I freely admit to not having bothered to find some of the online papers
about method of testing the quality of random number generators -- but
in an idle moment I wondered what to expect from something like the
following:
randa<-runif(1000)
randb<-runif(1000)
t.test(randa,randb)$p.value
var.test(randa,randb)$p.value
[repeat ad nauseum]
Is the
2009 Feb 08
3
general inverse solver?
Just wondering if there's an R package which does tricks similar to what
TK!Solver does.
TK!Solver, for those not lucky enough to have found it, basically allows
one to define a bunch of equations, assign values to an arbitrary subset
of the variables, from which it calculates (either directly when
possible or back-solving when not) the values of the other variable(s).
thanks
Carl
2011 May 02
2
easy way to do a 2-D fit to an array of data?
Hi,
I've got a matrix, Z, of values representing (as it happens) optical
power at each pixel location. Since I know in advance I've got a
single, convex peak, I would like to do a 2D parabolic fit of the form
Z = poly((x+y),2) where x and y are the x,y coordinates of each pixel
(or equivalently, the row, column numbers).
Is there an R function that lets me easily implement that?
2011 May 07
2
write.table vs. read.table and the argument "fill"
Just wondering how come read.table lets you specify fill=TRUE for ragged
arrays, but so far as I can tell, no equivalent for write.table?
Not a big deal, since I'm perfectly comfortable w/ write and scan and
the other file I/O goodies. "A foolish inconsistency..." and all that.
Carl
2010 Nov 07
2
stupid R tricks
Hi all,
Just thought I'd post this (maybe) helpful tool I wrote. For people
like me who are bad at keeping a clean environment, it's a time-saver.
#simple command to get only one type of object in current environment
lstype<-function(type='closure'){
inlist<-ls(.GlobalEnv)
if (type=='function') type <-'closure'
2009 Oct 15
2
how to install JGR manually?
Here's the problem: on Windows, the 'jgr.exe' tool starts up by checking
for a connecting to the 'net in order to grab the support packages.
Well, we have machines at work that are not and never will be connected
to the Internet. I tried manually installing all the packages (JGR,
Rjava, etc) but the jgr.exe still tries to find a connection.
Is there any way around this?
2010 Aug 25
4
OT: R for iPhone/iPad OS?
No, seriously: I've had more than one person at work wonder what math
toolset could be loaded onto iOS. So, before Matlab, FreeMat,
Mathematia, SciLab, Octave, or numpy (:-) ) produces a version for iPad,
any chance someone is working on R for iPad?