[R] R-2.6.0 and RWinEdt

2007-10-06 Thread Patrick Giraudoux
Dear Listers,

I have just installed R-2.6.0 and the RWinEdt package 1.7-6 under
Windows XP.

The R-WinEdt menu well appears at launching (the command
library(RWinEdt) is in .Rprofile), but  WinEdt is NOT started
automatically (this was not the case in the earlier versions of R). When
WinEdt is started by hand (eg double-click on a RWinEdt alias after R
launching), syntax highlighting and connexion to R works well.

Any idea about how to fix this and get WinEdt automatically started when
library(RWinEdt) is called?

Patrick

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] Tart charts

2007-10-06 Thread Jim Lemon
roger koenker wrote:
 It being friday, I would like to call your attention to an innovative
 data analysis by Leslie Lamport available from:
 
   http://research.microsoft.com/users/lamport/pubs/hair.pdf
 
 I particularly liked the graphics.
 
 
Stone the flamin' crows, why didn't I think of that?

Jim

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] installing Rmpi

2007-10-06 Thread Prof Brian Ripley
On Fri, 5 Oct 2007, Erin Hodgess wrote:

 Hi R people:

 I installed R-2.6.0 on a Red Hat Linux system and am now trying
 to install the Rmpi package.

 The installation cannot seem to find the mpi.h file, even though it exists.

 Is there a variable that I should be exporting into the process, please?

It's tricky, and we may need to know a bit more about your OS.  I presume 
you have the latest Rmpi 0.5-4: if not get it from the CRAN master (it 
may still be propagating).

On the RH systems I have seen the mpi.h file is in /usr/include/lam. So 
you need to ensure you have that installed, and it is in the lam-devel RPM 
(which has other dependencies, including lam and lam-libs).  If that is 
installed and this is still failing you need to look at the config.log to 
see why -- that's not R-help territory and I think you need to find some 
local expertise to help you: if that is not possible, use R-devel.

The problems I usually find are with the next step, finding the libraries. 
I've seen systems where /usr/lib64/lam was not in the ld.so cache, and 
others where you needed to link against -lutil as well as -lmpi -llam. 
Only someone with essentially the same OS on the same cputype will be able 
to help you find things like this.  (For some reaons Rmpi tests for static 
libraries on 32-bit systems and dynamic ones on 64-bit systems.)

Incidentally, the lam RPMs have things in quite different places from a 
vanilla source install of lam, so you do need to tell us exactly when your 
MPI libraries came from.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] Mac GUI and .Renviron

2007-10-06 Thread Rob J Goedman
Jacob,

As Steven mentioned,  [EMAIL PROTECTED] is a list specific  
for OSX only questions.

I think you can achieve something similar by going into the  
preference settings of R.app, select the Startup section and select  
'Source input file', de-select 'Always apply' and make the R history  
file something like 'Rhistory', no fixed path.

You can up the number of history entries, although with R.app's  
multiline history and with 'Cleanup history entries' and ' Remove  
duplicate entries in history' selected, 250 in a GUI is in many cases  
a lot.

In Finder, double-click an .R file you want to work on (or drag its  
icon onto the R icon in the Dock), R will open in the dir of the file  
and read the correct history file. It will open the double-clicked or  
dragged file in either the internal or external editor, whichever one  
is selected.

I do not think you can, without some further steps, run multiple  
R.apps at the same time. Let me know if that is critical for you.

Hope this helps,
regards,
Rob



On Oct 5, 2007, at 2:17 PM, jwegelin wrote:


 The .Renviron and .First functions do not seem to work the same way  
 on a
 Mac OS 10.4 as on a Windows XP machine.

  From working in Windows I am used to creating a new directory for  
 each
 data analysis project. In the new directory I place

 First, an .Renviron file consisting of the following text:

 R_HISTFILE=history.txt
 R_HISTSIZE=100

 Second, an .RData file containing a .First function designed for the
 particular project.

 Then each project has, in its own directory, its own history.txt  
 file of
 practically unlimited size recording each command I type; I can open a
 separate instance of R for each project by doubleclicking .RData in  
 the
 appropriate directory; and the .First function for a particular  
 project
 is run automatically each time I doubleclick .RData in the  
 directory for
 that project.

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] Rounding of lme coefficients: Mac vs Windows

2007-10-06 Thread David Afshartous
All,

I have an lme model estimated in R 2.5.1 on my Mac; when I estimate the same
model on Windows, the parameter coefficients are rounded to integers.  Below
is a similar example for the Orthodont data.  Is there some option I need to
set in the Windows version to prevent rounding?  Didn't see this in the
archives.

Thanks,
David Afshartous


 sessionInfo()
