Displaying 20 results from an estimated 20000 matches similar to: "favorite useful tools?"
2009 Nov 11
2
partial cumsum
Hello,
I am searching for a function to calculate "partial" cumsums.
For example it should calculate the cumulative sums until a NA appears,
and restart the cumsum calculation after the NA.
this:
x <- c(1, 2, 3, NA, 5, 6, 7, 8, 9, 10)
should become this:
1 3 6 NA 5 11 18 26 35 45
any ideas?
thank you and best regards,
stefan
2009 Jan 27
2
working with tables -- was Re: Mode (statistics) in R?
Ok, so I'm slowly figuring out what a factor is, and was able to follow
the related thread about finding a mode by using constructs like
my_mode = as.numeric(names(table(x))[which.max(table(x))])
Now, suppose I want to keep looking for other modes? For example,
Rgames> sample(seq(1,10),50,replace=TRUE)->bag
Rgames> bag
[1] 2 8 8 10 7 3 2 9 8 3 8 9 6 6 10 10 7 1
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
2010 Nov 20
1
how to draw manifold?
Hi,
I need some help either in how to configure variables for wireframe(),
or some suggestions as to other graphics commands to use for plotting a
2-D manifold in 3-D space.
Here is an example I tried (in the hopes that it would plot a helical
line) :
xsp<-matrix(c(cos(seq(0,80)/5)),9,9)
ysp<-matrix(c(sin(seq(0,80)/5)),9,9)
zsp<-matrix(c((seq(0,80)/20)),9,9)
wireframe(zsp~xsp*ysp)
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
2013 Mar 26
2
Feed rle() output to hist()
I want to make a histogram from the lengths vector which is part of the
output of rle. But I don't know how to access that vector so that I use it
as an argument of hist(). What argument must I use so that I use the
lengths vector as an input to hist()?
Example output is:
Run Length Encoding
lengths: int [1:4] 1 2 3 3
values : num [1:4] -1 1 -1 1
A printout of the function rle() may
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.
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
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?
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
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 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?