Displaying 20 results from an estimated 20000 matches similar to: "any way to set defaults for par?"
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?
2008 Dec 09
2
Better way to find distances between points in a set?
I was playing around a bit to see how I could find the two points in a
set of points (or ordered pairs) furthest from each other.
Here's what I did:
1) created a Nrow by 2col matrix, so each row contains an x,y coordinate
pair.
2) fed the matrix to a nested mapply (cv is my matrix):
mapply(function(k,l) mapply(function(x,y,a,b)
+
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
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
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 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.
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
2008 Oct 04
1
back-solver: any R thing like TK!Solver?
Just thought I'd ask. For those who've never seen TK!Solver, I strongly
recommend taking a look. So far as I can tell, it's the only product of
its type available, retail or open source, for any platform.
What makes TK!Solver so cool is that it adaptively back-solves pretty
much any unknown from any set of equations you give it. (or vector full
of unknowns, producing a vector of
2011 Aug 15
2
what can one do with (to) '..." ?
I followed a couple threads from the archives and from
stackoverflow.com, and would like to know: just what is "..." ? What I
mean by this is,for example, from the point of view of a user running a
function in debug mode, is "..." an object, or does it exist in the
current environment as some thingy?
Maybe a better question to ask is: if I were to write some function
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 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?
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
2014 Feb 07
2
suggestion for "sets" tools upgrade
First, let me apologize in advance if this is the wrong place to submit
a suggestion for a change to functions in the base-R package. It never
really occurred to me that I'd have an idea worthy of such a change.
My idea is to provide an upgrade to all the "sets" tools (intersect,
union, setdiff, setequal) that allows the user to apply them in a
strictly algebraic style.
The