R version 2.5.1 (2007-06-27)
i386-apple-darwin8.9.1

locale:
en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics  grDevices utils datasets  methods
base 

other attached packages:
nlme 
3.1-84 
 fm1 - lme(distance ~ age, data = Orthodont) # random is ~ age
 
 fm1
Linear mixed-effects model fit by REML
  Data: Orthodont 
  Log-restricted-likelihood: -221.3183
  Fixed: distance ~ age
(Intercept) age
 16.761   0.6601852

Random effects:
 Formula: ~age | Subject
 Structure: General positive-definite
StdDevCorr
(Intercept) 2.3270338 (Intr)
age 0.2264276 -0.609
Residual1.3100399

Number of Observations: 108
Number of Groups: 27


 sessionInfo()
R version 2.6.0 (2007-10-03)
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] nlme_3.1-85   foreign_0.8-23arm_1.0-33R2WinBUGS_2.1-6
[5] coda_0.12-1   lme4_0.99875-8Matrix_0.999375-2 lattice_0.16-5
[9] MASS_7.2-36   

loaded via a namespace (and not attached):
[1] grid_2.6.0  tools_2.6.0
 fm1 - lme(distance ~ age, data = Orthodont) # random is ~ age
 fm1
Linear mixed-effects model fit by REML
  Data: Orthodont 
  Log-restricted-likelihood: -221
  Fixed: distance ~ age
(Intercept) age
  16.760.66

Random effects:
 Formula: ~age | Subject
 Structure: General positive-definite
StdDev Corr
(Intercept) 2.33   (Intr)
age 0.23   -0.61
Residual1.31  

Number of Observations: 108
Number of Groups: 27


__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] Linux editor for R+LaTeX, but not Emacs

2007-10-06 Thread Dirk Eddelbuettel

On 6 October 2007 at 11:01, Scionforbai wrote:
|  What features are you missing in emacs that you wish were there?  Are
|  these ESS features or LaTeX related features?
| 
| is it only me or has anyone else the problem that running an R process
| within emacs is way much slower than in a regular terminal/console?
| (linux here)

