I have a modest-size XML file (52MB) in a format suited to xmlToDataFrame
(package XML).
I have successfully read it into R by splitting the file 10 ways then
running xmlToDataFrame on each part, then rbind.fill (package plyr) on the
result. This takes about 530 s total, and results in a
That won't work because R has special rules for evaluating things in the
function position. Examples:
*OK*
min(1:2)
min(1:2)
f-min; f(1:2)
do.call(min,list(1:2))
do.call(min,list(1:2)) # do.call converts string-function
*Not OK*
(min)(1:2) # string in function position is
Last time, I was told that I couldn't list my R package and associated
papers as a research activity with
substantial impact because it was outside my official scope of work.
(Even though I wrote it so I could
*do* my work.)
That seems wrong. My impression is that method papers were frequent
Has anyone here implemented Jon Kleinberg's burst detection algorithm
(Bursty and Hierarchical Structure in Streams
http://www.cs.cornell.edu/home/kleinber/bhs.pdf)?
I'd rather not reimplement if there's already running code available
Thanks,
-s
[[alternative HTML
? That does match up columns by name.
Hadley
On Thu, Jul 28, 2011 at 5:23 PM, Stavros Macrakis macra...@alum.mit.edu
wrote:
I have a file of data where each line is a series of name-value pairs,
but
where the names are not necessarily the same from line to line, e.g.
a=1,b=2,d=5
b=4,c=3,e
I have a file of data where each line is a series of name-value pairs, but
where the names are not necessarily the same from line to line, e.g.
a=1,b=2,d=5
b=4,c=3,e=3
a=5,d=1
I would like to create a data frame which lines up the data in the
corresponding columns. In this case, this
If I have 2 n-dimensional arrays, how do I compose them into a n+1-dimension
array?
Is there a standard R function that's something like the following, but that
gives clean errors, handles all the edge cases, etc.
abind - function(a,b) structure( c(a,b), dim = c(dim(a), 2) )
m1 -
Is there R software available for doing approximate matching of personal
names?
I have data about the same people produced by different organizations and
the only matching key I have is the name. I know that commercial solutions
exist, and I know I code code this from scratch, but I'd prefer to
On Wed, Apr 6, 2011 at 12:59, Martin Morgan mtmor...@fhcrc.org wrote:
On 04/04/2011 01:50 PM, William Dunlap wrote:
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Stavros Macrakis
Sent: Monday, April 04, 2011 1:15 PM
To: r
Is there a generic binary search routine in a standard library which
a) works for character vectors
b) runs in O(log(N)) time?
I'm aware of findInterval(x,vec), but it is restricted to numeric vectors.
I'm also aware of various hashing solutions (e.g. new.env(hash=TRUE) and
fastmatch),
read.table gives idiosyncratic results when the input is formatted
strangely, for example:
read.table(textConnection(a'b\nc'd\n),header=FALSE,fill=TRUE,sep=,quote=')
= c'd a'b c'd
read.table(textConnection(a'b\nc'd\nf'\n'\n),header=FALSE,fill=TRUE,sep=,quote=')
= f' \na b c'd f' \n
I don't understand why 'quantile' works in this case:
tt - rep(c('a','b'),c(10,3))
sapply(0:6/6,function(q) quantile(tt,probs=q,type=1))
0% 16.7% 33.3% 50% 66.7% 83.3% 100%
a a a a a b b
and also
On Tue, Jan 5, 2010 at 5:25 PM, Carl Witthoft c...@witthoft.com wrote:
quote:
There are certainly formulas for solving polynomials numerically up to
4th degree non-iteratively, but you will almost certainly get better results
using iterative methods.
I must be missing something here.
There are certainly formulas for solving polynomials numerically up to 4th
degree non-iteratively, but you will almost certainly get better results
using iterative methods.
Even the much more trivial formula for the 2nd degree (quadratic) is tricky
to implement correctly and accurately, see:
*
Unfortunately, expand.grid doesn't validate the class of its argument, so it
is reporting an internal error rather than something more intelligible.
On Tue, Dec 22, 2009 at 11:19 AM, Keith Jewell k.jew...@campden.co.ukwrote:
Just confirming it isn't the bug fixed in 2.11.0dev, and giving an
How can I determine what S3 method will be called for a particular
first-argument class?
I was imagining something like functionDispatch('str','numeric') =
utils:::str.default , but I can't find anything like this.
For that matter, I was wondering if anyone had written a version of
`methods`
When printing data.frames, R aligns columns by padding with spaces.
For example,
print(data.frame(x=c('a','bb','ccc')),right=FALSE)
x
1 a |-- vertical bar shows end of line
2 bb |-- vertical bar shows end of line
3 ccc|-- vertical bar shows end
M. Heiberger r...@temple.eduwrote:
Stavros Macrakis wrote:
I could of course write my own print function for this, but was
wondering if there was a standard way of doing it. If not in R,
perhaps there is some way to have ESS delete the final spaces?
ESS, or more precisely emacs, can
complication which made me hope that someone had already solved the problem
in R or ESS
-s
On Wed, Nov 11, 2009 at 8:43 PM, RICHARD M. HEIBERGER r...@temple.eduwrote:
On Wed, Nov 11, 2009 at 8:12 PM, Stavros Macrakis macra...@alum.mit.edu
wrote:
Thanks for the suggestion
I recommend you skim the Chambers book at Google Books or Amazon before
buying it as a guide to programming in R.
It is a fascinating book, but is more a discursive reflection on the history
and philosophy of R than a practical guide to programming in R. It
certainly explains the rationale for
On Thu, Aug 20, 2009 at 1:27 PM, David Winsemiusdwinsem...@comcast.net wrote:
...
But an extremely simple modification succeeds:
if ( 0 ) {
commented with zero
} else {
commented with one
}
Returns:
[1] \ncommented with one\n
Yes, but of course that executes neither one nor the
How can I determine how much memory a given piece of my code is
allocating (directly or indirectly)? -- essentially, the space
analogue of system.time, something like this:
system.space( x - rnorm(1) )
1 Vcells
system.space( for (i in 1:1000) x - rnorm(1) )
On Thu, Jul 30, 2009 at 12:01 PM, Martin Morganmtmor...@fhcrc.org wrote:
S4 objects do not have the semantics of environments, but of lists (or of
most other R objects), so it is as meaningful to ask why identical(s1, s2)
returns TRUE as it is to ask why identical(list(x=1), list(x=1))
On Thu, Jul 30, 2009 at 4:03 PM, Martin Morganmtmor...@fhcrc.org wrote:
S4 objects are mutable in the sense that one can write replacement methods
for them
Understood, but I don't think that's the usual meaning of 'mutable'.
-s
__
To test two environments for object equality (Lisp EQ), I can use 'identity':
e1 - environment(local(function()x))
e2 - environment(local(function()x))
identical(e1,e2) # compares object identity
[1] FALSE
identical(as.list(e1),as.list(e2))# compares values as
What do you mean by 'passing an array reference' and 'dereferencing' and
what do you mean by an 'R script'? What language(s) are you accustomed to?
If you mean 'passing an array value' to an 'R function', you just use the
argument name. Since R uses call-by-value (modulo the substitute
Kevin,
The habitués of this mailing list get irritated when users mail in
problem reports which don't include enough information to reproduce
the problem, as requested in the standard footer of r-help mail
(PLEASE ... provide commented, minimal, self-contained, reproducible
code.) This irritation
On Thu, Jul 16, 2009 at 4:44 PM, Erik Iversoneiver...@nmdp.org wrote:
I have a list of logical expressions, and I would really like it if the
names of the components of the list were identical to the corresponding
logical expression.
So, as an example:
df.example - data.frame(a = 1:10, b
On Tue, Jul 14, 2009 at 1:45 PM, Nair, Murlidharan T mn...@iusb.edu wrote:
I am trying to calculate coordinate transformations and in the process of
debugging my code using debug I found the following
Browse[1] direction[i]
[1] -1.570796
Browse[1] cos(direction[i])
[1] 6.123032e-17
On Fri, Jul 10, 2009 at 8:58 AM, Marc Schwartz marc_schwa...@me.com wrote:
Review the Note in ?as.character:
as.character truncates components of language objects to 500 characters
(was about 70 before 1.3.1).
If this limitation is too hard to fix, shouldn't it at least give a warning
or an
Here's one possibility:
vv - c(10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9)
(1+cumsum(diff(is.na(c(vv[1],vv)))==1)) * !is.na(vv)
[1] 1 1 1 1 1 1 0 0 0 0 2 2 2 0 0 0 3 3 3 3
On Tue, Jul 7, 2009 at 5:08 PM, Krishna Tateneni taten...@gmail.com wrote:
Greetings, I have a vector of the
Isn't the initial value of the variable T equal to the constant TRUE?
So unless he's modified the value of T, shouldn't it work?
-s
On 7/7/09, Max Kuhn mxk...@gmail.com wrote:
Unlike Splus, R does not use T for TRUE.
On Tue, Jul 7, 2009 at 6:05 PM, Michaelcomtech@gmail.com
install.packages('plotrix')
On Sun, Jun 28, 2009 at 3:51 PM, Jason Rupert jasonkrup...@yahoo.comwrote:
...
Error in legend(emptyspace(rep(x_vals_1, 3), c(y1_vals, y2_vals, y3_vals)),
:
could not find function emptyspace
I've searched via RSeek, but I have not been able to find anything
It gives me a headache, too! I think you'll have to wait for a more
expert user than me to supply explanations of these behaviors and
their rationales.
-s
On 6/26/09, Craig P. Pyrame crap...@gmail.com wrote:
Stavros Macrakis wrote:
On Thu, Jun 25, 2009 at 12:47 PM, Craig P
One way is:
a - c( %L H*L L*H H%, %L H* H%, %L L*H %, %L L*H % )
sub(^.*(^| )([^ ]+ [^ ]+$),\\2,a)
[1] L*H H% H* H% L*H % L*H %
Just be aware that this is not terribly efficient for very large strings.
-s
On Fri, Jun 26, 2009 at 7:21 AM, Fredrik Karlssondargo...@gmail.com
On Wed, Jun 24, 2009 at 9:04 PM, Rolf Turnerr.tur...@auckland.ac.nz wrote:
Do not get your knickers in a twist. R works simply and straightforwardly
in simple straightforward situations.
Though I find R an incredibly useful tool, alas, it is simply not true
that R works simply and
Erratum:
ifelse(TRUE,dd,dd) = 1230786000 (class numeric)
should be
ifelse(TRUE,tt,tt) = 1230786000 (class numeric)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
On Thu, Jun 25, 2009 at 12:47 PM, Craig P. Pyramecrap...@gmail.com wrote:
The man page Stavros quotes states that the class attribute of the result is
taken from 'test', which clearly is not the case:
Actually, the behavior is documented pretty clearly:
The mode of the answer will be
On Wed, Jun 24, 2009 at 12:34 PM, Mark Namtb...@gmail.com wrote:
The problem is that after running the ifelse statement, data$SOCIAL_STATUS
is converted from a factor to a character.
Is there some way I can avoid this conversion?
I'm afraid that ifelse has very bizarre semantics when the yes
I think what you mean is that you want to find the position of the first
non-NA value in the vector. is.na returns a boolean vector of the NA
values, so:
xx - c(NA,NA,NA,2,3,NA,4)
which(!is.na(xx))[1]
[1] 4
The other proposed solution,
which(diff(is.na(inc)) 0)
is incorrect:
(I am replacing R-devel and r-bugs with r-help as addressees.)
On Sat, Jun 20, 2009 at 9:45 AM, Dr. D. P. Kreil dpkr...@gmail.com wrote:
So if I request a calculation of 0.3-0.1-0.1-0.1 and I do not get 0,
that is not an issue of rounding / underflow (or whatever the correct
technical term
On Sat, Jun 20, 2009 at 4:10 PM, Dr. D. P. Kreil dpkr...@gmail.com wrote:
Ah, that's probably where I went wrong. I thought R would take the
0.1, the 0.3, the 3, convert them to extended precision binary
representations, do its calculations, an the reduction to normal
double precision binary
On Tue, Jun 16, 2009 at 5:16 AM, Stefan Uhmann stefan.uhm...@googlemail.com
wrote:
why does this not work?
df - data.frame(var1 = c(3,2,1), var2 = c(6,5,4), var3 = c(9,8,7),
fac = c('A', 'A', 'B'))
tapply(cbind(df$var1, df$var2, df$var3), df$fac, mean)
Because tapply is defined for
Of course functions can be used inside ifelse. They should return vectors.
Be careful of the effect of recycling:
ifelse(c(F,T,F,T,F,T),1:3,10:20)
[1] 10 2 12 1 14 3
with functions:
f- function(x) x/mean(x)
ifelse(c(F,T,F,T,F,T),sqrt(1:3),f(10:20))
[1] 0.667 1.4142136 0.800
On Mon, Jun 15, 2009 at 12:38 PM, Payam Minoofar
payam.minoo...@meissner.com wrote:
...I would like to have a function acquire an object by reference, and
within the function create new objects based on the original object and then
use the name of the original object as the base for the names
On Fri, Jun 12, 2009 at 6:09 AM, Duncan Murdoch murd...@stats.uwo.cawrote:
On 11/06/2009 5:35 PM, Stavros Macrakis wrote:
A table without names displays like a vector:
unname(table(2:3))
[1] 1 1 1
and preserves the table class (as with unname in general):
dput(unname(table(2
A table without names displays like a vector:
unname(table(2:3))
[1] 1 1 1
and preserves the table class (as with unname in general):
dput(unname(table(2:3)))
structure(c(1L, 1L), .Dim = 2L, class = table)
Does that make sense? R is not consistent in its treatment of such
Various people have provided technical solutions to your problem.
May I suggest, though, that 'splice' isn't quite the right word for this
operation? Splicing two pieces of rope / movie film / audio tape / wires /
etc. means connecting them at their ends, either at an extremity or in the
middle,
On Tue, Jun 9, 2009 at 11:16 AM, Titus von der Malsburg
malsb...@gmail.comwrote:
On Tue, Jun 09, 2009 at 11:04:03AM -0400, Stavros Macrakis wrote:
This may seem like a minor point, but I think it is worthwhile using
descriptive names for functions.
Makes sense. I thought I've seen
On Tue, Jun 9, 2009 at 7:44 AM, Mark Heckmann mark.heckm...@gmx.de wrote:
Thanks for your help. Your answers solved the problem I posted and that is
just when I noticed that I misspecified the problem ;)
My problem is to separate a German texts by sentences. Unfortunately I
haven't found an R
On Mon, Jun 8, 2009 at 1:48 PM, Cecilia Carmo cecilia.ca...@ua.pt wrote:
I have the following dataframe:
firm-c(rep(1:3,4))
year-c(rep(2001:2003,4))
X1-rep(c(10,NA),6)
X2-rep(c(5,NA,2),4)
data-data.frame(firm, year,X1,X2)
data
So I want to obtain the same dataframe with a variable X3
On Mon, Jun 8, 2009 at 3:36 PM, Don MacQueen m...@llnl.gov wrote:
Though I do agree that the way you've written the general case with any/
is.na and sum/na.rm is cleaner and clearer because more general, I don't
agree at all with what you say about nested ifelse's vs. a series of
assignments:
On Fri, Jun 5, 2009 at 4:09 AM, Allan Engelhardt all...@cybaea.com wrote:
I'm all done now. The max2 version below is what I went with in the end
for my proposed change to caret::nearZeroVar (which used the sort method).
Max Kuhn will make it available on CRAN soon. It speeds up that routine
all.equal(0,0i)
[1] Modes: numeric, complex
[2] target is numeric, current is complex
all.equal(1,1+0i)
[1] Modes: numeric, complex
[2] target is numeric, current is complex
Is this the intended behavior?
In general, all.equal is strict about argument mode, thus TRUE/1 and 1/'1'
do not
. If
the message said that a list of class
'data.frame' was found (probably the leading
case), then that would be much more helpful.
Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of The R Inferno and A Guide for the Unwilling S User)
Stavros
On Sun, May 31, 2009 at 6:10 PM, jim holtman jholt...@gmail.com wrote:
Message is very clear:
1 * 'a'
Error in 1 * a : non-numeric argument to binary operator
Though the user should have been able to figure this out, perhaps the error
message could be improved? After all, it is not the
I'm not sure I understand the max.col spec or its rationale. In particular:
* What is the significance and effect of assuming that the entries are
probabilities, as they do not seem to be limited to the interval [0,1]?
* In what contexts is it useful for max.col to consider numbers within a
Not sure what you mean by permutations here. I think what you mean is
that given a matrix m, you want a matrix whose rows are c(i,j,m[i,j]) for
all i and j. You can use the `melt` function in the `reshape` package for
this. See below.
Hope this helps,
-s
library(reshape)
value
1 a x 1
2 b x 2
3 a y 3
4 b y 4
as.matrix(melt(m))
x y value
[1,] a x 1
[2,] b x 2
[3,] a y 3
[4,] b y 4
On Fri, May 29, 2009 at 2:53 PM, Stavros Macrakis macra...@alum.mit.eduwrote:
Not sure what you mean by permutations here. I think what you mean
I agree that it is surprising that R doesn't provide a sort function with a
comparison function as argument. Perhaps that is partly because calling out
to a function for each comparison is relatively expensive; R prefers vector
operations.
That said, many useful custom sorts are easy to define by
What is the recommended way of checking whether an RODBC connection is open?
Since odbcValidChannel is not exported from namespace RODBC, I suppose I
shouldn't be using it.
This is the best I could come up with, but it seems a bit 'dirty' to be
using a tryCatch for something like this:
I couldn't get your suggested method to work:
`==.foo` - function(a,b) unclass(a)==unclass(b)
`.foo` - function(a,b) unclass(a) unclass(b) # invert comparison
is.na.foo - function(a)is.na(unclass(a))
sort(structure(sample(5),class=foo)) #- 1:5 -- not reversed
What am I missing?
On Wed, May 27, 2009 at 6:37 AM, Zeljko Vrba zv...@ifi.uio.no wrote:
Given an arbitrary data frame, it is easy to exclude a column given its
index:
df[,-2]. How to do the same thing given the column name? A naive attempt
df[,-name] did not work :)
Various ways:
Boolean index vector:
The 'ties.method' argument to 'rank' is the *third* positional argument to
'rank', so either you need to put it in the third position or you need to
use a named argument.
The fact that the variable you're using to represent ties.method is called
ties.method is irrelevant. That is, this:
I was wondering what the criteria were for including books on the Books
Related to R page http://www.r-project.org/doc/bib/R-books.html. (There is
no maintainer listed on this page.)
In particular, I was wondering why the following two books are not listed:
* Andrew Gelman, Jennifer Hill, *Data
Is anyone working on an R package for manipulating OWL (Web Ontology
Language), either natively or via an external library?
I don't see anything obviously relevant in CRAN, though of course OWL
functionality could be built up starting with the XML package.
Thanks,
-s
On Sun, May 24, 2009 at 12:28 PM, kulwinder banipal kbani...@hotmail.comwrote:
It is for sure little complicated then a plain XML file. The format of
binary file is according to XML schema. I have been able to get C parser
going to get information from binary with one caveat - I have to
On Thu, May 21, 2009 at 8:28 PM, Gabor Grothendieck ggrothendi...@gmail.com
wrote:
It uses hours/minutes/seconds for values 1 day and uses days and
fractions
of a day otherwise.
Yes, my examples were documenting this idiosyncracy.
For values and operations that it has not considered it
On Fri, May 22, 2009 at 10:03 AM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
Regarding division you could contribute that to the chron package.
I've contributed a few missing items and they were incorporated.
Good to know. Maybe I'll do that
Giving an error when it does not
On Fri, May 22, 2009 at 12:28 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
...The way this might appear in code is if someone wanted to calculate the
number of one hour intervals in 18 hours. One could write:
t18 - times(18:00:00)
t1 - times(1:00:00)
as.numeric(t18) /
On Wed, May 20, 2009 at 12:28 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
There is a times class in the chron package.
Perfect! Just what I was looking for.
On Wed, May 20, 2009 at 12:19 PM, jim holtman jholt...@gmail.com wrote:
If you want the hours from a POSIXct, here is one
On Wed, May 20, 2009 at 7:21 AM, Paulo Grahl pgr...@gmail.com wrote:
A - function(parameters) {
# calculations w/ parameters returning 'y'
tmpf - function(x) { # function of 'y' }
return(tmpf)
}
The value of the parameters are stored in an environment local to the
function.
On Tue, May 19, 2009 at 11:59 PM, tsunhin wong thjw...@gmail.com wrote:
In order to save time, I am planning to generate a data set of size
1500 x 2 with each data point a 9-digit decimal number, in order
to save my time.
I know R is limited to 2^31-1 and that my data set is not going to
What is the recommended class for time of day (independent of calendar
date)?
And what is the recommended way to get the time of day from a POSIXct
object? (Not a string representation, but a computable representation.)
I have looked in the man page for DateTimeClasses, in the Time Series
On Tue, May 19, 2009 at 12:07 PM, routík zrou...@gmail.com wrote:
SmoothData - list(exists=TRUE, span=0.001)
exists(SmoothData$span)
FALSE
As others have said, this just checks for the existence of a variable with
the (strange) name SmoothData$span.
In some sense, in R semantics, xxx$yyy
If you want to concatenate the *vectors*, you need 'c', which will
also coerce the elements to a common type.
If you want to concatenate the corresponding *elements* of the
vectors, you need 'paste', which will coerce them to character
strings.
-s
On 5/18/09, Henning Wildhagen
I would like to apply a function 'f' to the lagged version of a vector and
the vector itself.
This is easy to do explicitly:
mapply( f, v[-1], v[-length(v)] )
or in the case of a pointwise vector function, simply
f( v[-1], v[-length(v)] )
This is essentially the same as 'diff' but
for that. For
some examples see:
methods(diff)
On Mon, May 18, 2009 at 4:24 PM, Stavros Macrakis macra...@alum.mit.edu
wrote:
I would like to apply a function 'f' to the lagged version of a vector
and
the vector itself.
This is easy to do explicitly:
mapply( f, v[-1], v[-length(v
not understanding your objection.
-s
On Mon, May 18, 2009 at 5:48 PM, Stavros Macrakis macra...@alum.mit.edu
wrote:
I guess I wasn't very clear. The goal is not to define diff on a
different
object type, but to have a different 'subtraction' operator with the same
lag logic. An easy
On Sat, May 16, 2009 at 8:34 AM, Aval Sarri aval.sa...@gmail.com wrote:
# Create a socket from which to read lines - one at a time (record)
reader.socket - socketConnection( host = 'localhost', 5000,
server = TRUE, blocking = TRUE,
On Sat, May 16, 2009 at 9:11 AM, Aval Sarri aval.sa...@gmail.com wrote:
...I tried something line this also:
mydataframe - read.table (socket, sep=,);
but does not work says no input lines.
this also.
mydataframe - read.table (readLine(socket), sep=,);
Sorry, I didn't see this before my
What exactly is the R code you wrote for your function f? Without
that, it will be hard to help you.
-s
On Sat, May 16, 2009 at 2:48 AM, Kon Knafelman konk2...@hotmail.com wrote:
Hi Guy,
I am having trouble graphing the following function
√2Γ(n/2)/[√n - 1Γ((n - 1)/2 for the
On Thu, May 14, 2009 at 3:36 PM, G. Jay Kerns gke...@ysu.edu wrote:
set.seed(something)
x - rnorm(100)
y - runif(500)
# bunch of other stuff
...
Now, I give you a copy of my script.R (with the set.seed statement
removed, of course) together with the .RData file that was generated
by the
On Fri, May 15, 2009 at 12:07 PM, Stavros Macrakis
macra...@alum.mit.edu wrote:
system.time(whatseed(runif(1)))
Sorry, though I got lucky and my overall result is roughly correct,
this is an incorrect time measure. It should be
r - runif(1); system.time(whatseed(r))
because R's call
How can I convert an integer or double to and from their internal
representation as raws of length 4 and 8?
The following works for positive integers (including those represented
as floats):
# Convert integer (represented as integer or double) to sequence
# of raw bytes, least-significant byte
In stats::D, I was wondering why variables are represented as symbols
in expressions, but as strings in lists of variables:
D(quote(x^2),x) = 2*x
D(quote(x^2),quote(x)) = error Variable must be a character string
Strings are not allowed in the expression to denote variables:
On Sat, May 9, 2009 at 12:17 PM, Berwin A Turlach
ber...@maths.uwa.edu.au wrote:
log(H) = log(n) - log( 1/x_1 + 1/x_2 + ... + 1/x_n)
...But we need to calculate the logarithm of a sum from the logarithms of the
individual terms.
...The way to calculate log(x+y) from lx=log(x) and ly=log(y) ...
On Wed, Apr 22, 2009 at 3:28 AM, Andreas Wittmann
andreas_wittm...@gmx.de wrote:
i try to integrate lgamma from 0 to Inf.
Both gamma and log are positive and monotonically increasing for large
arguments.
What can you conclude about the integrability of log(gamma(x))?
-s
Judging from the traffic on this mailing list, a lot of R beginners
are trying to write things like
assign( paste( myvar, i), ...)
where they really should probably be writing
myvar[i] - ...
Do we have any idea where this bizarre habit comes from?
-s
mylist - c( 2,1,3,5,4 ) make a vector of numbers
sort(mylist)
[1] 1 2 3 4 5in sorted order
mylist - c( this, is, a, test)
sort(mylist)
[1] ais test this in sorted order
order(mylist)
[1] 3 2 4 1 original positions, e.g.
On Fri, Apr 17, 2009 at 10:12 PM, Brendan Morse morse.bren...@gmail.com wrote:
...I would like to automatically generate a series of matrices and
give them successive names. Here is what I thought at first:
t1-matrix(0, nrow=250, ncol=1)
for(i in 1:10){
t1[i]-rnorm(250)
}
What I
())
+ cat(sprintf(X is %i\n,x))
+ print(ans)
+ }
fact(4)
fact(x - 1)
X is 0
[1] 1
fact(x - 1)
X is 1
[1] 1
fact(x - 1)
X is 2
[1] 2
fact(x - 1)
X is 3
[1] 6
fact(4)
X is 4
[1] 24
2009/4/13 Stavros Macrakis macra...@alum.mit.edu:
I would like to trace functions, displaying
({cat(sprintf(x= %i\n,x));return}),print=T)
[1] fact
fact(4)
Tracing fact(4) on entry
x= 4
Tracing fact(x - 1) on entry
x= 3
Tracing fact(x - 1) on entry
x= 2
Tracing fact(x - 1) on entry
x= 1
Tracing fact(x - 1) on entry
x= 0
[1] 24
2009/4/17 Stavros Macrakis macra...@alum.mit.edu
There is a very nice intervals package in CRAN. It is impressively
efficient even for intersections of many millions of intervals. If I
remember correctly, it is purely in-core, so on a 32-bit R you'll be
limited to something like 100 million intervals. Is that enough for
your application?
It is certainly possible to create x2, x4, etc. using something like
assign( sprintf(x%d,i), ...value... ).
But are you sure you need separate *variables* x2, x4, etc.? Why not
create a list of vectors addressible as x[2] etc.?
You can do that with x - list() (to define the data type of x as
On Tue, Apr 14, 2009 at 1:08 PM, jimm-pa...@gmx.de wrote:
I'm fitting a line to my dataset. Later I want to predict missing values that
exceed the [min,max] interval of my empirical data, therefore I choose
surface=direct for extrapolation.
On Sun, Apr 12, 2009 at 11:01 PM, bill.venab...@csiro.au wrote:
It is, however, an interesting problem and there are the tools there to
handle it. Basically you need to create a class for each kind of measure you
want to handle (length, area, volume, weight, and so on) and then
overload
quantile( dsamp100, 0.05 )
On Mon, Apr 13, 2009 at 10:41 AM, Henry Cooper henry.1...@hotmail.co.uk wrote:
dsamp100-coef(100,39.83,5739,2869.1,49.44)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
On Mon, Apr 13, 2009 at 5:15 AM, Peter Dalgaard
p.dalga...@biostat.ku.dk wrote:
Stavros Macrakis wrote:
...c of two time differences is currently a numeric vector,
losing its units (hours, days, etc.) completely.
That's actually a generic feature/issue of c(). ...
There is some potential
I would like to trace functions, displaying their arguments and return
value, but I haven't been able to figure out how to do this with the
'trace' function.
After some thrashing, I got as far as this:
fact - function(x) if(x1) 1 else x*fact(x-1)
tracefnc - function()
1 - 100 of 234 matches
Mail list logo