Paul Smith wrote:
Dear All,
When one loads certain packages, some other dependent packages are
loaded as well. Is there some way of detaching them automatically when
one detaches the first package loaded? For instance,
library(sqldf)
Loading required package: RSQLite
Loading required
uv wrote:
Hi. I have a text file containing a few hundred lines of numbers, each line
has a different length. For example:
1 4 1 1 7
3 11 1 1 1 1 1 1 2
2 4 1 2
And so on. I need to do a simple plot function for each line, and then to
save each plot into a separate file. Is there any way
Paul Smith wrote:
Dear All,
I am trying to write my first R script. The code is simply
cat(Hello!\n)
However, when I run
$ R CMD BATCH myscript.R
I do not see Hello! on the console. I am using Fedora 7 (Linux) and R-2.5.1.
Any ideas?
You shouldn't see it on the console!
Paul Smith wrote:
Thanks, Barry. Indeed, the file myscript.Rout exists and contains the
output of cat. I was expecting a behavior similar to the bash scripts.
And by the way, cannot a R script write only on the console and just
what one tells it to write, likewise bash scripts?
Not easily,
Eric Turkheimer wrote:
How do people go about synchronizing multiple workspaces on different
workstations? I tend to wind up with projects spread around the various
machines I work on. I find that placing the directories on a server and
reading them remotely tends to slow things down.
If
yoo wrote:
Yea, I found the shutdown function in the java interface as well.. but is
there a way I can send a shutdown command through linux shell? (something
that I can cron?)
Write a minimal java program that sends the shutdown command, then run
that from your shell...
/obvious
Dirk Eddelbuettel wrote:
but the easiest way may just be to subscribe to Elijah's wonderful 'Planet R'
feed aggregator
My favourite RSS reader at the moment is the RSS cat caption generator:
http://lol.ianloic.com/feed/dirk.eddelbuettel.com/cranberries/index.rss
Barry
Lucke, Joseph F wrote:
Suddenly (e.g. yesterday) all my functions that have na.rm= as a
parameter (e.g., mean(), sd(), range(), etc.) have been reporting
warnings with na.rm=T. The message is Warning message: the condition
has length 1 and only the first element will be used in: if (na.rm) x
Chris Evans wrote:
Thanks Ted, great thread and I'm impressed with EpiData that I've
discovered through this. I'd still like something that is even more
integrated with R but maybe some day, if EpiData go fully open source as
I think they are doing (A full conversion plan to secure this and
Prof Brian Ripley wrote:
You could do this via a search_file() connection wrapper, but there is a
problem with ensuring connections get closed (which on.exit does here).
I'm not sure exactly what you mean by a 'search_file() connection
wrapper', but I have realised that its probably a
Zhiliang Ma wrote:
I want to find a function that can simply add
C:\inFiles\ into R's search path, so that we I scan a file R will go to
all the search paths to find it. In matlab, path(path,C:\inFiles) will do
this job, I'm just wondering if there is a similar function in R can do this
job.
Zhiliang Ma wrote:
Thanks, Barry.
In fact, I have a function just like yours, and I'm looking for a simple
alternative function, which is like path in Matlab.
Dont think it can be done - if you look at the code for 'scan', it
disappears off into internal() calls to do the business of
Martin Maechler wrote:
Erin == Erin Hodgess [EMAIL PROTECTED]
on Fri, 25 May 2007 06:10:10 -0500 writes:
Erin Dear R People:
Erin Is there any way to take a Windows version of R, compiled from
source,
Erin compress it, and put it on a Unix-like environment, please?
Just
Mark W Kimpel wrote:
I am running a very long loop and would like to save intermediate
results in case of a system or program crash. Here is the skeleton of
what my code would be:
for (i in 1:zillion)
I'm a bit worried about this line:
1:zillion
Error: cannot allocate vector of
Schmitt, Corinna wrote:
Dear R-Experts,
how can I divide the number 0.285 with 2. I need a function.
Result: 0.285 / 2 = 0.1425
Just get the / operator:
divide = get(/)
divide(0.285,2)
[1] 0.1425
Is that what you want?
Barry
__
Prof Brian Ripley wrote:
On Sun, 18 Mar 2007, Tim Keitt wrote:
I can't seem to find this anywhere. How do I set the default CRAN
repository _site wide_ on a linux box? What I want to do is eliminate
the pop-up list of repository locations when using
'install.packages()'. I know how to do
Seth Roberts wrote:
How can I use R to record the time of a mouse click?
Assuming they are mouse clicks on a plot from locator() or identify()
then its as trivial as this:
plot(1:10)
locator(1); when=date(); print(when)
$x
[1] 3.787584
$y
[1] 1.978947
[1] Mon Mar 12 09:34:07 2007
but
Duncan Murdoch wrote:
On 3/8/2007 9:06 AM, Duncan Murdoch wrote:
On 3/8/2007 8:54 AM, Mona Kanaan wrote:
Dear R-users,
If I would like to track the date when an R-object (specifically an R-
function) was modified, how can I achieve that? Furthermore, how can I
sort these objects based on
Petr Klasterecky wrote:
You need to specify what 'random' means. If you have any numbers, you
can always make them add-up to 1:
x - rnorm(100) #runif(100), rpois(100) etc.
x - x/sum(x)
sum(x)
I see a slight problem that may occur with dividing by sum(x) in
certain cases
Barry
Alberto Monteiro wrote:
This must be a stupid question, but is there any extension of get?
For example:
x - 10
get(x) # gives me 10
get(x^2) # gives me an error
'get' really only gets R objects - you want to evaluate an expression
- like this:
x=2
eval(parse(text=x^2))
[1] 4
Barry
Ingmar Visser wrote:
it's unclear what you want ...
but
get(x)^2
does not give an error
Neither does get(x^2) if you actually have an object called x^2:
x^2=4.01
get(x^2)
[1] 4.01
but that would be a perverse thing to do.
Barry
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
Oleg Sklyar wrote:
The problem occurs after updating from Dapper to Edgy. Dapper had font
paths: /usr/share/X11/fonts and Edgy, to make the whole font system
unified, moved X11 fonts to /usr/share/fonts/X11. Oleg
I think I changed the font path in the X config file *and* added a
symlink
Matthew Keller wrote:
I do wonder if anything can/should be done about this. I generally
search using the term CRAN but of course, that omits lots of stuff
relevant to R.
Change the name in the next major version to 'Rplus'?
Barry
__
Angie Hernandez wrote:
I came across your website and thought it would be a great resource
to have listed on my friends page. Would you be interested in
exchanging links with my new site?
Well, I don't see why we cant make CRAN more like MySpace?
Barry
[joke]
Jerry Pressnell wrote:
I have been running this script regularly for some time. This morning the
following error message appeared.
EWL-get.hist.quote(EWL,start=(today - Sys.Date())-350,quote=Cl)
Error in if (dat[n] != start) cat(format(dat[n], time series starts
%Y-%m-%d\n)) :
missing
Robin Hankin wrote:
The error is given because after B[[1]] - a, the variable B is
just a scalar and
not a matrix (why is this?)
Because [[i]] indexes more general vectors, and if you do B[[1]] when
B is NULL, R doesnt know if you want B to be a list or a simple vector.
If you
Robin Hankin wrote:
How do I draw non-square matrices with image() and get the axes right?
Try 2:
image(1:20,1:5,a,asp=1,axes=F,xlab=label here)
axis(side=1,pos=0)
# No good because the x axis label is floating far from the x axis.
Its only no good if your plot device isnt a similar
ken knoblauch wrote:
This should do the trick:
mind_reader - function() {
ll - letters[round(runif(6, 1, 26))]
I see my paraNormal distribution package hasn't found its way to CRAN yet:
http://tolstoy.newcastle.edu.au/R/help/05/04/1701.html
Barry
Farrel Buchinsky wrote:
Why will the following command not work
sapply(objects(),dim)
What does it say about the objects list? What does it say about the dim
command?
Likewise, the following also does not work
all-ls()
for (f in all) print(dim(f))
'objects()' returns character strings
Bill Shipley wrote:
Hello, and Happy New Year. My default working directory is getting very
cluttered. I know that I should be using a different working directory for
each project (I work in Windows), but do not know how to go about creating
different ones and moving back and forth between
Sarah Goslee wrote:
If that's still too complex, you could also save your function to a file
and load it as needed with source(). That will give the user the
same effect.
source(/path/to/my/stuff/myfiles.R)
Since you didn't tell us OS or anything else about your system,
it's hard to be
Jenny Barnes wrote:
Dear R-help,
Thank you for the responses off everyone- you'll be please to hear Duncan
that
using:
gpcc.array - array(gpcc.data2[,5], c(144, 72, 46))
was spot-on, worked like a dream. The data is in the correct places as I
checked
with the text file. It took
Is it safe to call C code from R that mallocs memory for a structure,
returning a pointer to that structure via some 'raw()' parameter. Then,
pass that pointer to another C routine, and finally free the malloced
memory by passing the raw() data to another C routine?
I've written some code that
Prof Brian Ripley wrote:
The short answer is that quite a bit of code, e.g pwilcox and RODBC,
does things like this. You don't need to pass the pointer back to R,
but if you do external pointers are designed for this job.
[reads a bit more of 'Writing R Extensions'...]
Right yes,
Guenther, Cameron wrote:
The code I tried was
text(Dstar+7,120,expression(paste({}D,^*))), but that doesn't work and I
get a syntax error.
I can't seem to find anything in the help files that explains it.
plot(1:10)
text(8,5,expression(D[obs]^*))
works for me...
Barry
Matt Anthony wrote:
Rcmd myprogram.R is clearly documented as unable to take parameters
passed to it ...
It can take parameters from the environment though...
H:\ set METHOD=loglik
H:\ c:\Program Files\R\R-2.2.1\bin\R
blah blah
Sys.getenv(METHOD)
METHOD
loglik
Barry
product-.C(prodgdot,myx=x,muy=y,myn=NROW(x),myoutput=as.double(0))
Error in .C(prodgdot, myx = x, muy = y, myn = NROW(x), myoutput =
as.double(0)) :
C symbol name prodgdot not in load table
Does anyone know what is the problem?
C++ name mangling?
Jenny Barnes wrote:
Having tried again your suggestion of load() worked (well - it finished,
which I
assume it meant it worked). However not I am confused as to how I can check
it
has worked.
I typed
data.out$data
which called up the data from the file - but I'm not sure if this
Paul Smith wrote:
x - expression(62/100)
as.numeric(as.character(x))
[1] NA
Warning message:
NAs introduced by coercion
Any idea about how to deal with the second case?
eval-uate the expression:
x - expression(62/100)
eval(x)
[1] 0.62
Barry
Sarah Goslee wrote:
Since this step works,
mental$Rx - factor(mental$Rx, levels=c(VS,IPS))
I think that some of the names are right, but perhaps that
one is spelled differently (Centre vs centre, maybe, since
R is case-sensitive?).
How do you know that step works? If the dataframe
Xiaofan Cao wrote:
Hi there,
I'm writing a program in R that has a few nested loops. I'd like to
monitor the progress when the program is running and be able to estimate
the remaining time.
A long time ago I started writing some code to give R something like
an 'iterator' object. You
Tord Snäll wrote:
Dear all,
Does anyone know of a function that calculates the area of the outer
polygon constructed from a data frame with co-ordinates? For example,
If by 'outer polygon' you mean 'convex hull', then look at help(chull).
Barry
Franco Mendolia wrote:
Hello!
Is there a possibility in R to save data in pdf-format?
I do not want to save a plot but some lines of simple text.
Howabout:
R - RSPython[1] - ReportLab[2] - PDF
[1] http://www.omegahat.org/RSPython/
[2] http://www.reportlab.org/
ReportLab is a very nice
Richard A. O'Keefe wrote:
Commenting code out and providing documentation comments are easily
done with a good editor, although R documentation comments really belong
in files where help() can find them.
R documentation comments belong in .Rd files at the moment, but how
joyous would it
Note that if you only have block comments in a language, its much harder
to do this:
http://www.xkcd.com/c156.html
Barry
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
Florian Menzel wrote:
Dear R cracks,
We prefer to be called 'R souls'.
I need to process data in R which consist of strings like
AAABAVVABNN
ABVVNNAA
What I would like to know is whether there are commands that deliver
-the length of a string
-one specified
Philippe Grosjean wrote:
It takes advantage of `!` being not defined for character arguments:
*gasp*
how much R code is destined to feature on www.thedailywtf.com in the
future?
whats the chances of block commenting being included in a future
version? and more generally, is there
Seth Falcon wrote:
My wtf feature request is to add a multiline string delimiter ala
Python like .
Anything that makes R more like Python syntax gets a +1 from me. How
about getting rid of curly brackets for blocks and using indenting in R?
Time to attack gram.y with a
Now I want to do an operation that can split it into two variables:
Column 1Column 2 Column 3
123abc 123 abc
12cd34 12cd34
1e23 1 e23
...
So basically, I want to split the original variabe
Yeh, Richard C wrote:
In R, is there an automatic variable that stores the results of the most
recent command or commands? (I am thinking of a behavior like
Mathematica's % result-history substitution syntax.)
Something like .Last.value:
x=sqrt(2)
.Last.value
[1] 1.414214
which
Jeffrey Horner wrote:
$ kill -USR1 pid
will save the global environment in the file .RData, but you'll need to
remember the current working directory of the process to find it.
Remember? With a computer, you never need to remember!
$ ls -l /proc/$pid/cwd
is a symlink to the current
Anupam Tyagi wrote:
There are 356,112 records, and 326 variables. It has a fixed record length of
1283 positions, therefore cut -b can not be used.
Okay, thats 'large' enough to be awkward...
It would be good to have a facility in R which defines the meta-data:
labelling
and structure of
Barry Rowlingson wrote:
If I had a spare day...
Or if I'd just read Duncan's message about negative widths in read.fwf.
Anyway, I've learnt about readLines() and seek() and reading zip files
now, so I can read _anything_
Barry
__
R-help
Michael Kubovy wrote:
Please consider saving your data in a way that will make it easier to
read into R. No program can read every dataset.
going back to the original post, there seems to be a couple of hanging
questions:
None of these seem to read non-coniguous variables from columns; or
Mariagiulia Matteucci wrote:
Hello, thank you very much for your previous answers about the C++ code.
I am interested in the application of the Gibbs Sampler in the IRT
models, so in the function MCMCirt1d and MCMCirtkd. I've found the C++
source codes, as you suggested, but I cannot find
ronggui wrote:
set.seed is used to set the random number seed.
When we use functions ,say runif, to generate random number ,we almost
get different set of random number.
As for what the i in set.seed(i) should be,I don't think it is a serious
matter.
The help for set.seed tells you all
Jonathan Baron wrote:
5. Copied the Script File R from directory R-2.3.0/bin/R to
/usr/local/bin/R.
6. Typed R
The instructions say that you should use
make install
unless you want to run R from the directory into which you
unpacked it.
Another idea is to have a symlink (here
Peter Lauren wrote:
I was wondering what would be the best way to put a
vertical line on a graph made with plot(). I can get
an horizontal line by plotting a vector where every
element has the same value but it is not as clear how
a vertical line should be done.
abline(v=42)
you can use
Robert Citek wrote:
Because of that, I would say R is more like a helicopter, a HUEY
perhaps.
I vote for unicycle. I've seen people race, skip, climb stairs, go up
mountains, dance and even play hockey on unicycles. But when I get on
one, all I can do is fall off. I know all these other
Jean-Pierre GERBAL wrote:
bonjour,
i have a serie : x-sample(c(0,1),50,T)
and i want to count the length of each repetition of 0 and of 1
(00111011100 give 2313145)...
who have an idea ?
rle(x)
merci :-)
pas de prob.
Barry
__
so, _if_ 'cd' would be recognized in future releases, it would'nt do any
harm, would it?
ls()
[1] some things here
cd(foo)
ls()
[1] some things here
Cue shout of: Hey, it didnt work!
ls() is not to /bin/ls what setwd() is to 'cd'.
Gets -1 from me. setwd() makes it clear[er]
Larsen, Thomas wrote:
I would like to write atom% 15N in the ylab of a plot - 15 should be
written as superscript. How do I put % into the expression? It does
not work if I type % directly after atom in the expression below.
string-quote it?
plot(1:10,ylab=expression(atom% ^15*N))
Barry
Romain Francois wrote:
What about
- place somewhere a div called 'Focus on a package' where we could have
a short presentation of a package, etc ... or for a CRAN task view (to
do that, php would be great, but we can do I don't know perl scripts to
generate static html pages)
- a
Gavin Simpson wrote:
Dear list,
My employer uses a Windows 2000 Terminal Server-based system for its
college-wide managed computer service - computers connect directly to
the WTS servers for their sessions, using a Citrix ICA client. When I
asked them to install R (Windows) on an older
roger bos wrote:
While there is nothing about the r-project site that I would consider fancy,
it is pretty functional. I would be interested to hear more about what you
hope to accomplish by re-doing the web site. Fancy graphics may just slow
down the experience for those not on broadband.
Rolf Turner wrote:
People really ***should not*** be encouraged or abetted in
wrong-headedness. Excel is terrible. Pie charts are terrible.
Don't mess with them. Period.
Now I realise the opportunity I missed on April 1st, when I was going
to try and (anonymously) post the most
Rainer M Krug wrote:
I want to use lm() to get the slope and intercept for several daatasets
and store them in a database. So far so good - but how do I extract the
slope and the intercept from the result from lm()?
Read the help for lm - it talks about coefficients rather than slope
and
Søren Højsgaard wrote:
I want to numerically maximize a function with optim (maximization
over several arguments). optim() needs a function which returns a
scalar only. However, it could be nice to be able to take other
things out from the function as well. I'tried to create an attribute
to
Duncan Murdoch wrote:
Are you talking about surface3d in the rgl package? It doesn't use the
standard R graphics system, so dev.copy() won't help. You need
rgl.snapshot, which can create png files. You'll need some other
utility to convert those to pdf.
Or screen-grab them somehow.
jia ding wrote:
Then, I use command:
score- read.csv('file.csv', header = FALSE,sep = ,)
hist(score, main = score)
it gives error msg:
Error in hist.default(score, main = score) :
'x' must be numeric
Can any of you know about it explain me why?
Have a look at 'score' in R
Tom Backer Johnsen wrote:
I have just started looking at R, and are getting more and more irritated
at myself for not having done that before.
However, one of the things I have not found in the documentation is some
way of preparing output from R for convenient formatting into something
Sara Mouro wrote:
Dear All,
I have to enter many lines of data in the same object.
I usually use copy-paste to transfer data from an Word file to R.
What is the best way to do that?
Use 'Save As' to save your Word file - or rather just the data section
- as a plain text or
Wladimir Eremeev wrote:
Hello all,
Research Systems (www.rsinc.com) have developed and distributes the
language IDL,
and the GIS ENVI, written in IDL.
I find it hard to believe they wrote it all in IDL! I'm guessing its
probably scriptable in IDL, but underneath its written in
[EMAIL PROTECTED] wrote:
I have a binary file with data sequence in the order
What do you mean by 'binary file'?
[age,weight][age,weight]
How are age and weight encoded in this 'binary file'?
I know the length of the data and I want to load it into a
data.frame. of course a way to
Michael wrote:
plot(testError, col=red)
lines(testVar, col=black)
Only one plot (the red one) appear on the Window, the black line did not
appear...what's wrong?
Hang on a second, just let me hack into your machine so I can find out
what 'testError' and 'testVar' are
I'm guessing
Briggs, Meredith M wrote:
exportData(MU.Cost,paste(C:/RAUDSL/S,as.character(MU.Cost$Run.Id[1]),
.,as.character(MU.Cost$MU.Id[1]),.MU.PRICE.OUTPUT.txt,sep=),append
= FALSE,type=ASCII,quote=FALSE)
Looks like perfectly good R to me.
Except there's no exportData function. I assume this is an
Gabor Csardi wrote:
Becaues is.integer shows the internal representation, which is not an
integer but a double (real number). Some functions create integer vectors,
Some functions that you might think create integer vectors and even
seem to say they create integer vectors dont create integer
Duncan Murdoch wrote:
Here numeric vector is being used in the R-specific technical sense as
a vector of double precision values, so the documentor was trying hard
to be precise. The problem is that English also admits the
interpretation in a non-technical sense as a vector of numbers. I
Laetitia Marisa wrote:
Hello,
Is there a simple and fast function that returns a vector of the number
of replications for each object of a vector ?
For example :
I have a vector of IDs :
ids - c( ID1, ID2, ID2, ID3, ID3,ID3, ID5)
I want the function returns the following vector where
[more an R-help than R-dev thing]
Ben Bolker wrote:
Labbe, Vincent (AEREX Vincent.Labbe.AEREX at drdc-rddc.gc.ca writes:
I am new to R and I would like to display an image on a plane in a 3D plot,
i.e. I would like to be able to specify a theta and a phi parameters like in
the function persp to
Andrej Kastrin wrote:
vector A: 0 1 2 3 0 4 5
vector B: 0 2 3 4 0 5 6
What's the right way to do this. I still have some problems with for and
if statements...
?ifelse perhaps...
A
[1] 0 1 2 3 0 4 5
B=ifelse(A0,A+1,0)
B
[1] 0 2 3 4 0 5 6
does a sort of element-wise
Par Leijonhufvud wrote:
I teach biology, and would like to show the students how to use R for
some statistical assignments. One of those is to make a kite diagram
(for example as seen in
http://www.medinavalleycentre.org.uk/images/Bembri1.jpg). Is there any
way to create one using R? I did a
Christian Neumann wrote:
Hi folks,
I have a small, maybe newbie, question concerning date operations.
The follwing snippet
date1 = 2005-11-20;
date2 = 2005-11-17;
difftime(date1, date2)
results in Time difference of 3 days. How can I extract just the
numerical value 3?
As a
Jonathan Baron wrote:
And I was thinking of setting up a Wiki with one page per
function. (Given that there are now hundreds or thousands of
functions, setting this up would have to be automated.)
One page per R manual page file would probably suffice. You could do
something along the
[crossed over to r-help since its not a bug and not a devel thing any more]
Thomas Lumley wrote:
So is -2^2. The precedence of ^ is higher than that of unary minus. It
may be surprising, but it *is* documented and has been in S for a long
time.
And just about every other programming
Rhett Eckstein wrote:
Dear R users:
C1
timeX1
1 0.5 6.296625
2 1.0 10.283977
3 1.5 12.718610
4 2.0 14.112740
5 3.0 15.053917
6 4.0 14.739725
7 6.0 12.912230
8 8.0 10.893264
9 0.5 6.289166
10 1.0 10.251247
11 1.5 12.651346
12 2.0 14.006958
13
tom wright wrote:
Browse[1] mean(amps[1],amps[2],amps[3],amps[7],amps[8])
[1] 1
For starters, this just returns mean(amps[1]). 'mean' computes the
mean of the first argument, the others are slurped up by '...' and in
this case thrown into the bin. You want to do
While mucking about with semicolons and line endings I wrote this little
piece of mildly obfuscated R code:
f1=function(n){
x = 1
---
n
return(x)
}
[best viewed with a proportionally-spaced font]
f1(1) does indeed return 1/1.
Baz
Peter Dalgaard wrote:
It doesn't calculate it though... ;-)
My previous example is a bit ugly - this one looks nicer:
f1=function(n){
-1
x = ---
n
return(x)
}
And it returns f(1) as -1/1 and f(-1) as -1/-1 as well.
__
José Matos wrote:
In this case I prefer to use rpy (look for it in sourceforge), it
allow to call R directly from python,
with the main advantage that the resulting objects are really python
objects, and vice-versa
calling R with python objects will convert them to R objects.
It works
Evgeniy Kachalin wrote:
What is ability in R to graphically (per mouse) define some area and to
select all the cases felt in it?
'identify' is OK for 5-10 cases, but what if cases=1000?
You can use 'locator' to let the user click a number of points to
define a polygon, and then use one
Serguei Kaniovski wrote:
Hi, I have a more complex example, but the problem boils down to this
FOR-loop not filling in the res-matrix
for(i in run_rows)
{
for(j in run_cols)
{
res[i,j]=i+j
have a look at what i and j are in such a loop:
for(i in run_rows){
+
Christian Hennig wrote:
run_rows-seq(0,1,0.05)
run_cols-seq(0.3,0.6,0.05)
res-matrix(NA,length(run_rows),length(run_cols))
for(i in 1:length(run_rows))
{
for(j in 1:length(run_cols))
{
res[i,j]=run_rows[i]+run_cols[j]
}
}
Or the one-liner:
res = outer(run_rows,run_cols,+)
Amir Safari wrote:
I simply want to calculate the 2th power of a vector without changing the
sign of values. How it is possible in R ?
I'm not quite sure what you mean, but maybe:
x
[1] -4 -3 -2 -1 0 1 2 3 4
x^2
[1] 16 9 4 1 0 1 4 9 16
- that obviously makes
[EMAIL PROTECTED] wrote:
R a - old
R test - function () { a - new }
R test()
R a # shoud be new
This doesn't work. I would like to modify the variable a in a
procedure. How can I do that.
You may like to modify the variable, but who else wants you to?
Functions should have zero side
Tuszynski, Jaroslaw W. wrote:
Also does anybody know how hard would it be to tap into C code needed for
'read.jpeg', 'png' and 'jpeg' functions to write 'read.png' , 'write.png',
and 'write.jpeg' functions?
Much, much harder than using ImageMagick to convert to one of the
formats that R
Robin Hankin wrote:
check.for.inclusion - function(subsets){
out - rep(FALSE,length(subsets)-1)
for(i in 1:(length(subsets)-1)){
out[i] - all(subsets[[i+1]] %in% subsets[[i]])
}
return(all(out))
}
how to do it elegantly and/or quickly?
My first thought was to
Whoops
The code I just posted only tested if all the subsequent elements were
subsets of the first, it didn't check all the sequential subsets!
Too cold to think straight here today...
Baz
__
R-help@stat.math.ethz.ch mailing list
Liaw, Andy wrote:
However code readability can not be over-emphasized. I must admit to have
written R code in such a supposedly `clever' way that I can't figure out
what I was trying to do (or how I did it) a week later...
The solution to that is to make sure this sort of code is adequately
1 - 100 of 276 matches
Mail list logo