Gabor Grothendieck wrote:
Actually in thinking about this its pretty easy to do it without Ryacas
too:
Df - f
body(Df) - deriv(body(f), x)
Df
This is weird.
f - function(x) { x^2 + 2*x+1 }
Df - f
body(Df) - deriv(body(f), x) # error
Also:
f - function(x) x^2 + 2 * x + 1
Df - f
body(Df)
I have a windows source file.r, with the default charset of windows.
I can't use it in Linux as source(file.r), because Linux's default is
Unicode. How can I read it?
Alberto Monteiro
__
R-help@stat.math.ethz.ch mailing list
Benilton Carvalho wrote:
iconv on your linux box should do the work.
I have a windows source file.r, with the default charset of windows.
I can't use it in Linux as source(file.r), because Linux's
default is
Unicode. How can I read it?
Soon after I posted, I found out how to do it.
Is there any way to run an R script without running R?
As an example, suppose I have a tcl/tk interface that asks
for a number (in a GUI) and displays its factorial. Is there a
way to invoke this script without invoking R?
I'm using R 2.4.1 in GNU/Linux Fedora Core 4.
Alberto Monteiro
Michael Dewey wrote:
I may be revealing my ignorance here, but is MatrixExp in the msm
package (available from CRAN) not relevant here?
Never heard about it. Searching with help.search(matrix) didn't
show any function that might be used as Matrix^n.
Alberto Monteiro
Paul Gilbert wrote:
I am getting a bit rusty on some of these things, but I seem to recall
that there is a numerical advantage (speed and/or accuracy?) to
diagonalizing: (...)
I think this also works for non-integer, negative, large, and complex
This is diverging into mathematics, maybe
Ron E. VanNimwegen wrote:
I was looking for a similar operator, because R uses scalar products
when raising a matrix to a power with ^. There might be something
more elegant, but this little loop function will do what you need for a
matrix mat raised to a power pow:
mp - function(mat,pow){
[for those that worry about these things, this _is_ a homework
assignment. However, it's not an R homework, it's a Geography
and History homework... and I want to use R to create a pretty
map]
Roger Bivand wrote:
Is there any way to associate one color to each country?
Try:
map_poly_obj -
Sorry if this is off-topic, but since there are so many data sets in R,
I wonder if there is any data set with Geographic data, like
(latitude,longitude) lists of the contour of the continents and
countries.
Alberto Monteiro
__
Petr PIKAL wrote:
You probably could get quicker answer trying to use some search
posibilities provided by CRAN.
OTOH, if we try to google for R, we get 1.880.000.000 hits :-)
Alberto Monteiro
__
R-help@stat.math.ethz.ch mailing list
Theo Borm wrote:
Think of a sort of power roulette, played with 58 balls
simultaneously, with a wheel containing 36 red/black slots of unequal
size, and 1 green slot. I need to calculate the probability that each of
the 36 red/black slots contains at least one ball.
Ah, now we come to a more
Duncan Murdoch wrote:
Suggestion: Find a rectangular region containing the hull, and sample
uniformly there. Accept points that don't expand the hull of the
original points.
This is a feasible solution only in lower dimensions; the area of the
convex hull can become exponentially small
Duncan Temple Lang wrote:
Just for the record, the method has been added for that particular
type of tree. So the original
saveXML(tt, file = test.xml)
will work.
Ah, the wonders of free software... I didn't have to wait a single day
to have the bug fixed :-)
Alberto Monteiro
Bert Gunter wrote:
An expression object is the output of parse(), and so is R's representation
of a parsed expression. It is a type of list -- a parse tree for the
expression. This means that you can actually find the sorts of things you
mention by taking it apart as a list:
ex - parse(text
Charles Annis, P.E. wrote:
rpois(n, lambda)
... will do it. But you should tell us something about how you want your
numbers to be distributed, since rpois() produces integers having a Poisson
distribution.
nitpick
rpois does not generate random _integers_, it generates random
_natural
hadley wickham wrote:
What do you prefer/recommend for double-banger function names:
1 scale.colour
2 scale_colour
3 scaleColour
1 is more R-like, but conflicts with S3. 2 is a modern version of
number 1, but not many packages use it. Number 3 is more java-like.
(I like number 2
Any hints on how to make RSPython work? I downloaded and installed it, but
I can't use it neither from python nor from R!
Alberto Monteiro
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting
Duncan Temple Lang wrote:
Well, we'll need to know in what ways it doesn't work and
what operating system you are using, etc.
In python:
import RS
Traceback (most recent call last):
File stdin, line 1, in ?
ImportError: No module named RS
In R:
library(RSPython)
Erro em
I seems like I will join two threads :-)
Ok, RPy was installed (in Fedora Core 4, yum -y install rpy), and it
is running. However, I have a doubt, and the (meagre) documentation
doesn't seem to address it.
In python, when I do this:
import rpy
rpy.r.setwd(/mypath)
rpy.r.source(myfile.r)
I guess this sample is required for some practical application, say a
simulation for something done over the Earth. Then, I also guess that
the sample does not have to be _absolutely_ exact, but a reasonable
approximation can do it. And the ellipsoid is a rotation ellipsoid.
This is my
Larry White wrote:
Sorry - this must be obvious,
Yes, it is :-)
I want to be able to filter data in a dataframe before analyzing it.
For example, I'd like to plot(a,b) but only include values where b
1000.
If a and b are vectors, then b 1000 is another vector of logical
values.
You can
Deepayan Sarkar wrote:
# f1 is a function that takes one function
# as argument, and returns another function
f1 - function(f) function(x) f(x+1) - f(x)
# h(x) is g(x+1) - g(x) or 2x + 1
h - f1(g)
h
function(x) f(x+1)-f(x)
environment: 0264BE84
Presumably, 'f' takes the value 'g' in
Why this kind of assignment does not work?
n - 1
f - ifelse(n == 1, sin, cos)
f(pi)
this must be rewritten as:
n - 1
f - cos
if (n == 1) f - sin
f(pi)
[oops. 1.224606e-16 instead of zero. Damn floating point errors :-/]
Alberto Monteiro
Why this is not valid?
test - NULL
if (test) test
Alberto Monteiro
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide
Jim Holtman wrote:
Is this what you want? You have to reset the margins:
png(file.png, width=200, height=200)
par(mar=c(0,0,0,0)) # reset margins
plot(0, xlim=c(0,200), ylim=c(0,200), type='n')
polygon(c(50, 50, 150, 150), c(50, 150, 150, 50))
dev.off()
Yes and no. This sort-of does
Is there any way that I can do something like this:
png(file.png, width=200, height=200)
polygon(c(50, 50, 150, 150), c(50, 150, 150, 50))
dev.off()
and then have a png file with a 100 x 100 pixels rectangle in the middle
of it? It seems that when I call plot, it redefines the image
26 matches
Mail list logo