On 2/2/11 3:59 AM, Łukasz Ręcławowicz wrote:
We don't need a loop!
require(Rmpfr)
factorial(mpfr(1:500,3800))
This is very good! I get an unexpected warning, though:
Warning message:
In if (mpfr.is.integer(x)) round(r) else r :
the condition has length 1 and only the first element will
Duncan Murdoch wrote:
On 11/16/2009 8:21 AM, Ottorino-Luca Pantani wrote:
Dear R users,
my problem today deals with my ignorance on regular expressions.
a matter I recently discovered.
You were close. First, gsub by default doesn't need escapes before
the parens. (There are lots of
Martin Morgan wrote:
Gabor Grothendieck wrote:
Try this:
setClass(zoo)
[1] zoo
'zoo' is I guess intended as an S3 class (from library zoo), so
setOldClass('zoo') is appropriate. Otherwise, setClass(zoo) creates a
new virtual class.
Peter Dalgaard wrote:
Wacek Kusnierczyk wrote:
Martin Morgan wrote:
Gabor Grothendieck wrote:
Try this:
setClass(zoo)
[1] zoo
'zoo' is I guess intended as an S3 class (from library zoo), so
setOldClass('zoo') is appropriate. Otherwise, setClass(zoo) creates a
new virtual
Alfredo Alessandrini wrote:
Hi,
I've a vector like this:
inc
[1]NANANANANANANA
[8]NANANANANANANA
[15]NANANANANANA
Stavros Macrakis wrote
[...]
programming languages (including R). I don't know whether R's sum function
uses this technique or some other (e.g. Kahan summation), but it does manage
to give higher precision than summation with individual arithmetic
operators:
sum(c(2^63,1,-2^63)) = 1
Henrique Dallazuanna wrote:
Try this:
gsub(^M{1}, MOLE, names(data))
{1} is inessential here.
vQ
On Thu, Jun 18, 2009 at 8:24 PM, Mark Na mtb...@gmail.com wrote:
Dear R-helpers,
I would like to adapt the following code
names(data)-sub(M,MOLE,names(data))
which
Duncan Murdoch wrote:
Liaw, Andy wrote:
A colleague and I were trying to understand all the possible things one
can do with for loops in R, and found some surprises. I think we've
done sufficient detective work to have a good guess as to what's going
on underneath, but it would be nice to get
Steve Jaffe wrote:
I'm trying to build up a list of data.frames by appending one by one.
If x,y,z are data.frames, I can do
somelist - list(x, y, z) (or even somelist - list(x=x, y=y, z=z) to get
names)
But if I start with
somelist - list(x,y) and now want to go from this to
Stefan Uhmann wrote:
Dear List,
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
length(cbind(df$var1, df$var2, df$var3))
# 9
length(df$fac)
Stavros Macrakis wrote:
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),
Petr PIKAL wrote:
Hi
r-help-boun...@r-project.org napsal dne 16.06.2009 12:45:04:
Stefan Uhmann wrote:
Dear List,
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),
Payam Minoofar wrote:
IGOR Pro has a built-in function that returns the name of an object as a
string, and I was wondering if R has a similar facility.
?substitute
?deparse
vQ
__
R-help@r-project.org mailing list
Achim Zeileis wrote:
[...]
is.vector(as.vector(...)) is not necessarily TRUE. Consider
x - cars[, 1, drop=FALSE]
is.vector(x)
is.vector(as.vector(x))
identical(x, as.vector(x))
interesting. i wonder why as.vector does not give, at the very least, a
warning when the result of
Gabor Grothendieck wrote:
On Mon, Jun 8, 2009 at 7:18 PM, Wacek
Kusnierczykwaclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Gabor Grothendieck wrote:
Try this. See ?regex for more.
x - 'This happened in the 21. century. (the dot behind 21 is'
regexpr((?![0-9]+)[.], x, perl =
Marc Schwartz wrote:
On Jun 8, 2009, at 5:27 PM, Barry Rowlingson wrote:
On Mon, Jun 8, 2009 at 10:40 PM, Tan, Richardr...@panagora.com wrote:
Hi,
This is not exactly an R question but I am trying to use gsub to
replace
a string that contains 5-9 alpha-numeric characters, at least one of
Wacek Kusnierczyk wrote:
Marc Schwartz wrote:
On Jun 8, 2009, at 5:27 PM, Barry Rowlingson wrote:
On Mon, Jun 8, 2009 at 10:40 PM, Tan, Richardr...@panagora.com wrote:
Hi,
This is not exactly an R question but I am trying to use gsub to
replace
a string that contains 5-9
Gabor Grothendieck wrote:
On Tue, Jun 9, 2009 at 3:04 AM, Wacek
Kusnierczykwaclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Gabor Grothendieck wrote:
On Mon, Jun 8, 2009 at 7:18 PM, Wacek
Kusnierczykwaclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Gabor Grothendieck wrote:
Marc Schwartz wrote:
On Jun 9, 2009, at 6:44 AM, Mark Heckmann wrote:
Hey all,
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
Greg Snow wrote:
Here is one way using a single pattern (so can be used in a substitution), it
uses Perl's positive look ahead patters:
test -
c(SHRT,5HRT,M1TCH,M1TCH5,LONG3RS,NONUMBER,TOOLNGG,ooops.3)
sub( '(?=[a-zA-Z]{0,8}[0-9])[a-zA-Z0-9]{5,9}', 'xxx', test, perl=TRUE)
Tan, Richard wrote:
Sorry I did not give some examples in my previous posting to make my
question clear. It's not exactly 1 digit, but at least one digit. Here
are some examples:
input = c(none='0foo f0oo foo0 foofoofoo0 0foofoofoo TOOL9NGG
NONUMBER',all='foob0 fo0o0b 0foob
Allan Engelhardt wrote:
See
http://wiki.r-project.org/rwiki/doku.php?id=misc:r_accuracy:decimal_numbers#sequences_of_decimal_numbers
as usual, be careful about what is advertised in r docs and related
texts. on the r_accuracy page, you'll read:
For further information, see the digits
Gabor Grothendieck wrote:
Try this. See ?regex for more.
x - 'This happened in the 21. century. (the dot behind 21 is'
regexpr((?![0-9]+)[.], x, perl = TRUE)
[1] 24
attr(,match.length)
[1] 1
yes, but
gregexpr('(?![0-9]+)[.]', 'a. 1. a1.', perl=TRUE)
# 2 5 9
which,
Martin Morgan wrote:
Hi Vitalie --
Vitalie S. wrote:
Dear UseRs,
A simple class inheritance example:
setClass(test,representation(a=numeric))
setMethod(initialize,test,
function(.Object,x,...){
print(Initialization!!!)
Marc Belisle wrote:
Hi there,
I have 3 numeric variables: day (e.g., 05), month (e.g., 06), year (e.g.,
2009).
I would like to create a (string) variable of the following form:
month/day/year (e.g., 06/05/2009).
I would be grateful to anyone who could point me toward a solution.
Martin Morgan wrote:
[...]
it sounds approximately ok that defining a subclass fails if its
initalizer does not provide a value required by the initializer of the
superclass. pardon me my ignorance, but here's an obvious question:
what if i *do* want to extend a class that has an
Stavros Macrakis wrote:
I agree that it's inconsistent that
1:'2' -- 1:2 # this doesn't seem to be documented in ? seq
1+ '2' -- error
1+factor(2) -- NA (with a warning)
1 : factor(4) -- 1 (uses as.numeric/unclass of factor)
...i'd expect ...a successful
i think the error message might be even better, but this would require
'* to be even better. i know some will take it for lamenting: there is
an ugly lack of consistency here:
1:2
# 1 2
1:2.5
# 1 2 (coercion double - integer)
1:'2'
# 1 2 (corecion character - integer)
edwin Sendjaja wrote:
Hi VQ,
Thank you. It works like charm. But I think Peter's code is faster. What is
the difference?
i think peter's code is more r-elegant, though less generic. here's a
quick test, with not so surprising results. gsubfn is implemented in r,
not c, and it is
wow! :)
vQ
Henrik Bengtsson wrote:
library(gsubfn)
library(gtools)
library(rbenchmark)
n - 1
df - data.frame(
a = rnorm(n),
b = rnorm(n),
c = rnorm(n),
ip = replicate(n, paste(sample(255, 4), collapse='.'), simplify=TRUE)
)
res - benchmark(columns=c('test', 'elapsed'),
William Dunlap wrote:
Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Wacek Kusnierczyk
Sent: Thursday, May 28, 2009 12:31 PM
To: Caroline Bazzoli
Steve Jaffe wrote:
hmm, that is what I was afraid of. I considered that but thought to myself,
surely there must be an easier way. I wonder why this feature isn't
available. It's there in scripting languages, like perl, but also in
hardcore languages like C++ where std::sort and sorted
Duncan Murdoch wrote:
On 28/05/2009 6:06 PM, Steve Jaffe wrote:
hmm, that is what I was afraid of. I considered that but thought to
myself,
surely there must be an easier way. I wonder why this feature isn't
available. It's there in scripting languages, like perl, but also in
hardcore
Stavros Macrakis wrote:
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
Peter Dalgaard wrote:
Allan Engelhardt wrote:
IP addresses are very (very!) difficult to parse and sort correctly
because there are all sorts of supported formats. Try to use something
like PostgreSQL instead: it is already implemented there. But if you
are sure all your data is of the
Peter Dalgaard wrote:
Duncan Murdoch wrote:
On 27/05/2009 8:25 PM, Andrey Lyalko wrote:
How do I get removed from this mailing list?
Like most lists nowadays, it gives the instructions in each message
header:
List-Unsubscribe: https://stat.ethz.ch/mailman/options/r-help,
Gavin Simpson wrote:
The View message source would be a more direct way of viewing the full
email, not just the bits TBird shows you in the preview pane. I forget
how it is named exactly and under which menu it is found as it has been
quite a while since I used TBird.
indeed; it's C-U,
(diverted to r-devel, a source code patch attached)
Wacek Kusnierczyk wrote:
Allan Engelhardt wrote:
Immaterial, yes, but it is always good to test :) and your solution
*is* faster and it is even faster if you can assume byte strings:
:)
indeed; though if the speed is immaterial
Caroline Bazzoli wrote:
Dear R-experts,
I need to replace in an expression the character Cl by Cl+beta
But in the following case:
form-expression((Cl-(V *ka) ) +(V *Vm *exp(-(Clm/Vm) *t)))
gsub(Cl,(Cl+beta),as.character(form))
We obtain:
[1] ((Cl+beta) - (V * ka)) + (V * Vm *
Allan Engelhardt wrote:
Immaterial, yes, but it is always good to test :) and your solution
*is* faster and it is even faster if you can assume byte strings:
:)
indeed; though if the speed is immaterial (and in this case it
supposedly was), it's probably not worth risking fixed=TRUE removing
Dieter Menne wrote:
Peter Dalgaard P.Dalgaard at biostat.ku.dk writes:
Or, BTW, you can use within()
aq - within(airquality, rm(Day))
Please add this as an example to the docs of within.
possibly with the slightly more generic
unwanted - 'Day'
aq -
Monica Pisica wrote:
Hi everybody,
I have a vector of characters and i would like to extract certain parts. My
vector is named metr_list:
[1] F:/Naval_Live_Oaks/2005/data//BE.tif
[2] F:/Naval_Live_Oaks/2005/data//CH.tif
[3] F:/Naval_Live_Oaks/2005/data//CRR.tif
[4]
Monica Pisica wrote:
Hi everybody,
Thank you for the suggestions and especially the explanation Waclaw provided
for his code. Maybe one day i will be able to wrap my head around this.
Thanks again,
you're welcome. note that if efficiency is an issue, you'd better have
perl=TRUE
Romain Francois wrote:
Hollix wrote:
Hi there,
say, I have 100 matrices (m1,m2,...,m100) which I want to combine in
a list.
The list, thus, shall contain the matrices as components.
Is it necessary to mention all 100 matrices in the list() command? I
would
like to use just the first and
milton ruser wrote:
Hi Maura,
It is not elegant but may work.
actual.string- 12345abcdefgh12345abcdefgh
actual.string
actual.string-paste(substr(actual.string,
nchar(actual.string),nchar(actual.string)),
substr(actual.string, 1,nchar(actual.string)-1), sep=)
actual.string
#in a
jim holtman wrote:
You have to return a value from the function in the lapply and assign the
result to another object:
df - data.frame(a=1,b=2,c=3,d=4)
a - list(df,df,df,df)
# to change the name of the second, you have to change the name and then
return
# the dataframe as the
Paulo Grahl wrote:
Dear All:
I have a question regarding the behavior of functions.
Say I define a function that returns another function :
A - function(parameters) {
# calculations w/ parameters returning 'y'
tmpf - function(x) { # function of 'y' }
return(tmpf)
}
The
Peter Dalgaard wrote:
g...@ucalgary.ca wrote:
We would like to load data from Statistics Canada
(http://www.statcan.gc.ca/) using R,
for example, Employment and unemployment rates.
It seems to me that the tables are displayed in HTML.
I was wondering if you know how to load these tables.
Brigid Mooney wrote:
Hi,
I am trying to parse XML files and read them into R as a data frame,
but have been unable to find examples which I could apply
successfully.
I'm afraid I don't know much about XML, which makes this all the more
difficult. If someone could point me in the right
Stavros Macrakis wrote:
On Mon, May 18, 2009 at 6:00 PM, Gabor Grothendieck ggrothendi...@gmail.com
wrote:
I understood what you were asking but R is an oo language so
that's the model to use to do this sort of thing.
I am not talking about creating a new class with an
Wacek Kusnierczyk wrote:
Stavros Macrakis wrote:
[...]
I am not talking about creating a new class with an analogue to the
subtraction function. I am talking about a function which applies another
function to a sequence and its lagged version.
Functional arguments are used all over
Wacek Kusnierczyk wrote:
btw., the error message here is confusing:
lag = 1:2
diff(1:10, lag=lag)
# Error in diff.default(1:10, lag = lag) :
# 'lag' and 'differences' must be integers = 1
is.integer(lag)
# TRUE
all(lag = 1)
# TRUE
what is meant
Žroutík wrote:
SmoothData - list(exists=TRUE, span=0.001)
SmoothData
$exists
[1] TRUE
$span
[1] 0.001
exists(SmoothData)
TRUE
exists(SmoothData$span)
FALSE
'SmoothData$span' = 'foo'
exists(SmoothData$span)
# TRUE
exists(SmoothData[[2]])
Linlin Yan wrote:
SmoothData$span is not an object which can be checked by exists(), but
part of an object which can be checked by is.null().
is.null is unhelpful here, in that lists can contain NULL as a named
element, and retrieving a non-existent element returns NULL:
foo =
Stavros Macrakis wrote:
You might think that you can check names(xxx) to see if the slot has been
explicitly set, but it depends on *how* you have explicitly set the slot to
NULL:
xxx$hello - 3
xxx$hello - NULL
names(xxx)
character(0) # no names --
ronggui wrote:
I would second Dieter's point.
me to, among others because:
2009/5/18 Dieter Menne dieter.me...@menne-biomed.de:
Patrick Burns pburns at pburns.seanet.com writes:
I disagree with Dieter's last point.
Whether you use 'attach' or 'load'
should depend on whether
Uwe Ligges wrote:
Marie Sivertsen wrote:
Dear list,
Is there any functionality in R that would allow me to parse config
files?
Which kind of config files? R has read.dcf, for example.
indeed, there are quite a number of more or less unambiguously specified
configuration file formats.
Mike Lawrence wrote:
why not simply
vars=list()
for (i in 1:1000) vars[[i]] = var(z[[i]])
... or, much simpler,
vars = sapply(z, var)
vQ
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
Duncan Murdoch wrote:
On 5/15/2009 8:33 AM, deanj2k wrote:
Hi everyone, can anyone tell me how i can change how i display
mean(age), i
want it to say The mean age of patients within the sample is mean(age)
I think you want something like this:
cat(sprintf(The mean age of patients within
Marc Schwartz wrote:
On May 15, 2009, at 9:46 AM, Liviu Andronic wrote:
Dear all,
I'm trying to gsub() % with \% with no obvious success.
temp1 - c(mean, sd, 0%, 25%, 50%, 75%, 100%)
temp1
[1] mean sd 0% 25% 50% 75% 100%
gsub(%, \%, temp1, fixed=TRUE)
[1] mean sd 0% 25%
Greg Snow wrote:
Another possibility (maybe more readable, gives the option of a list,
probably not faster):
Replicate(1000, rexp(15,1) )
provided that simplify=FALSE:
is(replicate(10, rexp(15, 1)))
# matrix ...
is(replicate(10, rexp(15, 1), simplify=FALSE))
# list ...
Barry Rowlingson wrote:
On Wed, May 13, 2009 at 9:56 PM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Barry Rowlingson wrote:
n = 1000
benchmark(columns=c('test', 'elapsed'), order=NULL,
'for'={ l = list(); for (i in 1:n) l[[i]] = rnorm(i, 0, 1
Barry Rowlingson wrote:
[...]
Yes, you can probably vectorize this with lapply or something, but I
prefer clarity over concision when dealing with beginners...
but where's the preferred clarity in the for loop solution?
Seriously? You think:
lapply(1:n, rnorm, 0, 1)
is
Dimitris Rizopoulos wrote:
Wacek Kusnierczyk wrote:
Barry Rowlingson wrote:
On Wed, May 13, 2009 at 5:36 PM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Barry Rowlingson wrote:
Soln - for loop:
z=list()
for(i in 1:1000){z[[i]]=rnorm(100,0,1)}
now inspect
RON70 wrote:
Thanks for these suggestions. However I have one more question. Is there any
way to extract only numbers? For example I want to extract only 88 in my
example.
if you have just one integer number represented in a single string,
here's one way go:
strings = c('foo 1', '2
Peter Flom wrote:
Seriously? You think:
lapply(1:n, rnorm, 0, 1)
is 'clearer' than:
x=list()
for(i in 1:n){
x[[i]]=rnorm(i,0,1)
}
for beginners?
Firstly, using 'lapply' introduces a function (lapply) that doesn't
have an intuitive name. Also, it takes a function as an
Peter Flom wrote:
As a beginner, I agree the for loop is much clearer to me.
well, that's quite likely. especially given that typical courses in
programming, afaik, include for looping but not necessarily functional
stuff -- are you an r beginner, or a programming beginner?
Barry Rowlingson wrote:
As a beginner, I agree the for loop is much clearer to me.
[Warning: Contains mostly philosophy]
maybe quasi ;)
To me, the world and how I interact with it is procedural. When I want
to break six eggs I do 'get six eggs, repeat break egg until all
Barry Rowlingson wrote:
Computer scientists will write their beautiful manuscripts, but how
many people who come to R because they want to do a t-test or fit a
GLM will read them? That's the R-help audience now.
don't forget that r seems to take, maybe undeserved, the pride of being
a
jim holtman wrote:
Depending on what you want to do, use 'sprintf':
x - 1.23456789
x
[1] 1.234568
as.character(x)
[1] 1.23456789
sprintf(%.1f %.3f %.5f, x,x,x)
[1] 1.2 1.235 1.23457
... but remember that sprintf introduces excel bugs into r
Stefan Grosse wrote:
Debbie Zhang schrieb:
Now, I am trying to obtain the sample variance (S^2) of the 1000 samples
that I have generated before.
I am wondering what command I should use in order to get the sample variance
for all the 1000 samples.
What I am capable of doing now
(Ted Harding) wrote:
On 14-May-09 12:27:40, Wacek Kusnierczyk wrote:
... but remember that sprintf introduces excel bugs into r (i.e.,
rounding is not done according to the IEC 60559 standard, see ?round):
ns = c(0.05, 0.15)
round(ns, 1)
# 0.0 0.2
as.numeric(sprintf
James W. MacDonald wrote:
Wacek Kusnierczyk wrote:
(Ted Harding) wrote:
On 14-May-09 12:27:40, Wacek Kusnierczyk wrote:
... but remember that sprintf introduces excel bugs into r (i.e.,
rounding is not done according to the IEC 60559 standard, see
?round):
ns = c(0.05, 0.15
James W. MacDonald wrote:
Wacek Kusnierczyk wrote:
do they make pompous claims about their software and disregarding claims
about others' as well?
My mistake. I thought your concern was for the quality of the software
(quality of course being defined by a certain committee of one
(Ted Harding) wrote:
This happens also when you use C's fprintf and sprintf (at any rate
in my gcc):
r's printing routines (e.g., print, sprintf, cat, anything else?) seem
to rely on the underlying c sprintf, with no prior r-implemented
rounding. hence they import into r whatever
Warren Young wrote:
Farrel Buchinsky wrote:
Is R an appropriate tool for data manipulation and data reshaping and
data
organizing? I think so but someone who recently joined our group
thinks not.
The new recruit believes that python or another language is a far better
tool for developing
m = matrix(1:4, 2)
apply(m, 1, cat, '\n')
# 1 2
# 3 4
# NULL
why the null?
vQ
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
Peter Dalgaard wrote:
Wacek Kusnierczyk wrote:
m = matrix(1:4, 2)
apply(m, 1, cat, '\n')
# 1 2
# 3 4
# NULL
why the null?
It comes from unlist()ing a list of NULLs, which in turn are the return
values of cat().
yes; i'd think i'd get a list of nulls
Barry Rowlingson wrote:
On Wed, May 13, 2009 at 4:26 PM, Gábor Csárdi csa...@rmki.kfki.hu wrote:
On Wed, May 13, 2009 at 5:13 PM, Debbie Zhang debbie0...@hotmail.com wrote:
Dear R users,
Can anyone please tell me how to generate a large number of samples in R,
given certain
Barry Rowlingson wrote:
On Wed, May 13, 2009 at 5:36 PM, Wacek Kusnierczyk
waclaw.marcin.kusnierc...@idi.ntnu.no wrote:
Barry Rowlingson wrote:
Soln - for loop:
z=list()
for(i in 1:1000){z[[i]]=rnorm(100,0,1)}
now inspect the individual bits:
hist(z[[1]])
hist(z[[545
Romain Francois wrote:
Hi,
Something like this perhaps:
files - dir( pattern = \\.csv$ )
for( x in files){
assign( sub( \\.csv$, , x ) , read.csv(x), envir = .GlobalEnv )
}
or maybe
csvs = Map(read.csv, dir(pattern='\\.csv$'))
possibly with a correction of list item names
://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
---
Wacek Kusnierczyk, MD PhD
Simon Pickett wrote:
I bet at least a few people offered their services! It might be an
undercover sting operation to weed out the unethical amongst us :-)
... written by some of the r core developers?
vQ
__
R-help@r-project.org mailing list
Duncan Murdoch wrote:
On 29/04/2009 6:41 PM, Steven McKinney wrote:
foo - matrix(1:12, nrow = 3)
bar - data.frame(foo)
bar$NewCol - foo[foo[, 1] == 4, 4]
bar
X1 X2 X3 X4 NewCol
1 1 4 7 10 NA
2 2 5 8 11 NA
3 3 6 9 12 NA
Warning message:
In format.data.frame(x, digits =
Duncan Murdoch wrote:
On 29/04/2009 9:21 PM, Steven McKinney wrote:
Thanks Duncan,
Comments and a proposed bug fix in-line below:
Thanks; sorry for the misinformation about the $ method.
maybe it's a good idea to change your strategy and avoid blaming users
for faults that lie on the
Mike Miller wrote:
On Fri, 24 Apr 2009, Duncan Murdoch wrote:
On 4/24/2009 10:29 AM, Mike Miller wrote:
First, it looks like there is bug in the documentation...
According to the documentation for system():
http://stat.ethz.ch/R-manual/R-patched/library/base/html/system.html
input
Wacek Kusnierczyk wrote and forgot to add references:
it doesn't seem to be the usual way of explaining the matters. the bash
reference manual [1, sec. 3.6.1] (see also man bash) says:
[1] http://www.gnu.org/software/bash/manual/bashref.html
in peters' expert shell scripting [2, ch. 9
Wacek Kusnierczyk wrote:
Dieter Menne wrote:
R --vanilla
which I like most because of the taste.
once we talk about preferences, here's the version which i like most
because of (a) least typing, (b) the non-pompous little r:
... and (c) superior performance
Dieter Menne wrote:
Tena Sakai tsakai at gallo.ucsf.edu writes:
I learned 3 new tricks. (Not bad for a newbie?)
$ R --silent --no-save barebone.R
$ R --quiet --no-save barebone.R
$ R --slave barebone.R
And don't forget
R --vanilla
which I like most because of the
Tena Sakai wrote:
Hi,
That's pretty impressive performance, but wait.
Where does this little r come from? And how
does it differ from its big brother?
the little r comes from littler [1]. it doesn't claim to be larger than
it is.
[1] http://dirk.eddelbuettel.com/code/littler.html
Jim Lemon wrote:
thoeb wrote:
Hello,
does anybody know about how to send a command or a text line from R to
another program? I have written a script in which several
calculations are
made and outputfiles (csv) are generated. Afterwards I open another
program
(Fortran) via shell.exec. This
Tena Sakai wrote:
Hi,
I am a newbie with R. My environment is linux and
I have a file. I call it barebone.R, which has one
line:
cat ('Hello World!\n')
I execute this file as:
R --no-save barebone.R
And it does what I expect. What I get is 20+/- lines
of text, one of which is
Mario dos Reis wrote:
I've been trough the R documentation for about half an hour and it's
not clear to me how to do this:
I need to format to character a series of integers from 1 to 1000, and
I like them to look like
0001 0002, 0059, 0123 and so on. Padded with zeroes to have
four
baptiste auguie wrote:
sprintf(%04.f, 2)
makes no sense to use the float specifier for ints here; besides, it's
slower:
x = 1:10^5
library(rbenchmark)
benchmark(columns=c('test', 'elapsed'), replications=100,
sprintf('%05d', x),
sprintf('%05.f', x))
#
Peter Dalgaard wrote:
Nigel Birney wrote:
Hello all,
Apologize for the newbie question. What's the easiest way to do a SQL
inner
table join in R?
Say I have a table containing column names A, B, C and another which has
columns named C, D, E. I would like to do an inner table join on C and
Prof Brian Ripley wrote:
I think your subject line should read 'Excel bug'. From the R help
for round()
Note that for rounding off a 5, the IEC 60559 standard is expected
to be used, '_go to the even digit_'.
In case you did not recognize it, IEC 60559 is an international
J Dougherty wrote:
On Wednesday 22 April 2009 12:21:41 pm molinar wrote:
I am working on a project that requires me to do very large factorial
evaluations. On R the built in factorial function and the one I created
both are not able to do factorials over 170. The first gives an error and
Albyn Jones wrote:
On Wed, Apr 22, 2009 at 08:26:51PM -0700, Ben Bolker wrote:
??? octave is a Matlab clone, not a Mathematica clone (I would be
interested in an open source Mathematica clone ...) ???
You might take a look at Sage. It is not a mathematica clone, but
open
if you really really need to have it done from within r, you may want to
use an external facility such as bc, the 'basic calculator' [1,2]. for
example, use the (experimental!) r-bc:
source('http://r-bc.googlecode.com/svn/trunk/R/bc.R')
(you can also download the zipped package which will
Duncan Murdoch wrote:
ronggui wrote:
It is always unfair to complain about volunteer work, and what you
should do is to make contributions.
I only half agree with this:
... and i half agree with this (thus quarter agree with that). i think
it's pretty fair to complain about unclear
1 - 100 of 492 matches
Mail list logo