Re: [R] Matlab inv() and R solve() differences

2009-01-30 Thread Peter Dalgaard

Joseph P Gray wrote:

I submit the following matrix to both MATLAB and R

x=  0.133 0.254 -0.214 0.116
0.254 0.623 -0.674 0.139
   -0.214 -0.674 0.910 0.011
0.116 0.139  0.011 0.180

MATLAB's inv(x) provides the following
 137.21 -50.68 -4.70 -46.42
-120.71  27.28 -8.94 62.19
-58.15   6.93  -7.89  36.94
  8.35   11.17 10.42 -14.82

R's solve(x) provides:
261.94 116.22 150.92 -267.78
116.22 344.30 286.68 -358.30
150.92 286.68 252.96 -334.09
-267.78 =358.30 -334.09 475.22

inv(x)*x = I(4)
and solve(x)%*%x = I(4)

Is there a way to obtain the MATLAB result in R?


Multiply x[3,4] by 10:

 xx - x
 xx[3,4]-0.11
 solve(xx)
   [,1]  [,2]  [,3]  [,4]
[1,]  137.20892 -50.67500 -4.705127 -46.41581
[2,] -120.71445  27.27570 -8.937571  62.19270
[3,]  -58.15073   6.93474 -7.886343  36.93919
[4,]8.34851  11.17053 10.415928 -14.81602



--
   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
~~ - (p.dalga...@biostat.ku.dk)  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.


Re: [R] How do I get my IT department to bless R?

2009-01-30 Thread Barry Rowlingson
2009/1/29 Daniel Viar dan.v...@gmail.com:
 How does one get an all Microsoft
 shop on board with allowing users to user R?

 An 'all Microsoft shop' is what exactly? There is nothing on your PC
that isn't from Microsoft?

 That makes me think that you're either going to be forced to do your
statistics in Excel or you're going to have to write everything from
scratch in MS Visual Basic/C#/ASP/Bandwagon-of-the-month Language.
$Deity have mercy upon your soul.

 MS don't make anything even *remotely* like R, and if your IT dept
don't see that then get them fixed or fired.

 Now the argument between R and other proprietary stats packages
(SPSS, SAS, Stata) is something completely different. But if the
powers that be won't allow non-MS software, then those options are as
closed off as R is to you.

Barry

__
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] R DCOMServer Manager 2.0

2009-01-30 Thread Dieter Menne
 Smita.KUMAR at rbs.com writes:

 We use R DCOMServer Manager 2.0, this application uses RGUI 2.3.0 as 
 one of its components. We are planning to upgrade to the latest version 
 of RGUI 2.8.0 but found that R DCOMServer manager is not
 compatible with the latest version.

Check the messages at:
http://www.mail-archive.com/rco...@mailman.csd.univie.ac.at/

You can download the latest (working) version from 
http://rcom.univie.ac.at/download/devel/

And better don't post RDCOM questions here, there is a danger
of being rippled by higher authorities on this list when you do. 
The mailing list above is for RCOM  related questions.

Dieter

__
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] ERROR: compilation failed for package 'RdbiPgSQL'

2009-01-30 Thread Bucher Elmar
Dear Srinivas Iyyer, 

I know you wrote this error statement nearly two year ago. But yesterday
night I had the same problem. So here is the solution.  
If you use debian distribution (I use sage) you have to install the
following packages to compile RdbiPgSQL: 
postgresql-8.1 and libpq-dev. 
You had not installed libpq-dev. That caused the error. 

So long, Elmar 

__
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] Equivalent of Hold On MatLab Command

2009-01-30 Thread mauede
Does R have a graphic command equivalent of MatLab Hold On ?
I am trying to sabve on a pdf file a composite drawing. I first declare the 
canvas size, then I define the layout, finally I generate the 4 plots according 
to layout order. Eventually I close the pdf file (dev.off()).
The resulting PDF file contains 2 pages. The first one shows only the layout. 
The second one shows the whole
composite drawing.
MatLab has the command Hold On to work around similar synchronization problems.
Does R have have an equivalent command ?

Thank you so much,
Maura  


tutti i telefonini TIM!