It's just you, and if you think some more about it, you'll see why we are all
grinning.  [ Hint: it can't be slower, outside of ridiculous corner sitations
where there isn't enough ram for Emacs and R at the same time. Or foobared
setups.  In all normal situations, it'll be the same. ]

But the proof of the pudding is in the eating. So here from the console:

 system.time(replicate(100, svd(matrix(rnorm(100*100), ncol=100
   user  system elapsed
  2.792   0.048   2.842

and cutpasted from ESS

 system.time(replicate(100, svd(matrix(rnorm(100*100), ncol=100
   user  system elapsed 
  2.736   0.048   2.787 
 

(Heaven's, ESS is even faster :)

Output to the console, ie the Emacs buffer, may appear slower, or be
slower. I don't care. I try not to print that many line. But then you get
goodies like C-c C-o to 'eat up' output you didn't mean to flood the console
with.  

Seriously, outside of spreading R on sliced bread, there is no better way to
use it than with ESS.

Dirk

-- 
Three out of two people have difficulties with fractions.

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] Tart charts

2007-10-06 Thread Michael Friendly
Try this alternative:

# from http://research.microsoft.com/users/lamport/pubs/hair.pdf
hairsex - matrix(
c(46, 45, 13, 12,
   1, 101, 0, 20), 2, 4, byrow=TRUE)
dimnames(hairsex) - list(Gender=c(Female, Male),
Hair color=c(Blond, Brown, Red, Other) )

library(vcd)
mosaic(hairsex, shade=TRUE)

There are uses for pie charts, but this isn't one of the better ones.

-Michael

roger koenker wrote:
 It being friday, I would like to call your attention to an innovative
 data analysis by Leslie Lamport available from:
 
   http://research.microsoft.com/users/lamport/pubs/hair.pdf
 
 I particularly liked the graphics.
 
 
 url:www.econ.uiuc.edu/~rogerRoger Koenker
 email[EMAIL PROTECTED]Department of Economics
 vox: 217-333-4558University of Illinois
 fax:   217-244-6678Champaign, IL 61820
 
 __
 R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.
 

-- 
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] Bug or not

2007-10-06 Thread Darius Kasiulevičius
I have this sample from help. I try use command erase.screen() but in 
split mode sreen dont erase. Why?

split.screen(c(2,1)) # split display into two screens
split.screen(c(1,2),2) # split bottom half in two
plot(1:10) # screen 3 is active, draw plot
erase.screen() # forgot label, erase and redraw IN THIS PLACE 
SCREEN DONT ERASE
plot(1:10, ylab= ylab 3)   IN THIS 
PLACE COMMAND PLOT ON TOP
screen(1) # prepare screen 1 for output

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] help_R2.5 updating

2007-10-06 Thread Thanjavur Bragadeesh

Hi,
 
I run windows vista ultimate in my laptop and run R 2.5
 
I am trying to update the packages but it comes up with an error message
 
Warning in install.packages(update[instlib == l, Package], l, contriburl = 
contriburl,  :  'lib' is not writable
Error in install.packages(update[instlib == l, Package], l, contriburl = 
contriburl,  : unable to install packages
 
I am the adminsitrator on this computer and logged in as administrator.
 
can anyone advise. I treid to switch off most security - windows firewall is 
off and so is macfee.
 
 
many thanks for your advise
 
bragadeesh
 
 
 
_
Climb to the top of the charts!  Play Star Shuffle:  the word scramble 
challenge with star power.

[[alternative HTML version deleted]]

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] Simulate data based on correlation coefficient

2007-10-06 Thread Gustavo
Hello all,



I have a vector with 1000 values and I would like to generate other 
correlated vector, but with different correlation coefficient (for example, 
r = 0.7).

Any ideas how can I do this?



Regards,

Gustavo.






___ 

Experimente já e veja as novidades.

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] Question about Distinguishable Permutation

2007-10-06 Thread house-ball
Hi,
   
  How can I list all possilities of Distinguishable Permutation by R? For 
example, N=6, n1=n2=n3=2, the total possible answers are 6!/(2!2!2!)=90.
   
  Please help me.
   
   
  Thank you So much.

   
¡A
[EMAIL PROTECTED]://tw.mobile.yahoo.com/texts/mail.php
[[alternative HTML version deleted]]

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] list matching

2007-10-06 Thread Adrian Dusa

Dear list,

Given a list of elements like:
aa - list(one=c(o, n, e),
   tea=c(t, e, a),
   thre=c(t, h, r, e))

Is there a function that returns the intersection between all?
Both match() and intersect() only deal with two arguments, but sometimes I 
have more.

Here, it should return e (or NA if none of the letters are common).

I have a solution to apply %in% multiple times (here two times, first between 
the first two and then between the result and the third) but... perhaps there 
is a better and quicker way.

Thanks in advance,
Adrian

--
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] problem installing fields package 3.5 on R 1.8.1 on linux

2007-10-06 Thread jpgirard
I am returning to using R after a little time away.

Saw some great new functions in the fields package and decided to upgrade.

Everything seems to go fine until I tried to actually load the package, when
I get an error:

library(fields)
Error in parse(file, n, text, prompt) : syntax error on line 227

And (of course) I am unable to access any of the functions in the fields
package.

Below is the full install session.

thanks for any help!
Jim

--

[EMAIL PROTECTED] R

R : Copyright 2003, The R Foundation for Statistical Computing
Version 1.8.1  (2003-11-21), ISBN 3-900051-00-3

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for a HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

 update.packages(ask=TRUE)
trying URL `http://cran.r-project.org/src/contrib/PACKAGES'
Content type `text/plain' length 144627 bytes
opened URL
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. .
downloaded 141Kb

fields :
 Version 1.4.2 in /usr/lib/R/library
 Version 3.5 on CRAN
Update (y/N)?  y
xgobi :
 Version 1.2-12 in /usr/lib/R/library
 Version 1.2-13 on CRAN
Update (y/N)?  N
trying URL `http://cran.r-project.org/src/contrib/fields_3.5.tar.gz'
Content type `application/x-gzip' length 447560 bytes
opened URL
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. ..
.. .. .. ...
downloaded 437Kb

* Installing *source* package 'fields' ...
** libs
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c css.f -o css.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c csstr.f -o
csstr.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c cvrf.f -o
cvrf.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c dchold.f -o
dchold.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c dcopy.f -o
dcopy.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c ddot.f -o
ddot.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c dlv.f -o dlv.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c dmaket.f -o
dmaket.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c drdfun.f -o
drdfun.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c dsetup.f -o
dsetup.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c expbs.f -o
expbs.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c expfn.f -o
expfn.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c gaspbs.f -o
gaspbs.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c gaspfn.f -o
gaspfn.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c gcvcss.f -o
gcvcss.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c gcvfc.f -o
gcvfc.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c hsort.f -o
hsort.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c ifind.f -o
ifind.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c inpoly.f -o
inpoly.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c lscv.f -o
lscv.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c m2deb.f -o
m2deb.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c mkpoly.f -o
mkpoly.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c mltdrb.f -o
mltdrb.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c mltdtd.f -o
mltdtd.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c msort.f -o
msort.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c multeb.f -o
multeb.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c multgb.f -o
multgb.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c multrb.f -o
multrb.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c radbas.f -o
radbas.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c radfun.f -o
radfun.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c rcss.f -o
rcss.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c rcssr.f -o
rcssr.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 -mcpu=i686 -c rcsswt.f -o
rcsswt.o
g77 -mieee-fp  -fPIC  -O2 -g -pipe -march=i386 

Re: [R] list matching

2007-10-06 Thread Marc Schwartz
On Sat, 2007-10-06 at 19:49 +, Adrian Dusa wrote:
 Dear list,
 
 Given a list of elements like:
 aa - list(one=c(o, n, e),
tea=c(t, e, a),
thre=c(t, h, r, e))
 
 Is there a function that returns the intersection between all?
 Both match() and intersect() only deal with two arguments, but sometimes I 
 have more.
 
 Here, it should return e (or NA if none of the letters are common).
 
 I have a solution to apply %in% multiple times (here two times, first between 
 the first two and then between the result and the third) but... perhaps there 
 is a better and quicker way.
 
 Thanks in advance,
 Adrian


intersectList - function(x) 
{
  res - table(unlist(sapply(x, unique)))
  names(res[res == length(x)])
}


In the first line, I use unique() to ensure that if the same letter
appears more than once in the same list element, it is not included in
the result set in error, such as in 'L' here:


L - list(a = c(a, b, b), b = c(d, b, a), c = c(d, a))

 L
$a
[1] a b b

$b
[1] d b a

$c
[1] d a


So:

 intersectList(aa)
[1] e

 intersectList(L)
[1] a


HTH,

Marc Schwartz

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] problem installing fields package 3.5 on R 1.8.1 on linux

2007-10-06 Thread Marc Schwartz
On Sat, 2007-10-06 at 14:05 -0600, jpgirard wrote:
 I am returning to using R after a little time away.
 
 Saw some great new functions in the fields package and decided to upgrade.
 
 Everything seems to go fine until I tried to actually load the package, when
 I get an error:
 
 library(fields)
 Error in parse(file, n, text, prompt) : syntax error on line 227
 
 And (of course) I am unable to access any of the functions in the fields
 package.
 
 Below is the full install session.
 
 thanks for any help!
 Jim
 
 --
 
 [EMAIL PROTECTED] R
 
 R : Copyright 2003, The R Foundation for Statistical Computing
 Version 1.8.1  (2003-11-21), ISBN 3-900051-00-3

You are almost four years out of date here.

R version 2.6.0 was released this past week. I would strongly urge you
to remove your old R installation completely and install R from scratch,
along with new versions of all the packages you require.

Once you have done that, re-install the fields package. There is almost
certainly a conflict between the latest version of fields and your old
version of R.

If there is a still a problem, post back and/or contact the package
maintainer.

HTH,

Marc Schwartz

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] Linux editor for R+LaTeX, but not Emacs

2007-10-06 Thread deepayan . sarkar
On 10/6/07, Dirk Eddelbuettel [EMAIL PROTECTED] wrote:

 On 6 October 2007 at 11:01, Scionforbai wrote:
 |  What features are you missing in emacs that you wish were there?  Are
 |  these ESS features or LaTeX related features?
 |
 | is it only me or has anyone else the problem that running an R process
 | within emacs is way much slower than in a regular terminal/console?
 | (linux here)

 It's just you, and if you think some more about it, you'll see why we are
 all
 grinning.  [ Hint: it can't be slower, outside of ridiculous corner
 sitations
 where there isn't enough ram for Emacs and R at the same time. Or foobared
 setups.  In all normal situations, it'll be the same. ]

Actually, copying multi-line R code (e.g. C-c C-r) is way slower with
ESS if you use Emacs22 (and its derivatives such as AquaMacs). Things
are perfect with Emacs21 though (and I'm sticking with it). Maybe that
explains the discrepancy.

-Deepayan

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] list matching

2007-10-06 Thread Adrian Dusa
On Saturday 06 October 2007, Marc Schwartz wrote:
 [...]

 intersectList - function(x)
 {
   res - table(unlist(sapply(x, unique)))
   names(res[res == length(x)])
 }


 In the first line, I use unique() to ensure that if the same letter
 appears more than once in the same list element, it is not included in
 the result set in error, such as in 'L' here:


 L - list(a = c(a, b, b), b = c(d, b, a), c = c(d, a))

  L

 $a
 [1] a b b

 $b
 [1] d b a

 $c
 [1] d a

 So:
  intersectList(aa)

 [1] e

  intersectList(L)

 [1] a


Neat :o)

Of course, this was the right way to follow... in my particular case the 
elements are always unique but generally this is the best approach indeed.

Thanks Marc,
Adrian


-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] Linux editor for R+LaTeX, but not Emacs

2007-10-06 Thread Marc Schwartz
On Sat, 2007-10-06 at 13:42 -0500, Dirk Eddelbuettel wrote:
 On 6 October 2007 at 11:01, Scionforbai wrote:
 |  What features are you missing in emacs that you wish were there?  Are
 |  these ESS features or LaTeX related features?
 | 
 | is it only me or has anyone else the problem that running an R process
 | within emacs is way much slower than in a regular terminal/console?
 | (linux here)
 
 It's just you, and if you think some more about it, you'll see why we are all
 grinning.  [ Hint: it can't be slower, outside of ridiculous corner sitations
 where there isn't enough ram for Emacs and R at the same time. Or foobared
 setups.  In all normal situations, it'll be the same. ]
 
 But the proof of the pudding is in the eating. So here from the console:
 
  system.time(replicate(100, svd(matrix(rnorm(100*100), ncol=100
user  system elapsed
   2.792   0.048   2.842
 
 and cutpasted from ESS
 
  system.time(replicate(100, svd(matrix(rnorm(100*100), ncol=100
user  system elapsed 
   2.736   0.048   2.787 
  
 
 (Heaven's, ESS is even faster :)
 
 Output to the console, ie the Emacs buffer, may appear slower, or be
 slower. I don't care. I try not to print that many line. But then you get
 goodies like C-c C-o to 'eat up' output you didn't mean to flood the console
 with.  
 
 Seriously, outside of spreading R on sliced bread, there is no better way to
 use it than with ESS.

I nominate that last line for a fortune candidate...  :-)

Regards,

Marc

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] plot the chi-square distribution for n=1 through 10, on one plot

2007-10-06 Thread fb
Dear help list.

I would like to plot the chi-square distribution for n=1 through 10, on
one plot.

How do I go about doing that?

I know how to plot one chi-square (using curve() for example), but
plotting 10 on one plot, that is too difficult for me.

I greatly appreciate your help.

-- 
  fb
  [EMAIL PROTECTED]

--

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] plot the chi-square distribution for n=1 through 10, on one plot

2007-10-06 Thread Peter Dalgaard
fb wrote:
 Dear help list.

 I would like to plot the chi-square distribution for n=1 through 10, on
 one plot.

 How do I go about doing that?

 I know how to plot one chi-square (using curve() for example), but
 plotting 10 on one plot, that is too difficult for me.

 I greatly appreciate your help.
Here is one way:

curve(dchisq(x,1), from=0, to=15)
for(i in 2:9) curve(dchisq(x,i), add=T, from=0, to=15)



-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] Tricky vectorization problem

2007-10-06 Thread Mike Lawrence
Hi all,

I'm using the code below within a loop that I run thousands of times  
and even with the super-computing resources at my disposal this is  
just too slow. The snippet below takes about 10s on my machines,  
which is an order of magnitude or two slower than would be  
preferable; in the end I'd like to set the number of monte carlo  
experiments to 1e4 or even 1e5 to ensure stable results. I've tried  
my hand at vectorizing it myself but I'm finding it tricky. Any help  
would be greatly appreciated!

This code attempts to find the distribution of observed correlation  
values between A  B when each are measured imperfectly:

start = proc.time()[1] #start a timer

rho = .5 #set the true correllation

Ns = 100 #set the number of Subjects

a.No = 1:100 #for each subject, set a number of observations in A  
(1:100 chosen arbitrarily for demonstration)
b.No = 1:100 #for each subject, set a number of observations in B

v.a = 1 #set the between Ss variance in condition A
v.b = 2 #set the between Ss variance in condition B

s.a.w = 1:100 #for each subject, set a standard deviation in A (1:100  
chosen arbitrarily for demonstration)
s.b.w = 1:100 #for each subject, set a standard deviation in B

mce = 1e3 #set the number of monte carlo experiments

sim.r = vector(length=mce) #set up a collector for the simulated  
correlations

Sigma=matrix(c(v.a,sqrt(v.a*v.b)*rho,sqrt(v.a*v.b)*rho,v.b),2,2)  
#define a covariance matrix for use in generating the correlated data

a = vector(length=Ns) #set up a collector for subject means in A
b = vector(length=Ns) #set up a collector for subject means in B

for(i in 1:mce){ #start a monte carlo experiment

sub.means=mvrnorm(Ns,rep(0,2),Sigma) #generate correlated ideal  
means for for each subject in each condition

for(s in 1:Ns){ #for each subject

a[s] = mean(rnorm(a.No[s],sub.means[s,1],s.a.w[s])) #generate 
some  
data for A and grab the mean
b[s] = mean(rnorm(b.No[s],sub.means[s,2],s.b.w[s])) #generate 
some  
data for B and grab the mean

}

sim.r[i] = cor(a,b) #store the observed correlation between A and B

}

print(proc.time()[1]-start) #show the total time this took



--
Mike Lawrence
Graduate Student, Department of Psychology, Dalhousie University

Website: http://memetic.ca

Public calendar: http://icalx.com/public/informavore/Public

The road to wisdom? Well, it's plain and simple to express:
Err and err and err again, but less and less and less.
- Piet Hein

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] list matching

2007-10-06 Thread Gabor Grothendieck
zoo's merge can do a multiway intersection.  We turn each component
of aa into the times of a dataless zoo object (assuming the elements of
each component are unique) and merge them together using all = FALSE
which will only leave those points at times in all components.  Extracting
the time and stripping off the names gives the result.

library(zoo)
as.vector(time(do.call(merge, c(lapply(aa, function(x) zoo(,x)), all = FALSE


On 10/6/07, Adrian Dusa [EMAIL PROTECTED] wrote:

 Dear list,

 Given a list of elements like:
 aa - list(one=c(o, n, e),
   tea=c(t, e, a),
   thre=c(t, h, r, e))

 Is there a function that returns the intersection between all?
 Both match() and intersect() only deal with two arguments, but sometimes I
 have more.

 Here, it should return e (or NA if none of the letters are common).

 I have a solution to apply %in% multiple times (here two times, first between
 the first two and then between the result and the third) but... perhaps there
 is a better and quicker way.

 Thanks in advance,
 Adrian

 --
 Adrian Dusa
 Romanian Social Data Archive
 1, Schitu Magureanu Bd
 050025 Bucharest sector 5
 Romania
 Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101

 __
 R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] a function to compute the cumulative distribution function (cdf) of the gamma

2007-10-06 Thread elodie gillain
Dear Forum,

I would need to write a function to calculate the cumulative distribution
function (cdf) of the gamma random variable. I am allowed to use the
following precoded functions: rgamma, pgamma, and dgamma. I am a little
overwhelmed by this project,  I am wondering how I should start.  Should I
sum dgamma (or pgamma) from 0 to x, in order to obtain the cdf at x?

Thanks in advance for your input.

[[alternative HTML version deleted]]

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] constructing a self-starting non-linear model

2007-10-06 Thread Irene Mantzouni
Dear all,
 
I am trying to define a selfStart function for a non-linear model, which is a 
log-transformed SSmicmen model with multiplicative errors and so it is required 
to make them additive:
 
log(y)=log(a)+log(x)-log(1+x/b)
 
 
Any ideas about how to use the peeling method to derive the initial 
argument and get the initial values?
 
Thank you for being always there!:)
 
Irene

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] Tricky vectorization problem

2007-10-06 Thread Mike Lawrence
Seems there were some line break issues when pasting the code, trying  
again with a different commenting style:

#start a timer
start = proc.time()[1]

#set the true correllation
rho = .5

#set the number of Subjects
Ns = 100

#for each subject, set a number of observations in A
a.No = 1:100
#for each subject, set a number of observations in B
b.No = 1:100

#set the between Ss variance in condition A
v.a = 1
#set the between Ss variance in condition B
v.b = 2

#for each subject, set a standard deviation in A
s.a.w = 1:100
#for each subject, set a standard deviation in B
s.b.w = 1:100

#set the number of monte carlo experiments
mce = 1e3

#set up a collector for the simulated correlations
sim.r = vector(length=mce)

#define a covariance matrix for use in generating the correlated data
Sigma=matrix(c(v.a,sqrt(v.a*v.b)*rho,sqrt(v.a*v.b)*rho,v.b),2,2)

#set up a collector for subject means in A
a = vector(length=Ns)
#set up a collector for subject means in B
b = vector(length=Ns)

#start a monte carlo experiment
for(i in 1:mce){

#generate correlated ideal means for for each subject in each condition
sub.means=mvrnorm(Ns,rep(0,2),Sigma)

#for each subject
for(s in 1:Ns){

#generate some data for A and grab the mean
a[s] = mean(rnorm(a.No[s],sub.means[s,1],s.a.w[s]))
#generate some data for B and grab the mean
b[s] = mean(rnorm(b.No[s],sub.means[s,2],s.b.w[s]))

}

#store the observed correlation between A and B
sim.r[i] = cor(a,b)

}

#show the total time this took
print(proc.time()[1]-start)

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] help_R2.5 updating

2007-10-06 Thread Gabor Grothendieck
I found that installing R into %userprofile%\Documents\R and placing the
source packages I was developing there too solved my
permissions problems.  R automatically created a
  %userprofile%\Documents\R\win-library\2.6
folder for my library and put packages that I was installing from CRAN
in it.  In R I can now do this:
   setwd(~/R)
to get to that directory

On 10/6/07, Thanjavur Bragadeesh [EMAIL PROTECTED] wrote:

 Hi,

 I run windows vista ultimate in my laptop and run R 2.5

 I am trying to update the packages but it comes up with an error message

 Warning in install.packages(update[instlib == l, Package], l, contriburl 
 = contriburl,  :  'lib' is not writable
 Error in install.packages(update[instlib == l, Package], l, contriburl = 
 contriburl,  : unable to install packages

 I am the adminsitrator on this computer and logged in as administrator.

 can anyone advise. I treid to switch off most security - windows firewall is 
 off and so is macfee.


 many thanks for your advise

 bragadeesh



 _
 Climb to the top of the charts! Play Star Shuffle: the word scramble 
 challenge with star power.

[[alternative HTML version deleted]]


 __
 R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


[R] Re-ordering factors

2007-10-06 Thread maj
A small example before I begin my query:

 educ - read.table(efile, header=TRUE)
 educ
  Education Age_Group Count
1  IncompleteHS 25-34  5416
2  IncompleteHS 35-44  5030
3  IncompleteHS 45-54  5777
4  IncompleteHS 55-64  7606
5  IncompleteHS   64 13746
6   CompletedHS 25-34 16431
7   CompletedHS 35-44  1855
8   CompletedHS 45-54  9435
9   CompletedHS 55-64  8795
10  CompletedHS   64  7558
11   Uni1-3 25-34  8555
12   Uni1-3 35-44  5576
13   Uni1-3 45-54  3124
14   Uni1-3 55-64  2524
15   Uni1-3   64  2503
16Uni4+ 25-34  9771
17Uni4+ 35-44  7596
18Uni4+ 45-54  3904
19Uni4+ 55-64  3109
20Uni4+   64  2483
 xtabs(Count ~ Education + Age_Group, data=educ)
  Age_Group
Education64 25-34 35-44 45-54 55-64
  CompletedHS   7558 16431  1855  9435  8795
  IncompleteHS 13746  5416  5030  5777  7606
  Uni1-32503  8555  5576  3124  2524
  Uni4+ 2483  9771  7596  3904  3109

Naturally I would prefer the factor levels in their natural ordering in
the table. I would like to re-order the levels of the factors to achieve
this.

I have tried reorder() in the gdata package:

 ed - reorder(Education,neworder= c(IncompleteHS,CompletedHS,
+   Uni1-3,Uni4+))
 agrp - reorder(Age_Group,neworder=
+   c(25-34,35-44,45-54,55-64,64))
 xtabs(Count ~ ed + agrp)
  agrp
ed 25-34 35-44 45-54 55-64   64
  CompletedHS  16431  1855  9435  8795  7558
  IncompleteHS  5416  5030  5777  7606 13746
  Uni1-38555  5576  3124  2524  2503
  Uni4+ 9771  7596  3904  3109  2483

which works on one factor but not the other.

I have fooled a bit with reorder.factor() but I can't seem to figure out
how to drive it!

Cheers,  Murray Jorgensen
-- 
Dr Murray Jorgensen  http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: [EMAIL PROTECTED]Fax 7 838 4155
Phone  +64 7 838 4773 wkHome +64 7 825 0441Mobile 021 1395 862

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] Re-ordering factors

2007-10-06 Thread James Reilly

Using reorder.factor from the stats package seems to work:

educ$ed - reorder(educ$Education, sort(rep(1:4,5)))
levels(educ$Education)
[1] CompletedHS  IncompleteHS Uni1-3   Uni4+
levels(educ$ed)
[1] IncompleteHS CompletedHS  Uni1-3   Uni4+ 
xtabs(Count ~ ed + Age_Group, data=educ)
   Age_Group
ed 25-34 35-44 45-54 55-64   64
   IncompleteHS  5416  5030  5777  7606 13746
   CompletedHS  16431  1855  9435  8795  7558
   Uni1-38555  5576  3124  2524  2503
   Uni4+ 9771  7596  3904  3109  2483

James

On 7/10/07 4:52 PM, [EMAIL PROTECTED] wrote:
 A small example before I begin my query:
 
 educ - read.table(efile, header=TRUE)
 educ
   Education Age_Group Count
 1  IncompleteHS 25-34  5416
 2  IncompleteHS 35-44  5030
 3  IncompleteHS 45-54  5777
 4  IncompleteHS 55-64  7606
 5  IncompleteHS   64 13746
 6   CompletedHS 25-34 16431
 7   CompletedHS 35-44  1855
 8   CompletedHS 45-54  9435
 9   CompletedHS 55-64  8795
 10  CompletedHS   64  7558
 11   Uni1-3 25-34  8555
 12   Uni1-3 35-44  5576
 13   Uni1-3 45-54  3124
 14   Uni1-3 55-64  2524
 15   Uni1-3   64  2503
 16Uni4+ 25-34  9771
 17Uni4+ 35-44  7596
 18Uni4+ 45-54  3904
 19Uni4+ 55-64  3109
 20Uni4+   64  2483
 xtabs(Count ~ Education + Age_Group, data=educ)
   Age_Group
 Education64 25-34 35-44 45-54 55-64
   CompletedHS   7558 16431  1855  9435  8795
   IncompleteHS 13746  5416  5030  5777  7606
   Uni1-32503  8555  5576  3124  2524
   Uni4+ 2483  9771  7596  3904  3109
 
 Naturally I would prefer the factor levels in their natural ordering in
 the table. I would like to re-order the levels of the factors to achieve
 this.
 
 I have tried reorder() in the gdata package:
 
 ed - reorder(Education,neworder= c(IncompleteHS,CompletedHS,
 +   Uni1-3,Uni4+))
 agrp - reorder(Age_Group,neworder=
 +   c(25-34,35-44,45-54,55-64,64))
 xtabs(Count ~ ed + agrp)
   agrp
 ed 25-34 35-44 45-54 55-64   64
   CompletedHS  16431  1855  9435  8795  7558
   IncompleteHS  5416  5030  5777  7606 13746
   Uni1-38555  5576  3124  2524  2503
   Uni4+ 9771  7596  3904  3109  2483
 
 which works on one factor but not the other.
 
 I have fooled a bit with reorder.factor() but I can't seem to figure out
 how to drive it!
 
 Cheers,  Murray Jorgensen

-- 
James Reilly
Department of Statistics, University of Auckland
Private Bag 92019, Auckland, New Zealand

__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.


Re: [R] help_R2.5 updating

2007-10-06 Thread Prof Brian Ripley

There is no 'R 2.5'!  Advice as requested:

1) Study the R posting guide and give the details it asks you for, 
accurately.


2) Read the rw-FAQ.  Very relevant for Windows Vista users.

3) Don't use obsolete versions of R.  R 2.6.0 is current, and we do make R 
better at each release.


If you have R 2.5.0, it is possible that the intended behaviour (it should 
create a personal library directory for you) may not work on Vista: this 
*is* covered in the rw-FAQ for 2.5.0.


Comments from the rw-FAQ:

  For an installation to be used by a single user, the simplest way
  is to make use of the `personal library' introduced in R 2.5.0:
  ...

  You can also have you a personal library, which defaults to the
  directory `R\win-library\X.Y' of your home directory for versions X.Y.Z
  of R.  This location can be changed by setting the environment variable
  `R_LIBS_USER', and can be found from inside R by running
  `Sys.getenv(R_LIBS_USER)'.  This will only be used if it exists so
  you may need to create it: you can use

 dir.create(Sys.getenv(R_LIBS_USER), recursive = TRUE)

  to do so.  If you use `install.packages' and do not have permission to
  write to the main or site library, it should offer to create a personal
  library for you and install the packages there.  This will also happen
  if `update.packages' offers to update packages for you in a library
  where you do not have write permission.

  There can be additional security issues under Windows Vista: *Note Does
  R run under Windows Vista?::.  In particular, the detection that a
  standard user has suitable permissions appears to be unreliable under
  Vista, so we recommend that you do create a personal directory yourself.

The last point works better under R = 2.5.1 than in 2.5.0.  It now errs 
on the side of caution, and occasionally says you do not have permission 
when you do.



On Sat, 6 Oct 2007, Thanjavur Bragadeesh wrote:



Hi,

I run windows vista ultimate in my laptop and run R 2.5

I am trying to update the packages but it comes up with an error message

Warning in install.packages(update[instlib == l, Package], l, contriburl = 
contriburl,  :  'lib' is not writable
Error in install.packages(update[instlib == l, Package], l, contriburl = 
contriburl,  : unable to install packages

I am the adminsitrator on this computer and logged in as administrator.

can anyone advise. I treid to switch off most security - windows 
firewall is off and so is macfee.



many thanks for your advise

bragadeesh



_
Climb to the top of the charts!  Play Star Shuffle:  the word scramble 
challenge with star power.

[[alternative HTML version deleted]]




--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org 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 commented, minimal, self-contained, reproducible code.