[[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.


Re: [R] Matlab inv() and R solve() differences

2009-01-30 Thread Cleber Nogueira Borges

Hello,

is there a upper limit to kappa value where I can consider a matrix 
well-conditioned?



Cleber



Kingsford Jones wrote:

I suppose the solution is unstable because x is ill-conditioned:

  

x


   [,1]   [,2]   [,3]  [,4]
[1,]  0.133  0.254 -0.214 0.116
[2,]  0.254  0.623 -0.674 0.139
[3,] -0.214 -0.674  0.910 0.011
[4,]  0.116  0.139  0.011 0.180
  

cor(x)


   [,1]   [,2]   [,3]   [,4]
[1,]  1.000  0.9963557 -0.9883690  0.8548065
[2,]  0.9963557  1.000 -0.9976663  0.8084090
[3,] -0.9883690 -0.9976663  1.000 -0.7663847
[4,]  0.8548065  0.8084090 -0.7663847  1.000

  

kappa(x)


[1] 2813.326

hth,

Kingsford Jones

On Thu, Jan 29, 2009 at 7:00 PM, Joseph P Gray jpg...@uwm.edu wrote:
  

I submit the following matrix to both MATLAB and R

x=  0.133 0.254 -0.214 0.116
   0.254 0.623 -0.674 0.139
  -0.214 -0.674 0.910 0.011
   0.116 0.139  0.011 0.180

MATLAB's inv(x) provides the following
 137.21 -50.68 -4.70 -46.42
-120.71  27.28 -8.94 62.19
-58.15   6.93  -7.89  36.94
 8.35   11.17 10.42 -14.82

R's solve(x) provides:
261.94 116.22 150.92 -267.78
116.22 344.30 286.68 -358.30
150.92 286.68 252.96 -334.09
-267.78 =358.30 -334.09 475.22

inv(x)*x = I(4)
and solve(x)%*%x = I(4)

Is there a way to obtain the MATLAB result in R?

Thanks for any help.


Pat Gray

__



__
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] error message with roxygen

2009-01-30 Thread David Hajage
Hello useRs,

I'm trying to use the Roxygen package.

Here my code file :
#' A packge to check Roxygen's sanity
#' @name helloRoxygen-package
#' @docType package
NA

And my R code to generate the package :
library(roxygen)
package.skeleton(helloRoxygen, code_files = roxy.r, force = T)
roxygenize(helloRoxygen, helloRoxygen, copy.package = F, unlink.target =
F, overwrite = T)

I obtain this error message :
Writing helloRoxygen-package to helloRoxygen/man/helloRoxygen-package.Rd
Writing namespace directives to helloRoxygen/NAMESPACE
Merging collate directive with helloRoxygen/DESCRIPTION to
helloRoxygen/DESCRIPTION
*Avis dans load.dependencies() :
  Package(s) 'helloRoxygen' wouldn't load; callgraphs might be incomplete.*

I don't understand what this means. I'm doing something wrong?

Thank you for your help.

Best regards,

david

[[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.


Re: [R] plotting lines with missing data for x values

2009-01-30 Thread Duncan Murdoch

Gareth Campbell wrote:

I have some data (REE plots - geochemistry) where I have values 1:14 for the
x axis, but have no data for some x values.  Here for example, let's say
that I don't have data for x=2,5,8.

So

x-1:14
y-c(4, NA, 5, 9, NA, 3.4, 8, NA, 19, 22, 12, 14, 15.3, 15)

if I plot the data

plot(x,y)

and then I want to join with lines

lines(x,y)

How do I get it so the points join across the missing x-values?  So the line
joins, for example, point 1,4 with point 3,5  (i.e across point 2,NA)?
  
By convention, NA's say to break the lines, so remove the NA's. 


okay - !is.na(x)  !is.na(y)
lines(x[okay], y[okay])

Duncan Murdoch

Thanks in advance.


Gareth Campbell
PhD Candidate
The University of Auckland

P+649 815 3670
M+6421 256 3511
E   gareth.campb...@esr.cri.nz
gcam...@gmail.com

[[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.


Re: [R] scoping rules for 'for' [was - Re: for/if loop ]

2009-01-30 Thread Patrick Burns

'The R Inferno' page 36.


Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of The R Inferno and A Guide for the Unwilling S User)

SnowManPaddington wrote:

Hi ya, thanks a lot everyone!! I changed rr:ii-1 to rr:(ii-1) and the code
works!!! I finally get some estimates from the optimization function (i am
doing a logit model with 2 segments). Thanks thanks!!!
I didn't realize rr:(ii-1) and rr:ii-1 would make such a big difference,
especially because the professor used rr:ii-1 in his Gauss code. I didn't
realize it means so much different in R!



davidr-2 wrote:
  

The lines below made me understand clearly. Maybe they are already in
some documentation,
but if not, it might help others to avoid my misunderstanding.
Thanks to all for the clarifications.
-- David


-Original Message-
From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] 
Sent: Thursday, January 29, 2009 9:54 AM

To: David Reiner dav...@rhotrading.com
Cc: Henrik Bengtsson; r-help@r-project.org; SnowManPaddington
Subject: [SPAM] - Re: [R] scoping rules for 'for' [was - Re: for/if loop
] - Found word(s) list error in the Text body

snip
  Feel free to do what you like to the variable within the 
loop (though you might cause Luke to grind his teeth when it messes up 
his compiler).  It will be set to the next value in the 1:10 vector the 
next time it comes back to the top.


snip

Duncan Murdoch

__
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] Factor Analysis-factanal function

2009-01-30 Thread Ocaña Riola, Ricardo
Dear friends,

 

I'm using R to produce the following Factor Analysis:

 

 matriz.cor-hetcor(matrix(as.factor(data), ncol=variables,
byrow=T))$correlations

 factanal(x=data, factors=2, covmat=matriz.cor, scores='regression')

 

Then the screen output shows the following message:

 

Error en factanal(x = data, factors = 2, covmat = matrix, : 

  requested scores without an 'x' matrix

 

Do you know some additional function in order to produce a matrix of scores
when 'covmat' parameter is used?.

Thank you.


[[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.


Re: [R] Matlab inv() and R solve() differences

2009-01-30 Thread Berend Hasselman



Joseph P Gray wrote:
 
 I submit the following matrix to both MATLAB and R
 
 x=  0.133 0.254 -0.214 0.116
 0.254 0.623 -0.674 0.139
-0.214 -0.674 0.910 0.011
 0.116 0.139  0.011 0.180
 
 MATLAB's inv(x) provides the following
  137.21 -50.68 -4.70 -46.42
 -120.71  27.28 -8.94 62.19
 -58.15   6.93  -7.89  36.94
   8.35   11.17 10.42 -14.82
 
 R's solve(x) provides:
 261.94 116.22 150.92 -267.78
 116.22 344.30 286.68 -358.30
 150.92 286.68 252.96 -334.09
 -267.78 =358.30 -334.09 475.22
 
 

The matrix x is clearly symmetric. Therefore I expect a symmetric inverse of
x.
The result of Matlab's inv(x) is clearly not symmetric.
R's result is symmetric.

I find  what is shown as Matlab's result difficult to believe.

Berend


-- 
View this message in context: 
http://www.nabble.com/Matlab-inv%28%29-and-R-solve%28%29-differences-tp21740213p21745164.html
Sent from the R help mailing list archive at Nabble.com.

__
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 RMySQL (S4R.h:40:17: error: S.h: No such file or directory?)

2009-01-30 Thread Dan Bolser
Hi,

I'm trying to install RMySQL and I keep hitting errors. My computer is:

uname -a
Linux cricket 2.6.18-92.1.22.el5PAE #1 SMP Tue Dec 16 12:36:25 EST 2008 i686
i686 i386 GNU/Linux


I have set the following environment settings:

export PKG_LIBS=-L/usr/lib/mysql -lmysqlclient
export PKG_CPPFLAGS=-I/usr/include/mysql


I run the following command:

R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7
RMySQL_0.7-2.tar.gz


And I get the output below.

Can anyone help me with this? What additional system details can I send?


Thanks very much for any tips.

Dan.


R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7
RMySQL_0.7-2.tar.gz
* Installing *source* package 'RMySQL' ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... no
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -m32 -std=gnu99 -I/usr/include/R -I/usr/include/mysql
-I/usr/local/include-fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables -c RS-DBI.c -o RS-DBI.o
In file included from RS-DBI.h:32,
 from RS-DBI.c:22:
S4R.h:40:17: error: S.h: No such file or directory
S4R.h:53:24: error: Rversion.h: No such file or directory
S4R.h:54:51: error: missing binary operator before token (
S4R.h:62:26: error: Rdefines.h: No such file or directory
S4R.h:154:49: error: missing binary operator before token (
S4R.h:176:49: error: missing binary operator before token (
In file included from RS-DBI.c:22:
RS-DBI.h:100: error: expected specifier-qualifier-list before 'SEXPTYPE'
RS-DBI.h:170: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:173: error: expected ')' before '*' token
RS-DBI.h:174: error: expected ')' before '*' token
RS-DBI.h:175: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:176: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:179: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:181: error: expected ')' before '*' token
RS-DBI.h:182: error: expected ')' before '*' token
RS-DBI.h:183: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:184: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:187: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:188: error: expected ')' before '*' token
RS-DBI.h:189: error: expected ')' before '*' token
RS-DBI.h:190: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:191: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:194: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:195: error: expected ')' before '*' token
RS-DBI.h:213: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:220: error: expected ')' before '*' token
RS-DBI.h:224: error: expected ')' before '*' token
RS-DBI.h:231: error: expected ')' before '*' token
RS-DBI.h:251: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:253: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:257: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:259: error: expected declaration specifiers or '...' before
'SEXPTYPE'
RS-DBI.h:260: error: expected declaration specifiers or '...' before
'SEXPTYPE'
RS-DBI.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.c:109: error: expected ')' before '*' token
RS-DBI.c:137: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.c:207: error: expected ')' before '*' token
RS-DBI.c:261: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.c:309: error: expected ')' before '*' token
RS-DBI.c: In function 'RS_DBI_allocFields':
RS-DBI.c:350: warning: implicit declaration of function 

Re: [R] Accessing R as a Web service (UNCLASSIFIED)

2009-01-30 Thread Paul Hiemstra
Google for R and soap to get information on running R on webserver 
using soap.


cheers,
Paul

Neiderer, Andrew (Civ, ARL/CISD) wrote:
Classification:  UNCLASSIFIED 
Caveats: NONE
 
I am new to R and somewhat to Web server programming.  
I am a Java programmer, however, and have done quite a bit with X3D

(extensible 3D) computer graphics.

A statistician that I work with is doing multidimensional scaling (MDS) and
provides some x,y,z's which I display using X3D.
Currently he is using Permap which more than gets the job done but is
written in Visual Basic (I believe).  I think it would be a big job to use
Permap as a Web service.  So I am looking at R (for other reasons as well).

My question is -
Can I access R via SOAP, e.g., running on a server.  Assuming I worded my
question correctly and someone understands my question, please provide URLs
. so I can get knowledgeable.

Thank you.

- Andrew M. Neiderer

 
Classification:  UNCLASSIFIED 
Caveats: NONE
  



__
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.
  



--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +31302535773
Fax:+31302531145
http://intamap.geo.uu.nl/~paul

__
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] tab characters

2009-01-30 Thread Marie Sivertsen
I see 'The R Inferno' being refered quiet often recently.  But it was now
pointed by Duncan Murdoch that for example the statement concerning
variables in a for loop is not correct in there (page 62).  As I can not
find any information about the book been reviewed by anyone I have a
question:  is it reliable resource for learning about R?  What is the
authority of Patrick Burns?  I would like to avoid spending much time on
learning from 'The R Inferno' to only later discover that it was wrong.

Mvh.
Marie



On Fri, Jan 30, 2009 at 11:13 AM, Patrick Burns pbu...@pburns.seanet.comwrote:

 'The R Inferno' pages 45-46.


 Patrick Burns
 patr...@burns-stat.com
 +44 (0)20 8525 0696
 http://www.burns-stat.com
 (home of The R Inferno and A Guide for the Unwilling S User)

 Nick Matzke wrote:

 Hi all,

 Working at the R command line, how do I get strings to display e.g. tab or
 newline characters as they should be displayed, rather than as e.g. \n or
 \t?

 e.g.:
  x=\t
  x=\t
  x
 [1] \t
  print(x)
 [1] \t


 __
 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.


[[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.


Re: [R] How do I get my IT department to bless R?

2009-01-30 Thread Neil Shephard



Daniel Viar wrote:
 
 I currently use R at work under the radar, but there's a chance I
 could loose that access.  I'd like to get our company to feel
 comfortable with open source and R in particular.  Does anyone have
 any experience with their company's IT department and management that
 they would be willing to share?  How does one get an all Microsoft
 shop on board with allowing users to user R?  I know about the recent
 NY Times article and recent news.  I'm afraid I may need some case
 studies or examples of what other companies have done.
 
 Any help would be greatly appreciated.
 
 

What alternative do they expect you to use?  

If they expect you to use Excel for statistics then its worth letting them
know that this would be a very bad idea as there are many short-comings,
some of which I've referenced at..

http://slack.ser.man.ac.uk/progs/stata/avoid_excel.html

Neil
-- 
View this message in context: 
http://www.nabble.com/How-do-I-get-my-IT-department-to-%22bless%22-R--tp21739359p21746356.html
Sent from the R help mailing list archive at Nabble.com.

__
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 RMySQL (S4R.h:40:17: error: S.h: No such file or directory?)

2009-01-30 Thread Jeffrey Horner

Dan Bolser wrote:

Hi,

I'm trying to install RMySQL and I keep hitting errors. My computer is:

uname -a
Linux cricket 2.6.18-92.1.22.el5PAE #1 SMP Tue Dec 16 12:36:25 EST 2008 i686
i686 i386 GNU/Linux


I have set the following environment settings:

export PKG_LIBS=-L/usr/lib/mysql -lmysqlclient
export PKG_CPPFLAGS=-I/usr/include/mysql


I run the following command:

R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7
RMySQL_0.7-2.tar.gz


Hi Dan,

You will certainly want to upgrade R first. The latest version is R 2.8.1.

Jeff




And I get the output below.

Can anyone help me with this? What additional system details can I send?


Thanks very much for any tips.

Dan.


R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7
RMySQL_0.7-2.tar.gz
* Installing *source* package 'RMySQL' ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... no
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -m32 -std=gnu99 -I/usr/include/R -I/usr/include/mysql
-I/usr/local/include-fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables -c RS-DBI.c -o RS-DBI.o
In file included from RS-DBI.h:32,
 from RS-DBI.c:22:
S4R.h:40:17: error: S.h: No such file or directory
S4R.h:53:24: error: Rversion.h: No such file or directory
S4R.h:54:51: error: missing binary operator before token (
S4R.h:62:26: error: Rdefines.h: No such file or directory
S4R.h:154:49: error: missing binary operator before token (
S4R.h:176:49: error: missing binary operator before token (
In file included from RS-DBI.c:22:
RS-DBI.h:100: error: expected specifier-qualifier-list before 'SEXPTYPE'
RS-DBI.h:170: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:173: error: expected ')' before '*' token
RS-DBI.h:174: error: expected ')' before '*' token
RS-DBI.h:175: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:176: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:179: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:181: error: expected ')' before '*' token
RS-DBI.h:182: error: expected ')' before '*' token
RS-DBI.h:183: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:184: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:187: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:188: error: expected ')' before '*' token
RS-DBI.h:189: error: expected ')' before '*' token
RS-DBI.h:190: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:191: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:194: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:195: error: expected ')' before '*' token
RS-DBI.h:213: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:220: error: expected ')' before '*' token
RS-DBI.h:224: error: expected ')' before '*' token
RS-DBI.h:231: error: expected ')' before '*' token
RS-DBI.h:251: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:253: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:257: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:259: error: expected declaration specifiers or '...' before
'SEXPTYPE'
RS-DBI.h:260: error: expected declaration specifiers or '...' before
'SEXPTYPE'
RS-DBI.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.c:109: error: expected ')' before '*' token
RS-DBI.c:137: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.c:207: error: expected ')' before '*' token
RS-DBI.c:261: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.c:309: error: expected ')' 

Re: [R] Matlab inv() and R solve() differences

2009-01-30 Thread Peter Dalgaard
Berend Hasselman wrote:
 
 
 Joseph P Gray wrote:
 I submit the following matrix to both MATLAB and R

 x=  0.133 0.254 -0.214 0.116
 0.254 0.623 -0.674 0.139
-0.214 -0.674 0.910 0.011
 0.116 0.139  0.011 0.180

 MATLAB's inv(x) provides the following
  137.21 -50.68 -4.70 -46.42
 -120.71  27.28 -8.94 62.19
 -58.15   6.93  -7.89  36.94
   8.35   11.17 10.42 -14.82

 R's solve(x) provides:
 261.94 116.22 150.92 -267.78
 116.22 344.30 286.68 -358.30
 150.92 286.68 252.96 -334.09
 -267.78 =358.30 -334.09 475.22


 
 The matrix x is clearly symmetric. Therefore I expect a symmetric inverse of
 x.
 The result of Matlab's inv(x) is clearly not symmetric.
 R's result is symmetric.
 
 I find  what is shown as Matlab's result difficult to believe.

Yes. See my earlier post. (Well. I believe it, but not with the same input!)

-- 
   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
~~ - (p.dalga...@biostat.ku.dk)  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.


Re: [R] Q about how to use Anova.mlm

2009-01-30 Thread John Fox
Dear Paul,

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
 Behalf Of pgseye
 Sent: January-29-09 10:07 PM
 To: r-help@r-project.org
 Subject: Re: [R] Q about how to use Anova.mlm
 
 
 Thanks a lot for that John - really helpful. I generated some random
numbers
 and seem to be able to get it to work, so that's great.
 
 One thing - it's come up with a 'Type III' test and given me a few
warnings.
 What's the difference between Type II and Type III tests (if there's some
 basic guide you can point me to).

The default for Anova() is type-II tests, but the computational approach
taken doesn't provide a test for the intercept, which is the only
between-subject term in the model; thus, a type-III test is substituted.
In a model with only an intercept, there is no distinction between the two
types of tests.

More generally, types II and III tests address different hypotheses in
models in which some terms are marginal to others. There's a brief
explanation in my R and S-PLUS Companion to Applied Regression (Wiley,
2002), which is the book associated with the car package in which Anova()
resides. There's a more complete discussion in my Applied Regression
Analysis and Generalized Linear Models, Second Edition (Sage, 2008). Neither
book, BTW, discusses repeated-measures models.

I hope this helps,
 John

 
 Thank you again.
 
 Best,
 
 Paul
 
 --
 View this message in context: http://www.nabble.com/Q-about-how-to-use-
 Anova.mlm-tp21739443p21740704.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 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] From z to Rho

2009-01-30 Thread LE PAPE Gilles
Hi,
when performing a spearman_test stratified by a given factor in package coin, 
how is it possible to obtain the value of Rho, the Spearman correlation 
coefficient ?
Thanks in advance
Gilles (F)

[[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.


Re: [R] Factor Analysis-factanal function

2009-01-30 Thread John Fox
Dear Ricardo,

Factor scores are linear combinations of the original variables and
therefore to get factor scores, factanal() needs the data, not just the
correlation matrix among the variables. 

Perhaps what you want is the factor-score coefficient matrix. Since you're
apparently using a varimax rotation, which is orthogonal, you could compute
the factor-score coefficients from the correlation matrix among variables
and the factor loadings. To do this for an oblique rotation, you'd need the
factor-correlation matrix, which factanal() sadly and inexplicably doesn't
report.

All this is academic, however, because if you don't have the original data
from which to compute factor scores, what use are the factor-score
coefficients?

I hope this helps,
 John

--
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
 Behalf Of Ocaña Riola, Ricardo
 Sent: January-30-09 5:30 AM
 To: r-help@r-project.org
 Subject: [R] Factor Analysis-factanal function
 
 Dear friends,
 
 
 
 I'm using R to produce the following Factor Analysis:
 
 
 
  matriz.cor-hetcor(matrix(as.factor(data), ncol=variables,
 byrow=T))$correlations
 
  factanal(x=data, factors=2, covmat=matriz.cor, scores='regression')
 
 
 
 Then the screen output shows the following message:
 
 
 
 Error en factanal(x = data, factors = 2, covmat = matrix, :
 
   requested scores without an 'x' matrix
 
 
 
 Do you know some additional function in order to produce a matrix of
scores
 when 'covmat' parameter is used?.
 
 Thank you.
 
 
   [[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.


Re: [R] Problem installing RMySQL (S4R.h:40:17: error: S.h: No such file or directory?)

2009-01-30 Thread Prof Brian Ripley

Looks like you installed R from an RPM and missed the R-devel RPM.

On Fri, 30 Jan 2009, Dan Bolser wrote:


Hi,

I'm trying to install RMySQL and I keep hitting errors. My computer is:

uname -a
Linux cricket 2.6.18-92.1.22.el5PAE #1 SMP Tue Dec 16 12:36:25 EST 2008 i686
i686 i386 GNU/Linux


I have set the following environment settings:

export PKG_LIBS=-L/usr/lib/mysql -lmysqlclient
export PKG_CPPFLAGS=-I/usr/include/mysql


I run the following command:

R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7
RMySQL_0.7-2.tar.gz


And I get the output below.

Can anyone help me with this? What additional system details can I send?


Well, what your OS is is often helpful, and how you installed R, and 
of course the 'at a minimum' information asked for in the posting 
guide.




Thanks very much for any tips.

Dan.


R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7
RMySQL_0.7-2.tar.gz
* Installing *source* package 'RMySQL' ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... no
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -m32 -std=gnu99 -I/usr/include/R -I/usr/include/mysql
-I/usr/local/include-fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables -c RS-DBI.c -o RS-DBI.o
In file included from RS-DBI.h:32,
from RS-DBI.c:22:
S4R.h:40:17: error: S.h: No such file or directory
S4R.h:53:24: error: Rversion.h: No such file or directory
S4R.h:54:51: error: missing binary operator before token (
S4R.h:62:26: error: Rdefines.h: No such file or directory
S4R.h:154:49: error: missing binary operator before token (
S4R.h:176:49: error: missing binary operator before token (
In file included from RS-DBI.c:22:
RS-DBI.h:100: error: expected specifier-qualifier-list before 'SEXPTYPE'
RS-DBI.h:170: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:173: error: expected ')' before '*' token
RS-DBI.h:174: error: expected ')' before '*' token
RS-DBI.h:175: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:176: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:179: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:181: error: expected ')' before '*' token
RS-DBI.h:182: error: expected ')' before '*' token
RS-DBI.h:183: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:184: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:187: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:188: error: expected ')' before '*' token
RS-DBI.h:189: error: expected ')' before '*' token
RS-DBI.h:190: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:191: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:194: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:195: error: expected ')' before '*' token
RS-DBI.h:213: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:220: error: expected ')' before '*' token
RS-DBI.h:224: error: expected ')' before '*' token
RS-DBI.h:231: error: expected ')' before '*' token
RS-DBI.h:251: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:253: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:257: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.h:259: error: expected declaration specifiers or '...' before
'SEXPTYPE'
RS-DBI.h:260: error: expected declaration specifiers or '...' before
'SEXPTYPE'
RS-DBI.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.c:109: error: expected ')' before '*' token
RS-DBI.c:137: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'*' token
RS-DBI.c:207: error: expected 

Re: [R] tab characters

2009-01-30 Thread Duncan Murdoch

On 1/30/2009 7:19 AM, Marie Sivertsen wrote:

I see 'The R Inferno' being refered quiet often recently.  But it was now
pointed by Duncan Murdoch that for example the statement concerning
variables in a for loop is not correct in there (page 62).  As I can not
find any information about the book been reviewed by anyone I have a
question:  is it reliable resource for learning about R?  What is the
authority of Patrick Burns?  I would like to avoid spending much time on
learning from 'The R Inferno' to only later discover that it was wrong.


That's the first error I've seen in it.  In my opinion, it's a very 
useful reference.


Duncan Murdoch



Mvh.
Marie



On Fri, Jan 30, 2009 at 11:13 AM, Patrick Burns pbu...@pburns.seanet.comwrote:


'The R Inferno' pages 45-46.


Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of The R Inferno and A Guide for the Unwilling S User)

Nick Matzke wrote:


Hi all,

Working at the R command line, how do I get strings to display e.g. tab or
newline characters as they should be displayed, rather than as e.g. \n or
\t?

e.g.:
 x=\t
 x=\t
 x
[1] \t
 print(x)
[1] \t



__
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.



[[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] princomp - varimax - factanal

2009-01-30 Thread Alberto Maceda Veiga
Hi!

I am trying to analyse with R a database that I have previously analysed
with SPSS.

Steps with SPSS:

Factorial analysis
 Extraction options : I select = Principal component analysis
 Rotation: varimax

Steps with R:

I have tried it with varimax function with factanal or with princomp...and
the results are different of what I have with SPSS. I think that varimax
function is incorporated in factanal function.


Does anybody know which are the instructions into R to do exactly the same
of what I have done with SPSS???



Thank you very much!

[[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.


Re: [R] tab characters

2009-01-30 Thread Peter Dalgaard
Marie Sivertsen wrote:
 I see 'The R Inferno' being refered quiet often recently.  But it was now
 pointed by Duncan Murdoch that for example the statement concerning
 variables in a for loop is not correct in there (page 62).  As I can not
 find any information about the book been reviewed by anyone I have a
 question:  is it reliable resource for learning about R?  What is the
 authority of Patrick Burns?  I would like to avoid spending much time on
 learning from 'The R Inferno' to only later discover that it was wrong.


In short: Don't worry too much.

Pat is an experienced S and R user. In fact, he's been around since R
was little but a gleam in its fathers' eyes. He has a record of writing
stuff and publishing on the web, in a style somewhat different from what
the publishing companies seem to want. The R Inferno is his latest
addition, so he's liable to make a few Hey, I wrote about that kind of
posts.

A quick look suggest that this should be quite an amusing read, but it
isn't a textbook for beginners learning R. Rather, it is assumed that
you already know the basics, and now need to read about the pitfalls.
There could be inaccuracies (the for loop description is indeed mildly
off-base), but the intended audience can reasonably be assumed to
possess a critical mind. And the nice thing about web publications is
that mistakes can be fixed quickly.

-pd


-- 
   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
~~ - (p.dalga...@biostat.ku.dk)  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.


Re: [R] Equivalent of Hold On MatLab Command

2009-01-30 Thread Richard . Cotton
 Does R have a graphic command equivalent of MatLab Hold On ?
 I am trying to sabve on a pdf file a composite drawing. I first 
 declare the canvas size, then I define the layout, finally I 
 generate the 4 plots according to layout order. Eventually I close 
 the pdf file (dev.off()).
 The resulting PDF file contains 2 pages. The first one shows only 
 the layout. The second one shows the whole
 composite drawing.
 MatLab has the command Hold On to work around similar 
 synchronization problems.
 Does R have have an equivalent command ?

If you are using base graphics (i.e. not lattice/ grid graphics), then you 
can mimic MATLAB's hold on feature by using the points/lines/polygons 
functions to add additional details to your plots without starting a new 
plot.  In the case of a multiplot layout, you can use par(mfg=...) to pick 
which plot you add things to.

#open the pdf device
pdf(test.pdf)

#setup the layout
par(mfrow=c(2,2))

#plot at each location
for(i in 1:4) plot(runif(1:10))

#return to the first plot
par(mfg=c(1,1))

#add a line to this plot (without replacing anything)
lines(seq(0.1,1,0.1))

#close the device to complete the plot
dev.off()

If you have an extra page in you PDF file, it's probably because you've 
called plot.new() somewhere where you didn't mean to (either explicitly or 
implicitly).  Without a reproducible example, it's hard to help further.

Regards,
Richie.

Mathematical Sciences Unit
HSL




ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
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] Rgraphviz install

2009-01-30 Thread June Wong

Hi
 
I've tried several times and followed what others suggest in installing 
Rgraphviz (https://stat.ethz.ch/pipermail/bioconductor/2008-June/022838.html)
But I could not load library(Rgraphviz). 
There's a message that 'This application has failed to start because 
libcdt-4.dll was not found'
 
Could anyone suggest me how to make it work?
 
june
_


ore_012009
[[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] lmer and weights

2009-01-30 Thread Gasper Cankar

I'm using R2.8.1 and trying to do some nested modelling using lmer and
weights. When I multiply/divide weights with a constant, variance of
groups intercept changes, but variance of the residual doesn't (using
unconditional model). 

Shouldn't they change equally? Are there any specifications on how to
set weights properly?

Thanks for reply,

___
Gasper Cankar. PhD 
researcher
National Examinations Centre (Ric)
gasper.can...@ric.si
tel. +386 1 54 84 682
fax. +386 1 54 84 601

__
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] OO programming S3/S4 paradigm - General question

2009-01-30 Thread julien cuisinier

Hi,
 
 
 
Being relatively new to OO programming and not so old on R, I noticed the 
possibility to do OO programming in R. 
But it seems there is two paradigms S3 that seems the old one but is the one 
used in the R.oo package and S4 which seems more recent
 
As a starting point, which one is best to use? Is R.oo useful? what are the 
main difference between the two? 
 
 
Any feedback helpful.
 
 
Many thanks in advance  have a nice weekend!
Julien
 

_

 charlas.

[[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] [R-pkgs] np 0.30-1 (nonparametric kernel smoothing methods for mixed data types) is available on CRAN...

2009-01-30 Thread User Jracine Jeffrey S. Racine
Dear R users,

Version 0.30-1 of the np package has been released and uploaded to CRAN.
The np package provides nonparametric kernel smoothing methods for mixed
data types. We encourage anyone using the package to upgrade to the
latest version.

Description: This package provides a variety of nonparametric (and
semiparametric) kernel methods that seamlessly handle a mix of
continuous, unordered, and ordered factor data types. We would like to
gratefully acknowledge support from  the Natural Sciences and
Engineering Research Council of Canada (NSERC:www.nserc.ca), the Social
Sciences and Humanities Research Council of Canada (SSHRC:www.sshrc.ca),
and the Shared Hierarchical Academic Research Computing Network
(SHARCNET:www.sharcnet.ca).

License: GPL
 
Note that version 0.30-0 and 0.30-1 provide some much needed
functionality and bug fixes to the package.

Changes from Version 0.30-0 to 0.30-1 [29-Jan-2009]

* predict now supports bandwidth, density, distribution, conbandwidth,
  condensity, and condistribution objects

* Consistently allow predictions for categorical values outside of
  support of training data

  Note that predictions based upon unconditional density objects
  defined over categorical variables that lie outside the support of
  the training data may no longer be true probabilities (i.e., as
  defined over the training data and the extended/augmented support --
  their sum may exceed one) and may therefore require renormalization
  by the user 

* Fixed a numerical issue which could hinder npregbw()'s cross
  validation with higher-order kernels

* Default nmulti in npplregbw() is now set correctly

* Fixed a bug with the ridging routine in npscoefbw(), added ridging to
  npscoef

* Fixed trivial i/o issue with Multistart 1 of using npscoefbw()

Changes from Version 0.20-4 to 0.30-0 [15-Jan-2009]

* Added basic user-interrupt checking for all underlying C code so
  that either Ctrl-C (Rterm) or the `STOP' icon (Rgui) will
  interrupt all running processes. This has a number of desirable side
  effects in addition to being able to interrupt C-based processes
  including i) R no longer showing up as `not responding' under the
  task manager (Windows) or the activity monitor (Mac OS X) and ii)
  buffered output now being correctly displayed when using Rgui under
  Windows and Mac OS X

  Note that repeated interruption of large jobs can reduce available
  memory under R - if this becomes an issue (i.e., you get a `cannot
  allocate...' error under R) simply restart R (i.e., exit then run a
  fresh R session)

* Added a function npseed() that allows the user to set/reset the
  random seed for all underlying C routines

* Fixed a bug that caused npplregbw() to ignore any kernel options
  for the regression of y on z

* Refined certain constants used in the normal-reference density
  bandwidth rule for increased accuracy

* Moved from using the maximum likelihood estimate of variance
  throughout to the degrees of freedom corrected estimate (all
  variance estimates now change by the factor (n-1)/n)

Feedback, comments, bug reports, and suggestions for improvement are
always welcome.

Best regards,

Jeff Racine  Tristen Hayfield

-- 
Professor J. S. Racine Phone:  (905) 525 9140 x 23825
Department of EconomicsFAX:(905) 521-8232
McMaster Universitye-mail: raci...@mcmaster.ca
1280 Main St. W.,Hamilton, URL:
http://www.economics.mcmaster.ca/racine/
Ontario, Canada. L8S 4M4

`The generation of random numbers is too important to be left to
chance.'

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] Subsetting without partial matches

2009-01-30 Thread Jonathan Dushoff
I have a list of observations of individuals.  I would like to make a 
list of individuals, with a data frame of observations for each individual.


The following code usually works, but not always

--

# Make a list of empty data frames
animals = list()
indivs = levels(Z$individual_id)
donotprint - sapply(indivs, function(i){
  animals[[i]] = data.frame()
})

# Add observations of each animal to the appropriate frame
donotprint - apply(Z, 1, function(r){
  ind = r[[individual_id]]
  bind = ind # Use different names to confirm that the partial matching 
is being done on the left


  animals[[bind]]$sighting_number -
 c(animals[[ind, exact=TRUE]]$sighting_number, r[[sighting_number]])
  animals[[bind]]$date-
 c(animals[[ind, exact=TRUE]]$date, r[[date]])
  animals[[bind]]$age -
 c(animals[[ind, exact=TRUE]]$age, r[[age_num]])
})

--

The problem is partial matching.  When it gives the wrong answer, it 
gives partial match warnings.  Adding exact=TRUE to the left, the way 
that I added it to the right, simply produces an argument error.  
Changing to single brackets produces other errors.


I read the help, and the Language Definition (not the whole thing), but 
could not find clear documentation of what single brackets with 
character variable arguments are supposed to do in lists, nor of how 
partial matching is handled on the left side of an assignment, nor of 
whether R is supposed to do partial-match indexing when an exact match 
is available (I would have thought not, and it's documented that it's 
not supposed to for function arguments).


I am interested in how the subsetting is supposed to work, but even more 
in what might be the best way to code this sort of thing in R.


I am using R 2.6.2 on Mandriva linux.

Thanks for any help,

JD

__
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] OO programming S3/S4 paradigm - General questio

2009-01-30 Thread Gabor Grothendieck
S3 is the original OO approach in R.  It is the predominant one and
the simplest one.  That's the one to use if you are starting out.  You
may never, in fact, need to go beyond that.   S4 builds on S3 so
learning S3 won't be a waste of time even if you decide to use S4 later.
S4 is substantially more complex than S3.

There are also a number of packages that implement alternative
OO models.  R.oo implements a model closer to the conventional
model that other languages use.  proto implements the prototype
model, particularly applicable to user interface work.

On Fri, Jan 30, 2009 at 8:47 AM, julien cuisinier
j_cuisin...@hotmail.com wrote:

 Hi,



 Being relatively new to OO programming and not so old on R, I noticed the 
 possibility to do OO programming in R.
 But it seems there is two paradigms S3 that seems the old one but is the 
 one used in the R.oo package and S4 which seems more recent

 As a starting point, which one is best to use? Is R.oo useful? what are the 
 main difference between the two?


 Any feedback helpful.


 Many thanks in advance  have a nice weekend!
 Julien


 _

  charlas.

[[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.


Re: [R] tab characters

2009-01-30 Thread Marie Sivertsen
Thank you both Peter and Duncan for explanations.  'The R Inferno' is indeed
not so much introduction but I find it useful to know about how I can go
wrong in simple things before I do.

Mvh.
Marie

On Fri, Jan 30, 2009 at 3:03 PM, Peter Dalgaard p.dalga...@biostat.ku.dkwrote:

 Marie Sivertsen wrote:
  I see 'The R Inferno' being refered quiet often recently.  But it was now
  pointed by Duncan Murdoch that for example the statement concerning
  variables in a for loop is not correct in there (page 62).  As I can not
  find any information about the book been reviewed by anyone I have a
  question:  is it reliable resource for learning about R?  What is the
  authority of Patrick Burns?  I would like to avoid spending much time on
  learning from 'The R Inferno' to only later discover that it was wrong.


 In short: Don't worry too much.

 Pat is an experienced S and R user. In fact, he's been around since R
 was little but a gleam in its fathers' eyes. He has a record of writing
 stuff and publishing on the web, in a style somewhat different from what
 the publishing companies seem to want. The R Inferno is his latest
 addition, so he's liable to make a few Hey, I wrote about that kind of
 posts.

 A quick look suggest that this should be quite an amusing read, but it
 isn't a textbook for beginners learning R. Rather, it is assumed that
 you already know the basics, and now need to read about the pitfalls.
 There could be inaccuracies (the for loop description is indeed mildly
 off-base), but the intended audience can reasonably be assumed to
 possess a critical mind. And the nice thing about web publications is
 that mistakes can be fixed quickly.

 -pd



[[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.


Re: [R] princomp - varimax - factanal

2009-01-30 Thread stephen sefick
Maybe look into vegan - although this is not my area of specialty
(assuming I have one at all).
good luck


On Fri, Jan 30, 2009 at 9:00 AM, Alberto Maceda Veiga amac...@ub.edu wrote:
 Hi!

 I am trying to analyse with R a database that I have previously analysed
 with SPSS.

 Steps with SPSS:

 Factorial analysis
  Extraction options : I select = Principal component analysis
  Rotation: varimax

 Steps with R:

 I have tried it with varimax function with factanal or with princomp...and
 the results are different of what I have with SPSS. I think that varimax
 function is incorporated in factanal function.


 Does anybody know which are the instructions into R to do exactly the same
 of what I have done with SPSS???



 Thank you very much!

[[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.




-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] How to collect arrays in an array?

2009-01-30 Thread Suresh_FSFM

Dear R-Experts,

Seek your help. 
Please let me know how arrays of different sizes can be collected in one
array.
suppose I want to collect following arrays in one array. How can I do so?

array(1): #row=3, #col=4(these columns store data of different types)
array(2): #row=6, #col=4
array(3): #row=3, #col=4


want to store in Main_array
How to define dimensions of Main_array?


Thank you.

Regards,
Suresh
-- 
View this message in context: 
http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p21748883.html
Sent from the R help mailing list archive at Nabble.com.

__
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] From z to Rho

2009-01-30 Thread Mike Lawrence
Do these functions help?

#Fisher's r-to-z:
fr2z - function(r) atanh(r)

#Fisher's z-to-r:
fz2r - function(z) tanh(z)

On Fri, Jan 30, 2009 at 9:29 AM, LE PAPE Gilles lepape.gil...@neuf.fr wrote:
 Hi,
 when performing a spearman_test stratified by a given factor in package 
 coin, how is it possible to obtain the value of Rho, the Spearman 
 correlation coefficient ?
 Thanks in advance
 Gilles (F)

[[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.




-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University
www.thatmike.com

Looking to arrange a meeting? Check my public calendar:
http://www.thatmike.com/mikes-public-calendar

~ Certainty is folly... I think. ~

__
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] How to collect arrays in an array?

2009-01-30 Thread stephen sefick
why not a list?

On Fri, Jan 30, 2009 at 10:10 AM, Suresh_FSFM suresh.ghals...@gmail.com wrote:

 Dear R-Experts,

 Seek your help.
 Please let me know how arrays of different sizes can be collected in one
 array.
 suppose I want to collect following arrays in one array. How can I do so?

 array(1): #row=3, #col=4(these columns store data of different types)
 array(2): #row=6, #col=4
 array(3): #row=3, #col=4
 

 want to store in Main_array
 How to define dimensions of Main_array?


 Thank you.

 Regards,
 Suresh
 --
 View this message in context: 
 http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p21748883.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.




-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] Date functions

2009-01-30 Thread ehxpieterse

Hi there,

I am completely new to R and would like to do two things with date
functions:
1. Compute any date from a specified starting point, e.g. x - 2 months
2. How do I determine the weekday of any given date?

Thanks in advance
-- 
View this message in context: 
http://www.nabble.com/Date-functions-tp21748580p21748580.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Date functions

2009-01-30 Thread Gabor Grothendieck
# 1
d - Sys.Date()
seq(d, len = 2, by = 2 months)[2]

# 2
as.numeric(format(d, %w)) # 0 = Sunday
# or
format(d, %a)

See R News 4/1 for more info and the table at the end of it in particular.

On Fri, Jan 30, 2009 at 9:54 AM, ehxpieterse
eduard.piete...@macquarie.com wrote:

 Hi there,

 I am completely new to R and would like to do two things with date
 functions:
 1. Compute any date from a specified starting point, e.g. x - 2 months
 2. How do I determine the weekday of any given date?

 Thanks in advance
 --
 View this message in context: 
 http://www.nabble.com/Date-functions-tp21748580p21748580.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.


Re: [R] How to collect arrays in an array?

2009-01-30 Thread Suresh_FSFM

Thanks for a prompt response.
Ok. I see your point. 
However, then next silly question is how to access these elements of list
dynamically?
suppose I want to access 3rd item or 3rd element of the list (which would be
my array-3 stored at 3rd position in the list).

Thank you.

Regards,
Suresh
 

stephen sefick wrote:
 
 why not a list?
 
 On Fri, Jan 30, 2009 at 10:10 AM, Suresh_FSFM suresh.ghals...@gmail.com
 wrote:

 Dear R-Experts,

 Seek your help.
 Please let me know how arrays of different sizes can be collected in one
 array.
 suppose I want to collect following arrays in one array. How can I do so?

 array(1): #row=3, #col=4(these columns store data of different types)
 array(2): #row=6, #col=4
 array(3): #row=3, #col=4
 

 want to store in Main_array
 How to define dimensions of Main_array?


 Thank you.

 Regards,
 Suresh
 --
 View this message in context:
 http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p21748883.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.

 
 
 
 -- 
 Stephen Sefick
 
 Let's not spend our time and resources thinking about things that are
 so little or so large that all they really do for us is puff us up and
 make us feel like gods.  We are mammals, and have not exhausted the
 annoying little problems of being mammals.
 
   -K. Mullis
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p21749677.html
Sent from the R help mailing list archive at Nabble.com.

__
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] simulating outcomes - categorical distribution (?)

2009-01-30 Thread Gonçalo Ferraz
Hi,

I am simulating an event that has 15 possible outcomes and I have a
vector 'pout' that gives me the probability of each outcome -
different outcomes have different probabilities. Does anyone know a
simple way of simulating the outcome of my event?

If my event had only two possible outcomes (0/1) I would pick a
uniform random number between 0 and 1 and use it to choose between the
two possible outcomes given a certain probability of outcome 0 or
failure 1.

Now, since I have 15 possible outcomes, I guess that this should be
done with some form of a categorical distribution but I couldn't find
a function for the categorical distribution yet.

Thanks for any suggestions!

Gonçalo

__
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] How to collect arrays in an array?

2009-01-30 Thread ONKELINX, Thierry
You'll need the [[ operator.

Your.list.name[[3]] gives the third element.




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
thierry.onkel...@inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Namens Suresh_FSFM
Verzonden: vrijdag 30 januari 2009 16:45
Aan: r-help@r-project.org
Onderwerp: Re: [R] How to collect arrays in an array?


Thanks for a prompt response.
Ok. I see your point. 
However, then next silly question is how to access these elements of
list
dynamically?
suppose I want to access 3rd item or 3rd element of the list (which
would be
my array-3 stored at 3rd position in the list).

Thank you.

Regards,
Suresh


stephen sefick wrote:
 
 why not a list?
 
 On Fri, Jan 30, 2009 at 10:10 AM, Suresh_FSFM
suresh.ghals...@gmail.com
 wrote:

 Dear R-Experts,

 Seek your help.
 Please let me know how arrays of different sizes can be collected in
one
 array.
 suppose I want to collect following arrays in one array. How can I do
so?

 array(1): #row=3, #col=4(these columns store data of different types)
 array(2): #row=6, #col=4
 array(3): #row=3, #col=4
 

 want to store in Main_array
 How to define dimensions of Main_array?


 Thank you.

 Regards,
 Suresh
 --
 View this message in context:

http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p2174
8883.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.

 
 
 
 -- 
 Stephen Sefick
 
 Let's not spend our time and resources thinking about things that are
 so little or so large that all they really do for us is puff us up and
 make us feel like gods.  We are mammals, and have not exhausted the
 annoying little problems of being mammals.
 
   -K.
Mullis
 
 __
 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.
 
 

-- 
View this message in context:
http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p2174
9677.html
Sent from the R help mailing list archive at Nabble.com.

__
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.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

__
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] Rgraphviz install

2009-01-30 Thread Uwe Ligges



June Wong wrote:

Hi
 
I've tried several times and followed what others suggest in installing Rgraphviz (https://stat.ethz.ch/pipermail/bioconductor/2008-June/022838.html)
But I could not load library(Rgraphviz). 
There's a message that 'This application has failed to start because libcdt-4.dll was not found'
 
Could anyone suggest me how to make it work?



Yes, install the latest graphviz from the installer graphviz-2.20.3.msi.

Note that it install under a directory called .2.21
So no idea which version it is (and hard to find out).

Best,
Uwe Ligges





june
_


ore_012009
[[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.


Re: [R] How to collect arrays in an array?

2009-01-30 Thread Suresh_FSFM

Thanks a lot ! :-)

Regards,
Suresh





ONKELINX, Thierry wrote:
 
 You'll need the [[ operator.
 
 Your.list.name[[3]] gives the third element.
 
 
 
 
 ir. Thierry Onkelinx
 Instituut voor natuur- en bosonderzoek / Research Institute for Nature
 and Forest
 Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
 methodology and quality assurance
 Gaverstraat 4
 9500 Geraardsbergen
 Belgium 
 tel. + 32 54/436 185
 thierry.onkel...@inbo.be 
 www.inbo.be 
 
 To call in the statistician after the experiment is done may be no more
 than asking him to perform a post-mortem examination: he may be able to
 say what the experiment died of.
 ~ Sir Ronald Aylmer Fisher
 
 The plural of anecdote is not data.
 ~ Roger Brinner
 
 The combination of some data and an aching desire for an answer does not
 ensure that a reasonable answer can be extracted from a given body of
 data.
 ~ John Tukey
 
 -Oorspronkelijk bericht-
 Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 Namens Suresh_FSFM
 Verzonden: vrijdag 30 januari 2009 16:45
 Aan: r-help@r-project.org
 Onderwerp: Re: [R] How to collect arrays in an array?
 
 
 Thanks for a prompt response.
 Ok. I see your point. 
 However, then next silly question is how to access these elements of
 list
 dynamically?
 suppose I want to access 3rd item or 3rd element of the list (which
 would be
 my array-3 stored at 3rd position in the list).
 
 Thank you.
 
 Regards,
 Suresh
 
 
 stephen sefick wrote:
 
 why not a list?
 
 On Fri, Jan 30, 2009 at 10:10 AM, Suresh_FSFM
 suresh.ghals...@gmail.com
 wrote:

 Dear R-Experts,

 Seek your help.
 Please let me know how arrays of different sizes can be collected in
 one
 array.
 suppose I want to collect following arrays in one array. How can I do
 so?

 array(1): #row=3, #col=4(these columns store data of different types)
 array(2): #row=6, #col=4
 array(3): #row=3, #col=4
 

 want to store in Main_array
 How to define dimensions of Main_array?


 Thank you.

 Regards,
 Suresh
 --
 View this message in context:

 http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p2174
 8883.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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.

 
 
 
 -- 
 Stephen Sefick
 
 Let's not spend our time and resources thinking about things that are
 so little or so large that all they really do for us is puff us up and
 make us feel like gods.  We are mammals, and have not exhausted the
 annoying little problems of being mammals.
 
  -K.
 Mullis
 
 __
 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.
 
 
 
 -- 
 View this message in context:
 http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p2174
 9677.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 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.
 
 Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver
 weer 
 en binden het INBO onder geen enkel beding, zolang dit bericht niet
 bevestigd is
 door een geldig ondertekend document. The views expressed in  this message 
 and any annex are purely those of the writer and may not be regarded as
 stating 
 an official position of INBO, as long as the message is not confirmed by a
 duly 
 signed document.
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-collect-arrays-in-an-array--tp21748883p21750072.html
Sent from the R help mailing list archive at Nabble.com.

__
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] Analytics Training Institute launches course on R

2009-01-30 Thread Analytics Training
Hi All,

Now you can join for R course offered by G  K Analytics Training Institute
Pvt Ltd.

We also provide online training Program for those who are willing to take up
this course.

To know more about the courses offered visit www.analyticstraining.in

You can also mail us your queries at i...@analyticstraining.in.

Regards
ATI Team

[[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.


Re: [R] simulating outcomes - categorical distribution (?)

2009-01-30 Thread Marc Schwartz
on 01/30/2009 09:46 AM Gonçalo Ferraz wrote:
 Hi,
 
 I am simulating an event that has 15 possible outcomes and I have a
 vector 'pout' that gives me the probability of each outcome -
 different outcomes have different probabilities. Does anyone know a
 simple way of simulating the outcome of my event?
 
 If my event had only two possible outcomes (0/1) I would pick a
 uniform random number between 0 and 1 and use it to choose between the
 two possible outcomes given a certain probability of outcome 0 or
 failure 1.
 
 Now, since I have 15 possible outcomes, I guess that this should be
 done with some form of a categorical distribution but I couldn't find
 a function for the categorical distribution yet.
 
 Thanks for any suggestions!
 
 Gonçalo

See ?sample

  sample(OutcomeVector, NumberOfOutcomesToGenerate, prob = pout,
 replace = TRUE)

where OutcomeVector and pout contain a 1:1 pairing of each event to its
respective probability.

pout - 1:15 / 100

 pout
 [1] 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12 0.13
[14] 0.14 0.15

# Set seed for reproducibility
set.seed(1)

# Generate 1000 replicates using the target probability distribution
Outcomes - sample(1:15, 1000, prob = pout, replace = TRUE)


 table(Outcomes)
Outcomes
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
 11  15  27  43  34  48  53  73  70  65 102 112 109 120 118


# Note that the random sample will approach the desired distribution
# in large samples, not be exact
 prop.table(table(Outcomes))
Outcomes
1 2 3 4 5 6 7 8 9101112
0.011 0.015 0.027 0.043 0.034 0.048 0.053 0.073 0.070 0.065 0.102 0.112
   131415
0.109 0.120 0.118


BTW, you could use sample() to do this for binary outcomes as well, or
use rbinom() to generate replicates from a binomial distribution.

Using:

  help.search(distribution)

will lead you to additional information on other distributions available.

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] Subsetting without partial matches

2009-01-30 Thread David Winsemius
I have not seen you describe the value of doing partial matching in  
this application, so pardon this perhaps non-responsive reply:  
Wouldn't it have been much, much simpler to have used the subset  
function (which returns a dataframe object) at the first assignment to  
donotprint?


Something along the lines of  (untested) :


donotprint - sapply(indivs, function(i){
 animals[[i]] = subset(Z, individual_id == i, select =  
c(sighting_number, date, age_num) ) }  # reconsider naming variable  
date


  )


--
David Winsemius

On Jan 30, 2009, at 7:46 AM, Jonathan Dushoff wrote:

I have a list of observations of individuals.  I would like to make  
a list of individuals, with a data frame of observations for each  
individual.


The following code usually works, but not always

--

# Make a list of empty data frames
animals = list()
indivs = levels(Z$individual_id)
donotprint - sapply(indivs, function(i){
 animals[[i]] = data.frame()
})

# Add observations of each animal to the appropriate frame
donotprint - apply(Z, 1, function(r){
 ind = r[[individual_id]]
 bind = ind # Use different names to confirm that the partial  
matching is being done on the left


 animals[[bind]]$sighting_number -
c(animals[[ind, exact=TRUE]]$sighting_number,  
r[[sighting_number]])

 animals[[bind]]$date-
c(animals[[ind, exact=TRUE]]$date, r[[date]])
 animals[[bind]]$age -
c(animals[[ind, exact=TRUE]]$age, r[[age_num]])
})

--

The problem is partial matching.  When it gives the wrong answer, it  
gives partial match warnings.  Adding exact=TRUE to the left, the  
way that I added it to the right, simply produces an argument  
error.  Changing to single brackets produces other errors.


I read the help, and the Language Definition (not the whole thing),  
but could not find clear documentation of what single brackets with  
character variable arguments are supposed to do in lists, nor of how  
partial matching is handled on the left side of an assignment, nor  
of whether R is supposed to do partial-match indexing when an exact  
match is available (I would have thought not, and it's documented  
that it's not supposed to for function arguments).


I am interested in how the subsetting is supposed to work, but even  
more in what might be the best way to code this sort of thing in R.


I am using R 2.6.2 on Mandriva linux.

Thanks for any help,

JD

__
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] identifying what labels have been created in a plot

2009-01-30 Thread Dennis Fisher

Colleagues

R 2.8.0; OS X, Vista, Ubuntu Linux

In some instances, when I create a graphic using plot(XVAR, YVAR), it  
would be valuable to know the values that R will display on the y-axis  
(e.g., if the range of data is 0-70, it might display 0, 10, 30, 50,  
70).   Is there a simple means to access these values?


Also, in some instances, additional ticks appear between the displayed  
values (in this case, at 20, 40, 60).  Can I obtain the list of the  
positions of all ticks?


Access to this information permits me to tailor the ticks and labels  
in a particular manner.


Thanks for any suggestions.

Dennis


Dennis Fisher MD
P  (The P Less Than Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com

__
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] paste together object names to pass it on to a function

2009-01-30 Thread stefan.d...@gmail.com
Hello,
I have a maybe trivial question, but I simply don't understand well
enought how to work with text/strings:

I have a rather compelx data structure, a big list with several
sub-lists/dataframes and for certain calculations  (which I do in
loops), I only need a certain group of  sub-lists/dataframes, which I
want to specify with a name vector and paste together the object name
and pass it on to a function.

Here an (hopefully) instructive example

#Data Example
gnuff-list()
gnuff$IHD$LE-66
gnuff$LUNG$LE -55

#This is the list, where I collect data for different diseases at the
second level of the list
#Now I want to do calcualtions just for these two diseases and the
sub-list LE within these diseases


nam - c(LUNG,IHD)

for(i in 1:2)
x[i] - paste(gnuff,nam[i],LE,sep=$) /2
x

#So I try to paste the name of the object which I mean
(gnuff$IHD$LEand gnuff$LUNG$LE, respectivly), but R treats them as a
string and not as the name of an object.
# I tried seveal commands to make it treat like an object name (the
get() looked most promising), but so far to no avail

#commands I have tried
j - eval(paste(gnuff,nam[i],LE,sep=$))
parse(paste(gnuff,nam[i],sep=$))
quote(paste(gnuff,nam[i],sep=$))
get(paste(gnuff,nam[i],sep=$))

Anybody any hints where to look?
Thanks and have a great weekend!
Best,
Stefan

__
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] identifying what labels have been created in a plot

2009-01-30 Thread jim holtman
It might be easier to generate the plot without the y-axis and then
add you data with 'axis' using whatever tick marks you want.

On Fri, Jan 30, 2009 at 11:51 AM, Dennis Fisher fis...@plessthan.com wrote:
 Colleagues

 R 2.8.0; OS X, Vista, Ubuntu Linux

 In some instances, when I create a graphic using plot(XVAR, YVAR), it would
 be valuable to know the values that R will display on the y-axis (e.g., if
 the range of data is 0-70, it might display 0, 10, 30, 50, 70).   Is there a
 simple means to access these values?

 Also, in some instances, additional ticks appear between the displayed
 values (in this case, at 20, 40, 60).  Can I obtain the list of the
 positions of all ticks?

 Access to this information permits me to tailor the ticks and labels in a
 particular manner.

 Thanks for any suggestions.

 Dennis


 Dennis Fisher MD
 P  (The P Less Than Company)
 Phone: 1-866-PLessThan (1-866-753-7784)
 Fax: 1-415-564-2220
 www.PLessThan.com

 __
 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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] sub question

2009-01-30 Thread David Hajage
Hello R users,

I have a string, for example:
x - \t\tabc\t def

This string can contain any number of tabulations. I want to replace each
tabulation of the begining of the string by the same number of space:
  abc\t def

I'm trying to do this with gsub :
 gsub(\t,  , x) # replace every \t
[1]   abc  def
 sub(^\t,  , x) # replace only the first \t
[1]  \tabc\t def
 sub(^\t*,  , x) # replace all beginning \t, but only one space
[1]  abc\t def

How can I do this ?

Thank you very much.

david

[[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] run query using rexcel runrfile and rodbc sql query

2009-01-30 Thread BrianCBolt

Hi,
I'm using R-2.8.1 for windows.  I wrote a script calls the RODBC  
package to run sql queries against an oracle database.  It runs fine  
when run from the rconsole and returns a data.frame with a summary for  
a set of experiments.  I want to run this script using the  
rinterface.RunRFile command in an excel plugin, using the rexcel  
package.   When I run the code from my excel plugin I get an error:  
Error -2147220502 in Module RExcel.RServer   Error running expression  
eval(parse(text=source(.rexcel..hzpouai)))



Here is my excel plugin code:
rinterface.StartRServer
rinterface.RRun setwd(C:/Documents and Settings/bbolt/ 
Desktop)

ChDir C:/Documents and Settings/bbolt/Desktop
rinterface.RunRFile Script.r

It works fine if Script.r is something simple like:
Text - data.frame(Hello=Hello)

But will give me the error when Script.R is something like:
inSet - TEST853
library(RODBC)
query - function(qu){
	con -  
odbcConnect 
(Development 
,uid=username,pwd=password,believeNRows=FALSE,rows_at_time=50)

sqlQuery(con,qu)
}
qu - paste(m.parentid as SET from setmap m where m.childid in  
(select t.experiment from  experimentsets t where   
t.setname=',inSET,'),sep=)

ExperimentSet - as.character(query(qu)[,1])

The error only occurs when I call my query function.  Does anyone  
know if there is a way to run sql queries in this manner?


__
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] identifying what labels have been created in a plot

2009-01-30 Thread Marc Schwartz
on 01/30/2009 10:51 AM Dennis Fisher wrote:
 Colleagues
 
 R 2.8.0; OS X, Vista, Ubuntu Linux
 
 In some instances, when I create a graphic using plot(XVAR, YVAR), it
 would be valuable to know the values that R will display on the y-axis
 (e.g., if the range of data is 0-70, it might display 0, 10, 30, 50,
 70).   Is there a simple means to access these values?
 
 Also, in some instances, additional ticks appear between the displayed
 values (in this case, at 20, 40, 60).  Can I obtain the list of the
 positions of all ticks?
 
 Access to this information permits me to tailor the ticks and labels in
 a particular manner.
 
 Thanks for any suggestions.
 
 Dennis

See ?axis, where in the Details, it will lead you to ?axTicks

plot(c(0, 70), c(0, 70))

# Y axis tick marks
 axTicks(2)
[1]  0 10 20 30 40 50 60 70


pretty() will also get you similar information, save when using log scaling:

 pretty(c(0, 70))
[1]  0 10 20 30 40 50 60 70


Keep in mind that you can always explicitly call axis() using the 'at'
argument to specify the locations of the tick marks and labels, after
plotting something without the axes being drawn by default.

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] paste together object names to pass it on to a function

2009-01-30 Thread jim holtman
This should do it:

?[[

 gnuff-list()
 gnuff$IHD$LE-66
 gnuff$LUNG$LE -55



 nam - c(LUNG,IHD)

 x - numeric(2)  # allocate
 for(i in 1:2)
+ x[i] - gnuff[[nam[i]]]$LE / 2

 x
[1] 27.5 33.0


On Fri, Jan 30, 2009 at 12:06 PM, stefan.d...@gmail.com
stefan.d...@gmail.com wrote:
 Hello,
 I have a maybe trivial question, but I simply don't understand well
 enought how to work with text/strings:

 I have a rather compelx data structure, a big list with several
 sub-lists/dataframes and for certain calculations  (which I do in
 loops), I only need a certain group of  sub-lists/dataframes, which I
 want to specify with a name vector and paste together the object name
 and pass it on to a function.

 Here an (hopefully) instructive example

 #Data Example
 gnuff-list()
 gnuff$IHD$LE-66
 gnuff$LUNG$LE -55

 #This is the list, where I collect data for different diseases at the
 second level of the list
 #Now I want to do calcualtions just for these two diseases and the
 sub-list LE within these diseases


 nam - c(LUNG,IHD)

 for(i in 1:2)
 x[i] - paste(gnuff,nam[i],LE,sep=$) /2
 x

 #So I try to paste the name of the object which I mean
 (gnuff$IHD$LEand gnuff$LUNG$LE, respectivly), but R treats them as a
 string and not as the name of an object.
 # I tried seveal commands to make it treat like an object name (the
 get() looked most promising), but so far to no avail

 #commands I have tried
 j - eval(paste(gnuff,nam[i],LE,sep=$))
 parse(paste(gnuff,nam[i],sep=$))
 quote(paste(gnuff,nam[i],sep=$))
 get(paste(gnuff,nam[i],sep=$))

 Anybody any hints where to look?
 Thanks and have a great weekend!
 Best,
 Stefan

 __
 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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] Using Rscript

2009-01-30 Thread Philip Whittall
Dear List,

Hopefully someone will point me to a piece of documentation that I have
overlooked.
I am running Rscript successfully to read and execute an R program, but
have failed
to find the correct syntax to route the output to a file using the
Rscript command that invokes
the job. I tried Rscript -e 'sink(outputfile)' script.R , but it then
ignored the scriptfile.
I know that pipes would solve the problem in unix, but I have no idea
how the windows equivalent
works. I am running R.2.8.0 on windows,

Many thanks,

Philip
  



This message should be regarded as confidential. If you have received this 
email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by 
an authorised signatory.  The contents of this email may relate to dealings 
with other companies within the Detica Group plc group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.



[[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.


Re: [R] paste together object names to pass it on to a function

2009-01-30 Thread Patrick Burns

A rule of thumb is that if the solution seems a lot
harder than the task, there is probably a better
approach.  I think you want something like:

lapply(gnuff[nam], function(x) x$LE)


Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of The R Inferno and A Guide for the Unwilling S User)

stefan.d...@gmail.com wrote:

Hello,
I have a maybe trivial question, but I simply don't understand well
enought how to work with text/strings:

I have a rather compelx data structure, a big list with several
sub-lists/dataframes and for certain calculations  (which I do in
loops), I only need a certain group of  sub-lists/dataframes, which I
want to specify with a name vector and paste together the object name
and pass it on to a function.

Here an (hopefully) instructive example

#Data Example
gnuff-list()
gnuff$IHD$LE-66
gnuff$LUNG$LE -55

#This is the list, where I collect data for different diseases at the
second level of the list
#Now I want to do calcualtions just for these two diseases and the
sub-list LE within these diseases


nam - c(LUNG,IHD)

for(i in 1:2)
x[i] - paste(gnuff,nam[i],LE,sep=$) /2
x

#So I try to paste the name of the object which I mean
(gnuff$IHD$LEand gnuff$LUNG$LE, respectivly), but R treats them as a
string and not as the name of an object.
# I tried seveal commands to make it treat like an object name (the
get() looked most promising), but so far to no avail

#commands I have tried
j - eval(paste(gnuff,nam[i],LE,sep=$))
parse(paste(gnuff,nam[i],sep=$))
quote(paste(gnuff,nam[i],sep=$))
get(paste(gnuff,nam[i],sep=$))

Anybody any hints where to look?
Thanks and have a great weekend!
Best,
Stefan

__
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.


Re: [R] Analytics Training Institute launches course on R

2009-01-30 Thread Ajay ohri
Cool nice initiative.
Regards,

Ajay

Rodney Dangerfield  - My marriage is on the rocks again, yeah, my wife just
broke up with her boyfriend.

On Fri, Jan 30, 2009 at 9:46 PM, Analytics Training 
analyticstraining...@gmail.com wrote:

 Hi All,

 Now you can join for R course offered by G  K Analytics Training Institute
 Pvt Ltd.

 We also provide online training Program for those who are willing to take
 up
 this course.

 To know more about the courses offered visit www.analyticstraining.in

 You can also mail us your queries at i...@analyticstraining.in.

 Regards
 ATI Team

[[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.


[[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.


Re: [R] paste together object names to pass it on to a function

2009-01-30 Thread Gabor Grothendieck
Or perhaps:

lapply(gnuff, [[, LE)


On Fri, Jan 30, 2009 at 12:35 PM, Patrick Burns
pbu...@pburns.seanet.com wrote:
 A rule of thumb is that if the solution seems a lot
 harder than the task, there is probably a better
 approach.  I think you want something like:

 lapply(gnuff[nam], function(x) x$LE)


 Patrick Burns
 patr...@burns-stat.com
 +44 (0)20 8525 0696
 http://www.burns-stat.com
 (home of The R Inferno and A Guide for the Unwilling S User)

 stefan.d...@gmail.com wrote:

 Hello,
 I have a maybe trivial question, but I simply don't understand well
 enought how to work with text/strings:

 I have a rather compelx data structure, a big list with several
 sub-lists/dataframes and for certain calculations  (which I do in
 loops), I only need a certain group of  sub-lists/dataframes, which I
 want to specify with a name vector and paste together the object name
 and pass it on to a function.

 Here an (hopefully) instructive example

 #Data Example
 gnuff-list()
 gnuff$IHD$LE-66
 gnuff$LUNG$LE -55

 #This is the list, where I collect data for different diseases at the
 second level of the list
 #Now I want to do calcualtions just for these two diseases and the
 sub-list LE within these diseases


 nam - c(LUNG,IHD)

 for(i in 1:2)
 x[i] - paste(gnuff,nam[i],LE,sep=$) /2
 x

 #So I try to paste the name of the object which I mean
 (gnuff$IHD$LEand gnuff$LUNG$LE, respectivly), but R treats them as a
 string and not as the name of an object.
 # I tried seveal commands to make it treat like an object name (the
 get() looked most promising), but so far to no avail

 #commands I have tried
 j - eval(paste(gnuff,nam[i],LE,sep=$))
 parse(paste(gnuff,nam[i],sep=$))
 quote(paste(gnuff,nam[i],sep=$))
 get(paste(gnuff,nam[i],sep=$))

 Anybody any hints where to look?
 Thanks and have a great weekend!
 Best,
 Stefan

 __
 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-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] princomp - varimax - factanal

2009-01-30 Thread William Revelle

At 3:00 PM +0100 1/30/09, Alberto Maceda Veiga wrote:

Hi!

I am trying to analyse with R a database that I have previously analysed
with SPSS.

Steps with SPSS:

Factorial analysis
 Extraction options : I select = Principal component analysis
 Rotation: varimax


Unfortunately, SPSS labels principal components as a factor model. 
It is not.   So, extracting the first n factors by using factanal 
will give you a very different solution than the first n principal 
components.





Steps with R:

I have tried it with varimax function with factanal or with princomp...and
the results are different of what I have with SPSS. I think that varimax
function is incorporated in factanal function.


Does anybody know which are the instructions into R to do exactly the same
of what I have done with SPSS???


To duplicate the SPSS analysis try using the psych package.

The principal function in the psych package will extract the first n 
components (defaults to 1) and then by default rotate using varimax.


library(psych)
pc - principal(my.data,n)  #where n is the number components you 
want to extract


Let me know if this matches the SPSS output.

Bill










Thank you very much!

[[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.



--
William Revelle http://personality-project.org/revelle.html
Professor   http://personality-project.org/personality.html
Department of Psychology http://www.wcas.northwestern.edu/psych/
Northwestern University http://www.northwestern.edu/
Attend  ISSID/ARP:2009   http://issid.org/issid.2009/

__
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] bootstrapping in regression

2009-01-30 Thread Stephan Kolassa

Hi Thomas,

Thomas Mang schrieb:


I have a question here: I am not sure if I understand your 'fit the full 
model ... to the permuted data set'. Am I correct to suppose that once 
the residuals of the reduced-model fit have been permuted and added back 
to the fitted values, the values obtained this way (fitted + permuted 
residuals) now constitute the new y-values to which the full model is 
fitted? Is that correct ?


It is. Look at section 2.2, Permutation of Residuals under the Reduced 
Model here:


Anderson, M. J.  Legendre, P. An empirical comparison of permutation 
methods for tests of partial regression coefficients in a linear model. 
Journal of Statistical Computation and Simulation, 1999, 62, 271-303



Do you know if this procedure is also valid for a mixed-effects model ?


That's a good question... if you find out anything about this, please 
let me know.


HTH,
Stephan

__
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] Matlab inv() and R solve() differences

2009-01-30 Thread Stephan Kolassa

Hi Cleber,

there is no hard-and-fast magic number here. Ill-conditioning also 
depends on what you are trying to do (inference? prediction?). The 
condition number is only one of a number of conditioning/collinearity 
diagnostics commonly used. Take a look at:


Golub, G. H.,  Van Loan, C. F. (1996). Matrix Computations (3rd ed.). 
Baltimore: Johns Hopkins University Press.


Belsley, D. A. (1991a). Conditioning Diagnostics: Collinearity and Weak 
Data in Regression. New York, NY: Wiley.


Hill, R. C.,  Adkins, L. C. (2001). Collinearity. In B. H. Baltagi 
(Ed.), A Companion to Theoretical Econometrics (p. 256-278). Oxford: 
Blackwell


HTH,
Stephan


Cleber Nogueira Borges schrieb:

Hello,

is there a upper limit to kappa value where I can consider a matrix 
well-conditioned?



Cleber



Kingsford Jones wrote:

I suppose the solution is unstable because x is ill-conditioned:

 

x


   [,1]   [,2]   [,3]  [,4]
[1,]  0.133  0.254 -0.214 0.116
[2,]  0.254  0.623 -0.674 0.139
[3,] -0.214 -0.674  0.910 0.011
[4,]  0.116  0.139  0.011 0.180
 

cor(x)


   [,1]   [,2]   [,3]   [,4]
[1,]  1.000  0.9963557 -0.9883690  0.8548065
[2,]  0.9963557  1.000 -0.9976663  0.8084090
[3,] -0.9883690 -0.9976663  1.000 -0.7663847
[4,]  0.8548065  0.8084090 -0.7663847  1.000

 

kappa(x)


[1] 2813.326

hth,

Kingsford Jones

On Thu, Jan 29, 2009 at 7:00 PM, Joseph P Gray jpg...@uwm.edu wrote:
 

I submit the following matrix to both MATLAB and R

x=  0.133 0.254 -0.214 0.116
   0.254 0.623 -0.674 0.139
  -0.214 -0.674 0.910 0.011
   0.116 0.139  0.011 0.180

MATLAB's inv(x) provides the following
 137.21 -50.68 -4.70 -46.42
-120.71  27.28 -8.94 62.19
-58.15   6.93  -7.89  36.94
 8.35   11.17 10.42 -14.82

R's solve(x) provides:
261.94 116.22 150.92 -267.78
116.22 344.30 286.68 -358.30
150.92 286.68 252.96 -334.09
-267.78 =358.30 -334.09 475.22

inv(x)*x = I(4)
and solve(x)%*%x = I(4)

Is there a way to obtain the MATLAB result in R?

Thanks for any help.


Pat Gray

__



__
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.


Re: [R] princomp - varimax - factanal

2009-01-30 Thread Alberto Maceda Veiga
Thank you very much Bill!!!  We get it. The results are the same.

Best wishes,

Alberto



2009/1/30 William Revelle li...@revelle.net

 At 3:00 PM +0100 1/30/09, Alberto Maceda Veiga wrote:

 Hi!

 I am trying to analyse with R a database that I have previously analysed
 with SPSS.

 Steps with SPSS:

 Factorial analysis
  Extraction options : I select = Principal component analysis
  Rotation: varimax


 Unfortunately, SPSS labels principal components as a factor model. It is
 not.   So, extracting the first n factors by using factanal will give you a
 very different solution than the first n principal components.



 Steps with R:

 I have tried it with varimax function with factanal or with princomp...and
 the results are different of what I have with SPSS. I think that varimax
 function is incorporated in factanal function.


 Does anybody know which are the instructions into R to do exactly the same
 of what I have done with SPSS???


 To duplicate the SPSS analysis try using the psych package.

 The principal function in the psych package will extract the first n
 components (defaults to 1) and then by default rotate using varimax.

 library(psych)
 pc - principal(my.data,n)  #where n is the number components you want to
 extract

 Let me know if this matches the SPSS output.

 Bill









 Thank you very much!

[[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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



 --
 William Revelle http://personality-project.org/revelle.html
 Professor
 http://personality-project.org/personality.html
 Department of Psychology
 http://www.wcas.northwestern.edu/psych/
 Northwestern University http://www.northwestern.edu/
 Attend  ISSID/ARP:2009   http://issid.org/issid.2009/


 __
 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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Alberto Maceda Veiga
Departamento de Biología Animal
Vertebrados. 1ª Planta. Despacho 151.
Facultad de Biología
Universidad de Barcelona
Av. Diagonal, 645
08028 Barcelona
Spain
Tel: 93 4021041
Fax: 93 4034426
Email: albertomac...@gmail.com
º  º  º

[[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.


Re: [R] paste together object names to pass it on to a function

2009-01-30 Thread David Winsemius

Perhaps this will help:

#Data Example
gnuff-list()
gnuff$IHD$LE-66
gnuff$LUNG$LE -55

#This is the list, where I collect data for different diseases at the
#second level of the list
#Now I want to do calcualtions just for these two diseases and the
#sub-list LE within these diseases

nam - c(LUNG,IHD)

for(i in nam) print(gnuff[[i]])  # use the elements of nam as the  
index values


# the lack of output from an evaluation done within the for-loop might  
be one of Burns' Infernal examples.

# here's see one of my mistakes:   for(i in nam) (gnuff[[i]])
#---returns a list---
#$LE
#[1] 55

#$LE
#[1] 66

#---
 for(i in nam) print(gnuff[[i]]$LE)  #use list extraction to get the  
values

#[1] 55
#[1] 66



On Jan 30, 2009, at 12:06 PM, stefan.d...@gmail.com wrote:


Hello,
I have a maybe trivial question, but I simply don't understand well
enought how to work with text/strings:

I have a rather compelx data structure, a big list with several
sub-lists/dataframes and for certain calculations  (which I do in
loops), I only need a certain group of  sub-lists/dataframes, which I
want to specify with a name vector and paste together the object name
and pass it on to a function.

Here an (hopefully) instructive example

#Data Example
gnuff-list()
gnuff$IHD$LE-66
gnuff$LUNG$LE -55

#This is the list, where I collect data for different diseases at the
second level of the list
#Now I want to do calcualtions just for these two diseases and the
sub-list LE within these diseases


nam - c(LUNG,IHD)

for(i in 1:2)
x[i] - paste(gnuff,nam[i],LE,sep=$) /2
x

#So I try to paste the name of the object which I mean
(gnuff$IHD$LEand gnuff$LUNG$LE, respectivly), but R treats them as a
string and not as the name of an object.
# I tried seveal commands to make it treat like an object name (the
get() looked most promising), but so far to no avail

#commands I have tried
j - eval(paste(gnuff,nam[i],LE,sep=$))
parse(paste(gnuff,nam[i],sep=$))
quote(paste(gnuff,nam[i],sep=$))
get(paste(gnuff,nam[i],sep=$))

Anybody any hints where to look?
Thanks and have a great weekend!
Best,
Stefan

__
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] Fitted values and residuals from glmmPQL (MASS package)

2009-01-30 Thread Roberto Patuelli
Dear All,

I would like to analyse the residuals from a generalized linear mixed model 
(GLMM) that I estimated, with random effects, by means of the command glmmPQL, 
from the MASS package.

It is not very clear to me what the actual residuals to analyse are (Y - Yhat): 
I obtain two columns of residuals, of which the first are population residuals, 
and the second refer to the grouping used in the random effects. Which of the 
two (or which combination of the two) are my actual errors?
Working the problem through the fitted values creates the same confusion to me, 
as I also have two columns of fitted values.

There's probably something about the way mixed models are treated in R that I'm 
not catching here...
Can someone help me?

Thanks and best regards,
Roberto Patuelli


Roberto Patuelli, Ph.D.
Post-doc researcher
Institute for Economic Research (IRE)
University of Lugano
via Maderno 24, CP 4361
CH-6904 Lugano
Switzerland
Phone: +41-(0)58-666-4166
Fax: +39-02-700419665
Email: roberto.patue...@lu.unisi.ch
Homepage: http://www.people.lu.unisi.ch/patuellr

[[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.


Re: [R] identifying what labels have been created in a plot

2009-01-30 Thread David Winsemius
You might want to look at the pretty function. The code that I have  
seen often calls that function for the creation of axis tick levels  
with min and max as arguments. And its help page suggests that axTicks  
may give you exactly what you were seeking.


--
David Winsemius

On Jan 30, 2009, at 11:51 AM, Dennis Fisher wrote:


Colleagues

R 2.8.0; OS X, Vista, Ubuntu Linux

In some instances, when I create a graphic using plot(XVAR, YVAR),  
it would be valuable to know the values that R will display on the y- 
axis (e.g., if the range of data is 0-70, it might display 0, 10,  
30, 50, 70).   Is there a simple means to access these values?


Also, in some instances, additional ticks appear between the  
displayed values (in this case, at 20, 40, 60).  Can I obtain the  
list of the positions of all ticks?


Access to this information permits me to tailor the ticks and labels  
in a particular manner.


Thanks for any suggestions.

Dennis


Dennis Fisher MD
P  (The P Less Than Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com

__
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.


Re: [R] sub question

2009-01-30 Thread Wacek Kusnierczyk
David Hajage wrote:
 Hello R users,

 I have a string, for example:
 x - \t\tabc\t def

 This string can contain any number of tabulations. I want to replace each
 tabulation of the begining of the string by the same number of space:
   abc\t def

 I'm trying to do this with gsub :
   
 gsub(\t,  , x) # replace every \t
 
 [1]   abc  def
   
 sub(^\t,  , x) # replace only the first \t
 
 [1]  \tabc\t def
   
 sub(^\t*,  , x) # replace all beginning \t, but only one space
 
 [1]  abc\t def

 How can I do this ?

   

there may be better solutions, but this should do:

strings = c('pure', '\t- 1 removed', '\t\t- 2 removed, 1 left -\t')
gsub('\t|(*COMMIT)(*FAIL)', ' ', strings, perl=TRUE)
# pure  - 1 removed   - 2 removed, 1 left -\t

vQ

__
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] Fitted values and residuals from glmmPQL (MASS package)

2009-01-30 Thread Prof Brian Ripley
glmmPQL is a wrapper for lme, so look at its documentation (and the 
especially the Pinheiro-Bates book).


On Fri, 30 Jan 2009, Roberto Patuelli wrote:


Dear All,

I would like to analyse the residuals from a generalized linear mixed model 
(GLMM) that I estimated, with random effects, by means of the command glmmPQL, 
from the MASS package.

It is not very clear to me what the actual residuals to analyse are (Y - Yhat): 
I obtain two columns of residuals, of which the first are population residuals, 
and the second refer to the grouping used in the random effects. Which of the 
two (or which combination of the two) are my actual errors?
Working the problem through the fitted values creates the same confusion to me, 
as I also have two columns of fitted values.

There's probably something about the way mixed models are treated in R that I'm 
not catching here...
Can someone help me?

Thanks and best regards,
Roberto Patuelli


Roberto Patuelli, Ph.D.
Post-doc researcher
Institute for Economic Research (IRE)
University of Lugano
via Maderno 24, CP 4361
CH-6904 Lugano
Switzerland
Phone: +41-(0)58-666-4166
Fax: +39-02-700419665
Email: roberto.patue...@lu.unisi.ch
Homepage: http://www.people.lu.unisi.ch/patuellr

[[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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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] Using Rscript

2009-01-30 Thread Prof Brian Ripley

You use the facilities of your command-line shell.

Rscript infile.R  outfile

works in every one I have seen in recent years, including Windows' 
cmd.exe (although many people prefer more capable shells on that 
platform such as tcsh or bash).


On Fri, 30 Jan 2009, Philip Whittall wrote:


Dear List,

Hopefully someone will point me to a piece of documentation that I have
overlooked.
I am running Rscript successfully to read and execute an R program, but
have failed
to find the correct syntax to route the output to a file using the
Rscript command that invokes
the job. I tried Rscript -e 'sink(outputfile)' script.R , but it then
ignored the scriptfile.
I know that pipes would solve the problem in unix, but I have no idea
how the windows equivalent
works. I am running R.2.8.0 on windows,

Many thanks,

Philip




This message should be regarded as confidential. If you have received this 
email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by 
an authorised signatory.  The contents of this email may relate to dealings 
with other companies within the Detica Group plc group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.



[[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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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.


[R] help with time series

2009-01-30 Thread Steve_Friedman

Hello everyone


I'm working with R 2.8.1 on a windows  machine

I have a question regarding time series analysis

The first question is how does R expect the input file to be structured?
I'm working with a *.txt file similar to the abbreviated one here:

Date,stage
4/2/1953,7.56
4/3/1953,7.56
4/4/1953,7.54
4/5/1953,7.53
4/6/1953,7.5
4/7/1953,7.47
4/8/1953,7.44
4/9/1953,7.41
4/10/1953,7.37
4/11/1953,7.33
4/12/1953,7.3
4/13/1953,7.26
4/14/1953,7.28
4/15/1953,7.28
4/16/1953,7.23
4/17/1953,7.47
4/18/1953,7.59
4/19/1953,7.58
4/20/1953,7.57
4/21/1953,7.56
4/22/1953,7.55
4/23/1953,7.53
4/24/1953,7.51
4/25/1953,7.48
4/26/1953,7.46
4/27/1953,7.5
4/28/1953,7.56

The data record is substantially longer - 50 years worth of daily
hydrologic water stage data  (column 2).

R seems to get confused by the format of this input not knowing what to do
with the date field, and also deciding to treat everything as a level.

I'm reading the data as follows:

mystage - read.table(C:\\Documents and
Settings\\skfriedman\\Desktop\\R-scripts\\stage.txt, header = TRUE)

looking at the data  I get the following:

 mystage[1:4,]
[1] 4/2/1953,7.56 4/3/1953,7.56 4/4/1953,7.54 4/5/1953,7.53
20195 Levels: 1/1/1954,8.72 1/1/1955,8.48 1/1/1956,7.94 1/1/1957,7.88
1/1/1958,8.5 ... 9/9/2007,8.84


What I'd like is a time series  with a starting data of April 21, 1953.
ending December 30, 2008.  data are daily records, so the frequency should
be 365 (?) not counting leap year nuisances.

So the first question is how should I build the input file to correctly
import it to a time series with an odd beginning date?

The analysis I'm really trying to get to will involve calculating the mean
monthly stage, the mean seasonal (aggregated over several months) stage,
the annual maximum period with a continuous stage greater than 0.

Thanks in advance I will summary solutions.

Much appreciated

Steve

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

__
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 with time series

2009-01-30 Thread Mike Lawrence
To seperate the columns, use the sep argument in read.table()

mystage - read.table(C:\\Documents and
Settings\\skfriedman\\Desktop\\R-scripts\\stage.txt, header =
TRUE,sep=',')

On Fri, Jan 30, 2009 at 4:17 PM,  steve_fried...@nps.gov wrote:

 Hello everyone


 I'm working with R 2.8.1 on a windows  machine

 I have a question regarding time series analysis

 The first question is how does R expect the input file to be structured?
 I'm working with a *.txt file similar to the abbreviated one here:

 Date,stage
 4/2/1953,7.56
 4/3/1953,7.56
 4/4/1953,7.54
 4/5/1953,7.53
 4/6/1953,7.5
 4/7/1953,7.47
 4/8/1953,7.44
 4/9/1953,7.41
 4/10/1953,7.37
 4/11/1953,7.33
 4/12/1953,7.3
 4/13/1953,7.26
 4/14/1953,7.28
 4/15/1953,7.28
 4/16/1953,7.23
 4/17/1953,7.47
 4/18/1953,7.59
 4/19/1953,7.58
 4/20/1953,7.57
 4/21/1953,7.56
 4/22/1953,7.55
 4/23/1953,7.53
 4/24/1953,7.51
 4/25/1953,7.48
 4/26/1953,7.46
 4/27/1953,7.5
 4/28/1953,7.56

 The data record is substantially longer - 50 years worth of daily
 hydrologic water stage data  (column 2).

 R seems to get confused by the format of this input not knowing what to do
 with the date field, and also deciding to treat everything as a level.

 I'm reading the data as follows:

 mystage - read.table(C:\\Documents and
 Settings\\skfriedman\\Desktop\\R-scripts\\stage.txt, header = TRUE)

 looking at the data  I get the following:

  mystage[1:4,]
 [1] 4/2/1953,7.56 4/3/1953,7.56 4/4/1953,7.54 4/5/1953,7.53
 20195 Levels: 1/1/1954,8.72 1/1/1955,8.48 1/1/1956,7.94 1/1/1957,7.88
 1/1/1958,8.5 ... 9/9/2007,8.84


 What I'd like is a time series  with a starting data of April 21, 1953.
 ending December 30, 2008.  data are daily records, so the frequency should
 be 365 (?) not counting leap year nuisances.

 So the first question is how should I build the input file to correctly
 import it to a time series with an odd beginning date?

 The analysis I'm really trying to get to will involve calculating the mean
 monthly stage, the mean seasonal (aggregated over several months) stage,
 the annual maximum period with a continuous stage greater than 0.

 Thanks in advance I will summary solutions.

 Much appreciated

 Steve

 Steve Friedman Ph. D.
 Spatial Statistical Analyst
 Everglades and Dry Tortugas National Park
 950 N Krome Ave (3rd Floor)
 Homestead, Florida 33034

 steve_fried...@nps.gov
 Office (305) 224 - 4282
 Fax (305) 224 - 4147

 __
 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.




-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University
www.thatmike.com

Looking to arrange a meeting? Check my public calendar:
http://www.thatmike.com/mikes-public-calendar

~ Certainty is folly... I think. ~

__
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 with time series

2009-01-30 Thread Gabor Grothendieck
Copy and paste this into an R session:

Lines - Date,stage
4/2/1953,7.56
4/3/1953,7.56
4/4/1953,7.54
4/5/1953,7.53
4/6/1953,7.5
4/7/1953,7.47
4/8/1953,7.44
4/9/1953,7.41
4/10/1953,7.37
4/11/1953,7.33
4/12/1953,7.3
4/13/1953,7.26
4/14/1953,7.28
4/15/1953,7.28
4/16/1953,7.23
4/17/1953,7.47
4/18/1953,7.59
4/19/1953,7.58
4/20/1953,7.57
4/21/1953,7.56
4/22/1953,7.55
4/23/1953,7.53
4/24/1953,7.51
4/25/1953,7.48
4/26/1953,7.46
4/27/1953,7.5
4/28/1953,7.56

library(zoo)
library(chron)
# z - read.zoo(myfile.csv, header = TRUE, sep = ,, FUN = as.chron)
z - read.zoo(textConnection(Lines), header = TRUE, sep = ,, FUN = as.chron)
plot(z)



On Fri, Jan 30, 2009 at 3:17 PM,  steve_fried...@nps.gov wrote:

 Hello everyone


 I'm working with R 2.8.1 on a windows  machine

 I have a question regarding time series analysis

 The first question is how does R expect the input file to be structured?
 I'm working with a *.txt file similar to the abbreviated one here:

 Date,stage
 4/2/1953,7.56
 4/3/1953,7.56
 4/4/1953,7.54
 4/5/1953,7.53
 4/6/1953,7.5
 4/7/1953,7.47
 4/8/1953,7.44
 4/9/1953,7.41
 4/10/1953,7.37
 4/11/1953,7.33
 4/12/1953,7.3
 4/13/1953,7.26
 4/14/1953,7.28
 4/15/1953,7.28
 4/16/1953,7.23
 4/17/1953,7.47
 4/18/1953,7.59
 4/19/1953,7.58
 4/20/1953,7.57
 4/21/1953,7.56
 4/22/1953,7.55
 4/23/1953,7.53
 4/24/1953,7.51
 4/25/1953,7.48
 4/26/1953,7.46
 4/27/1953,7.5
 4/28/1953,7.56

 The data record is substantially longer - 50 years worth of daily
 hydrologic water stage data  (column 2).

 R seems to get confused by the format of this input not knowing what to do
 with the date field, and also deciding to treat everything as a level.

 I'm reading the data as follows:

 mystage - read.table(C:\\Documents and
 Settings\\skfriedman\\Desktop\\R-scripts\\stage.txt, header = TRUE)

 looking at the data  I get the following:

  mystage[1:4,]
 [1] 4/2/1953,7.56 4/3/1953,7.56 4/4/1953,7.54 4/5/1953,7.53
 20195 Levels: 1/1/1954,8.72 1/1/1955,8.48 1/1/1956,7.94 1/1/1957,7.88
 1/1/1958,8.5 ... 9/9/2007,8.84


 What I'd like is a time series  with a starting data of April 21, 1953.
 ending December 30, 2008.  data are daily records, so the frequency should
 be 365 (?) not counting leap year nuisances.

 So the first question is how should I build the input file to correctly
 import it to a time series with an odd beginning date?

 The analysis I'm really trying to get to will involve calculating the mean
 monthly stage, the mean seasonal (aggregated over several months) stage,
 the annual maximum period with a continuous stage greater than 0.

 Thanks in advance I will summary solutions.

 Much appreciated

 Steve

 Steve Friedman Ph. D.
 Spatial Statistical Analyst
 Everglades and Dry Tortugas National Park
 950 N Krome Ave (3rd Floor)
 Homestead, Florida 33034

 steve_fried...@nps.gov
 Office (305) 224 - 4282
 Fax (305) 224 - 4147

 __
 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] Anova and a covariate of no interest

2009-01-30 Thread Patrick Bédard
Hi,

I have a design with 1 group and repeated measures and a covariate whose
effects
I¹d like to remove from the data. I tried different models with aov but am
not sure if I did it correctly. The design is thus 4 blocks and n=15 and a
covariate ³cov²

1- aov.m = aov(da~block+cov+Error(subj),data=d); summary(aov.m)
Error: subj
  Df  Sum Sq Mean Sq F value Pr(F)
cov1 0.37859 0.37859   2.709 0.1237
Residuals 13 1.81677 0.13975

Error: Within
  Df  Sum Sq Mean Sq F valuePr(F)
block  3 0.89600 0.29867 10.7536 2.413e-05 ***
cov1 0.00030 0.00030  0.01090.9173
Residuals 41 1.13872 0.02777

Did I did set it up right??

Could I use lm and /or lme to get the covariate out.  What would be the
formula??

Thanks for your help


__ 
Patrick Bédard Ph.D.
Dept. of Neuroscience
Brown University



[[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] problem using identify() after plot()

2009-01-30 Thread Christopher W. Ryan
I can't seem to use the point-and-click identify() function properly.
I'm running R 2.5.1 (I know, I need to get around to upgrading) under
Win XP. The problem is, when I click on a point on the graph, I get an
error, no point within 0.25 inches. But in some areas, I can click
where there is no visible point anywhere close, and an identify() label
will pop up. The troublesome code is shown below.  I've posted an
example graph here:

http://bingweb.binghamton.edu/~cryan/junkidentify2.pdf

I'd be grateful if anyone could take a look at it. The text() labels are
in red, and the results of pointing-and-clicking are shown in black.
Notice point 4, for example: near the origin in black, but upper center
in red (which is where the real data point should be: point 4 is (11,16)

Any chance all the NA's are the problem?

plot(V2,mean.barr, type=n)
text(V2, mean.barr, label=rownames(temp), col=red)
identify(rownames(temp))
# here's the gist of the data
str(temp)
summary(temp)
rownames(temp)
temp

   mean.barr V2
1 NA  6
2 NA  1
3   12.5  6
4   16.0 11
5   11.0  4
6   12.0  0
7 NA  4
8 NA  5
9 NA  2
10NA  3
11  16.5 11
12  14.5  8
13NA  1
14   7.5  4
15  12.5  1
16  20.0  0
17NA 10
18  17.0 11
19NA  0
20   8.5  5
21  10.5  8
22  12.0  5
23   5.0  1
24   8.5  7
25NA 19
26  12.0  0
27NA  2
28NA  0
29  12.5  5
30  18.0 10
31  16.5 20
32  16.5 19
33   9.0  4
34   9.5  4
35   7.0  1
36   8.0  4
37   8.5 13
38  18.5 13
39   9.0  9
40  11.0  1
41   4.0  7
42  11.5 26
43   3.5 12
44   8.5 12
45  10.0 15
46  11.0  5

Thanks

--Chris
-- 
Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
40 Arch Street, Johnson City, NY  13790
cryanatbinghamtondotedu
PGP public keys available at http://home.stny.rr.com/ryancw/

If you want to build a ship, don't drum up the men to gather wood,
divide the work and give orders. Instead, teach them to yearn for the
vast and endless sea.  [Antoine de St. Exupery]

__
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] Ancova

2009-01-30 Thread Patrick Bédard
Hello,

I have the following ancova:
my_ancova = aov(x~a+b)

How do I obtain the means of b once the covariate a has been removed?

thanks

__ 
Patrick Bédard Ph.D.
Dept. of Neuroscience
Brown University



[[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] reshape with two time variables

2009-01-30 Thread Neil Stewart
I have a data frame in wide format that I'd like to convert to long format.
For example, in wide format I have:

id  A1B1A1B2A2B1A2B2
1   1   400 475 420 510
2   2   390 500 470 472
3   3   428 512 555 610
4   4   703 787 801 822
5   5   611 634 721 705
6   6   543 522 612 788
7   7   411 488 506 623
8   8   654 644 711 795

A is one repeated-measures variable with levels 1 and 2. B is a second
repeated-measures variable also with levels 1 and 2. I'd like to end up
with:

id  A   B   value
1   1   1   1   400
2   2   1   1   390
3   3   1   1   428
4   4   1   1   703
5   5   1   1   611
6   6   1   1   543
7   7   1   1   411
8   8   1   1   654
9   1   1   2   475
10  2   1   2   500
11  3   1   2   512
12  4   1   2   787
13  5   1   2   634
14  6   1   2   522
15  7   1   2   488
16  8   1   2   644
17  1   2   1   420
18  2   2   1   470
19  3   2   1   555
20  4   2   1   801
21  5   2   1   721
22  6   2   1   612
23  7   2   1   506
24  8   2   1   711
25  1   2   2   510
26  2   2   2   472
27  3   2   2   610
28  4   2   2   822
29  5   2   2   705
30  6   2   2   788
31  7   2   2   623
32  8   2   2   795

I've been working with reshape and with the reshape package, but with no
success for the two-time-variable case. Can anyone help please?

__
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] Ancova

2009-01-30 Thread John Fox
Dear Patrick,

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
 Behalf Of Patrick B é dard
 Sent: January-30-09 6:31 PM
 To: r-help@r-project.org
 Subject: [R] Ancova
 
 Hello,
 
 I have the following ancova:
 my_ancova = aov(x~a+b)
 
 How do I obtain the means of b once the covariate a has been removed?

One way is to use the function effect() in the effects package:

   effect(b, my_ancova)

which will give you the adjusted means for x at the levels of b with a set
to its overall mean.

I hope this helps,
 John

 
 thanks
 
 __
 Patrick Bidard Ph.D.
 Dept. of Neuroscience
 Brown University
 
 
 
   [[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.


Re: [R] non-interactive connection to SQL Server

2009-01-30 Thread jt123

Moshe,

Thanks so much for the added comment, I had fallen into the exact same
little syntax pitfall.
Your clarification really helped!

Jack



Moshe Olshansky-2 wrote:
 
 Yes, it does - thank you!
 The only thing I forgot (and it took me a while to
 find this out) was to separate the fields by
 semicolon, i.e. the correct command is:
 
 odbcDriverConnect(driver=SQL Server;
 database=dataBaseName; wsid=myComputer;
 server=dataBaseServer; uid=moshe; pwd=moshe)
 
 --- Prof Brian Ripley rip...@stats.ox.ac.uk wrote:
 
 On Wed, 13 Feb 2008, Moshe Olshansky wrote:
 
  Hi everyone,
 
  I am afraid that I have already asked this
 question in
  the past (or at least I knew an answer to it) but
 I am
  unable to do it now.
  I have an SQL Server data base. I used the GUI
  interface of odbcDriverConnect to create a .dsn
 file
  for this data base and every time I want to
 connect I
  invoke odbcDriverConnect() which opens GUI from
 which
  I choose my .dsn file and the connection is
  established.
  Now I want to do this automatically (without GUI)
 and
  all my attempts fail. If I remember correctly the
 dsn
  must be a string containing all the connection
 details
  but it does not work for me.
 
 Clearly it does, as you did that via
 odbcDriverConnect.  Look at the 
 object it returns: it contains the string it used. 
 You can use that 
 directly.
 
 
  Could anybody help, please!
 
  Thank you!
  Moshe.
 
  __
  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.
 
 
 -- 
 Brian D. Ripley, 
 rip...@stats.ox.ac.uk
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/non-interactive-connection-to-SQL-Server-tp15474256p21758234.html
Sent from the R help mailing list archive at Nabble.com.

__
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] reshape with two time variables

2009-01-30 Thread hadley wickham
On Fri, Jan 30, 2009 at 5:57 PM, Neil Stewart
neil.stew...@warwick.ac.uk wrote:
 I have a data frame in wide format that I'd like to convert to long format.
 For example, in wide format I have:

id  A1B1A1B2A2B1A2B2
 1   1   400 475 420 510
 2   2   390 500 470 472
 3   3   428 512 555 610
 4   4   703 787 801 822
 5   5   611 634 721 705
 6   6   543 522 612 788
 7   7   411 488 506 623
 8   8   654 644 711 795

 A is one repeated-measures variable with levels 1 and 2. B is a second
 repeated-measures variable also with levels 1 and 2. I'd like to end up
 with:

id  A   B   value
 1   1   1   1   400
 2   2   1   1   390
 3   3   1   1   428
 4   4   1   1   703
 5   5   1   1   611
 6   6   1   1   543
 7   7   1   1   411
 8   8   1   1   654
 9   1   1   2   475
 10  2   1   2   500
 11  3   1   2   512
 12  4   1   2   787
 13  5   1   2   634
 14  6   1   2   522
 15  7   1   2   488
 16  8   1   2   644
 17  1   2   1   420
 18  2   2   1   470
 19  3   2   1   555
 20  4   2   1   801
 21  5   2   1   721
 22  6   2   1   612
 23  7   2   1   506
 24  8   2   1   711
 25  1   2   2   510
 26  2   2   2   472
 27  3   2   2   610
 28  4   2   2   822
 29  5   2   2   705
 30  6   2   2   788
 31  7   2   2   623
 32  8   2   2   795

 I've been working with reshape and with the reshape package, but with no
 success for the two-time-variable case. Can anyone help please?

If you're using melt from the reshape package, once you've melted the
data, you'll need to do something like:

m$a - as.numeric(substr(m$variable, 1, 1))
m$b - as.numeric(substr(m$variable, 3, 3))
m$variable - NULL

Hadley


-- 
http://had.co.nz/

__
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] reshape with two time variables

2009-01-30 Thread jim holtman
This will work:

 x - read.table(textConnection( id  A1B1A1B2A2B1A2B2
+ 1   1   400 475 420 510
+ 2   2   390 500 470 472
+ 3   3   428 512 555 610
+ 4   4   703 787 801 822
+ 5   5   611 634 721 705
+ 6   6   543 522 612 788
+ 7   7   411 488 506 623
+ 8   8   654 644 711 795), header=TRUE)
 closeAllConnections()
 require(reshape)
 x.m - melt(x, id='id')
 x.m$A - sub(A(\\d+).*, \\1, x.m$variable, perl=TRUE)
 x.m$B - sub(.*B(\\d+), \\1, x.m$variable, perl=TRUE)
 x.m$variable - NULL
 x.m
   id value A B
1   1   400 1 1
2   2   390 1 1
3   3   428 1 1
4   4   703 1 1
5   5   611 1 1
6   6   543 1 1
7   7   411 1 1
8   8   654 1 1
9   1   475 1 2
10  2   500 1 2
11  3   512 1 2
12  4   787 1 2
13  5   634 1 2
14  6   522 1 2
15  7   488 1 2
16  8   644 1 2
17  1   420 2 1
18  2   470 2 1
19  3   555 2 1
20  4   801 2 1
21  5   721 2 1
22  6   612 2 1
23  7   506 2 1
24  8   711 2 1
25  1   510 2 2
26  2   472 2 2
27  3   610 2 2
28  4   822 2 2
29  5   705 2 2
30  6   788 2 2
31  7   623 2 2
32  8   795 2 2


On Fri, Jan 30, 2009 at 6:57 PM, Neil Stewart
neil.stew...@warwick.ac.uk wrote:
 I have a data frame in wide format that I'd like to convert to long format.
 For example, in wide format I have:

id  A1B1A1B2A2B1A2B2
 1   1   400 475 420 510
 2   2   390 500 470 472
 3   3   428 512 555 610
 4   4   703 787 801 822
 5   5   611 634 721 705
 6   6   543 522 612 788
 7   7   411 488 506 623
 8   8   654 644 711 795

 A is one repeated-measures variable with levels 1 and 2. B is a second
 repeated-measures variable also with levels 1 and 2. I'd like to end up
 with:

id  A   B   value
 1   1   1   1   400
 2   2   1   1   390
 3   3   1   1   428
 4   4   1   1   703
 5   5   1   1   611
 6   6   1   1   543
 7   7   1   1   411
 8   8   1   1   654
 9   1   1   2   475
 10  2   1   2   500
 11  3   1   2   512
 12  4   1   2   787
 13  5   1   2   634
 14  6   1   2   522
 15  7   1   2   488
 16  8   1   2   644
 17  1   2   1   420
 18  2   2   1   470
 19  3   2   1   555
 20  4   2   1   801
 21  5   2   1   721
 22  6   2   1   612
 23  7   2   1   506
 24  8   2   1   711
 25  1   2   2   510
 26  2   2   2   472
 27  3   2   2   610
 28  4   2   2   822
 29  5   2   2   705
 30  6   2   2   788
 31  7   2   2   623
 32  8   2   2   795

 I've been working with reshape and with the reshape package, but with no
 success for the two-time-variable case. Can anyone help please?

 __
 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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] Extracting coordinates for cluster::clusplot()

2009-01-30 Thread Michael Kubovy
Dear Friends,

require(cluster)
x - rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)),  
cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)))
plot(pp - pam(x, 2), which.plots = 1)

How can I extract the coordinates used in the plot?

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
Postal Address:
P.O.Box 400400, Charlottesville, VA 22904-4400
Express Parcels Address:
Gilmer Hall, Room 102, McCormick Road, Charlottesville, VA 22903
Office:B011;Phone: +1-434-982-4729
Lab:B019;   Phone: +1-434-982-4751
WWW:http://www.people.virginia.edu/~mk9y/
Skype name: polyurinsane





[[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] OT :Interview with the CEO , REvolution Computing : Commercial R launched

2009-01-30 Thread Ajay ohri
Dear List,
Please find an interview with Richard Schultz, CEO REvolution Computing.
REvolution Computing just launched their latest product, commercial as well
as enterprise versions of R which include service contracts and tech
support.

The interview is viewable at
http://www.decisionstats.com/2009/01/interviewrichard-schultz-ceo-revolution-computing/(
and if site is slow..it is :) also at
www.smartdatacollective.com

Best Wishes,

Ajay
Delhi,India
www.decisionstats.com

[[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] Corrected Links: OT :Interview with the CEO , REvolution Computing : Commercial R launched

2009-01-30 Thread Ajay ohri
Corrected Links

 Dear List,
 Please find an interview with Richard Schultz, CEO REvolution Computing.
 REvolution Computing just launched their latest product, commercial as well
 as enterprise versions of R which include service contracts and tech
 support.

 The interview is viewable at
 http://www.decisionstats.com/2009/01/interviewrichard-schultz-ceo-revolution-computing/



 Best Wishes,

 Ajay
 Delhi,India
 www.decisionstats.com


[[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.


Re: [R] Accessing R as a Web service (UNCLASSIFIED)

2009-01-30 Thread Martin Morgan
Neiderer, Andrew (Civ, ARL/CISD) neide...@arl.army.mil writes:

 Classification:  UNCLASSIFIED 
 Caveats: NONE
  
 I am new to R and somewhat to Web server programming.  
 I am a Java programmer, however, and have done quite a bit with X3D
 (extensible 3D) computer graphics.

 A statistician that I work with is doing multidimensional scaling (MDS) and
 provides some x,y,z's which I display using X3D.
 Currently he is using Permap which more than gets the job done but is
 written in Visual Basic (I believe).  I think it would be a big job to use
 Permap as a Web service.  So I am looking at R (for other reasons as well).

 My question is -
 Can I access R via SOAP, e.g., running on a server.  Assuming I worded my
 question correctly and someone understands my question, please provide URLs
 . so I can get knowledgeable.

See RWebServices, which allows construction of SOAP-based web service
wrappers around R. Martin

 Thank you.

 - Andrew M. Neiderer

  
 Classification:  UNCLASSIFIED 
 Caveats: NONE
 __
 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.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793

__
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] Accessing R as a Web service (UNCLASSIFIED)

2009-01-30 Thread Roy Mendelssohn

Also look at biocep - http://biocep-distrib.r-forge.r-project.org/

-Roy M.

On Jan 30, 2009, at 8:52 PM, Martin Morgan wrote:


Neiderer, Andrew (Civ, ARL/CISD) neide...@arl.army.mil writes:


Classification:  UNCLASSIFIED
Caveats: NONE

I am new to R and somewhat to Web server programming.
I am a Java programmer, however, and have done quite a bit with X3D
(extensible 3D) computer graphics.

A statistician that I work with is doing multidimensional scaling  
(MDS) and

provides some x,y,z's which I display using X3D.
Currently he is using Permap which more than gets the job done but is
written in Visual Basic (I believe).  I think it would be a big job  
to use
Permap as a Web service.  So I am looking at R (for other reasons  
as well).


My question is -
Can I access R via SOAP, e.g., running on a server.  Assuming I  
worded my
question correctly and someone understands my question, please  
provide URLs

. so I can get knowledgeable.


See RWebServices, which allows construction of SOAP-based web service
wrappers around R. Martin


Thank you.

- Andrew M. Neiderer


Classification:  UNCLASSIFIED
Caveats: NONE
__
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.


--
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793

__
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.


**
The contents of this message do not reflect any position of the U.S.  
Government or NOAA.

**
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: roy.mendelss...@noaa.gov (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

Old age and treachery will overcome youth and skill.
From those who have been given much, much will be expected

__
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] How do I get my IT department to bless R?

2009-01-30 Thread Liviu Andronic
On 1/30/09, Warren Young war...@etr-usa.com wrote:
   Could you please share a link to the NY Times article?

 http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html

Also do not miss the follow-up blog from the author, plus the the
related comments [1].
Liviu
[1] http://bits.blogs.nytimes.com/2009/01/08/r-you-ready-for-r/ .


-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
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] How do I get my IT department to bless R?

2009-01-30 Thread Liviu Andronic
On 1/30/09, Neil Shephard nsheph...@gmail.com wrote:
  If they expect you to use Excel for statistics then its worth letting them
  know that this would be a very bad idea as there are many short-comings,
  some of which I've referenced at..

  http://slack.ser.man.ac.uk/progs/stata/avoid_excel.html

Very neat resource; thanks.
Liviu

PS [hijack] Would it make sense to have it (or similar information)
assembled in a .pdf documentation file and made available on the
Contributed documentation section of R's web site?


-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
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] need a help with dealing XML

2009-01-30 Thread venkata kirankumar
Hi all,
I am trying to read data from a XML file but the thing is when I am trying
to read data from XML
it is not allowing me to read and store nodes in objects can any one suggest
how can i solve this problem.


thanks in advance

[[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.