Re: [R] Feed list of vectors to vioplot()?

2008-04-24 Thread Johannes Graumann
Hm, now I have trouble using additional vioplot parameters.

mu-2
si-0.6
bimodal-c(rnorm(1000,-mu,si),rnorm(1000,mu,si))
uniform-runif(2000,-4,4)
normal-rnorm(2000,0,3)
mylist - list(bimodal,uniform,normal)
# Easy
do.call(vioplot,mylist)
# Works
do.call(vioplot,c(mylist,col=white))
# Does not
# vioplot expects names as a plain vector, not in the 
# form names=c(One,Two,Three) ...
names - c(One,Two,Three)
do.call(vioplot,c(mylist,col=white,names))

Any help on how to do this?

Thanks, Joh


Johannes Graumann wrote:

 Off-list it was pointed out to me that the trivial solution to this would
 look like this:
 myfunction2 - function(x, ...){
   mylist - list(x, ...)
   # plenty of lapply stuff
   do.call(vioplot,mylist)
 }
 
 Thanks for everybodies patience,
 
 Joh
 
 Johannes Graumann wrote:
 
 posted  mailed
 
 Thanks for the very appropriate scolding.
 
 Here's my example (based on ?vioplot):
 mu-2
 si-0.6
 bimodal-c(rnorm(1000,-mu,si),rnorm(1000,mu,si))
 uniform-runif(2000,-4,4)
 normal-rnorm(2000,0,3)
 # Working just fine
 myfunction1 - function(x, ...){vioplot(x,...)}
 myfunction1(bimodal,uniform,normal)
 # What I (believe to) need
 myfunction2 - function(x, ...){
   mylist - list(x, ...)
   # plenty of lapply stuff
   vioplot(mylist)
 }
 myfunction2(bimodal,uniform,normal)
 -- Error in min(data) : invalid 'type' (list) of argument
 
 I'm at a loss on how to disentangle mylist - unlist just gives me one
 big vector back rather than the 3 I want to have back ...
 
 Thanks for your patience, Joh
 
 jim holtman wrote:
 
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html and provide commented,
 minimal, self-contained, reproducible code.
 
 It is hard to provide a solution if we do not understand the problem
 to be solved.  Sample data would be helpful along with an
 understanding of what you would expect for output.
 
 On Wed, Apr 23, 2008 at 10:11 AM, Johannes Graumann
 [EMAIL PROTECTED] wrote:

 Johannes Graumann wrote:

  Hi,
 
  I have a list of vectors and am trying to coerce them into something
  that vioplot will take as groups of data to be plotted independently.
  Can someone nudge me into the right direction?
 
  Thanks, Joh
 
  __
  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.

 I'll try less impolite and with more info ...

 I'm writing a function that contains this:

 # function(x, ... , morestuff){}

 which is gathered into a list like so:

 # mylist - list(x, ...)

 down the line I'd like to output all elements from mylist in seperate
 vioplots in a single coordiante system. Now I have a hell of a time
 with that because vioplot does not accept a list as input but only a
 succession of vectors ... how can I now force my list into that form so
 a can say

 # vioplot(magicfunction(mylist))

 and get a violin plot for each list-member?

 Thanks for any hint,


 Joh

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

__
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] mysterious (to me) automatic loading of package s when R starts up

2008-04-24 Thread Dieter Menne
Duncan Mackay duncan.mackay at flinders.edu.au writes:

 I have recently noticed that in one of my work areas, a number of packages
 are automatically loaded without my explicitly requesting them to be loaded
 (see below). This only happens in one particular workspace (located in a
 folder). I suspect (without any real evidence) that this may be related to
 my creating plots using the ggplot2 package earlier in this workspace.
 
 
 Loading required package: proto
 Loading required package: grid
 Loading required package: reshape
 [Previously saved workspace restored]

Whenever you see the last line, there is an .Rdata-file in you startup
directory. Delete it, and use

rgui.exe --no-restore --no-save 

to start R (assuming Windows) to avoid the automatic loading/saving (which I
find confusing).

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.


Re: [R] filled contour plots (link)

2008-04-24 Thread Dieter Menne
Fernando De Sales fhds2000 at yahoo.com writes:

 
I have moved the figure to the link below. thank

Try again. Better than providing the link for the picture, make the example
self-running by providing a fake data set that shows the problem. 

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] Factor to numeric

2008-04-24 Thread Jojje Andersson

Hello!
I have a problem whith a data.frame. I want to make a subset where some of the 
variables have values within ceartain limits.
The variables are proportions like 1,00, 0,54, 0,00 etc.
I don't get it right as R take the variables for factors.
 
 
 ekobsub1 - subset(ekob, PAP0,25  PAP0,6  CAP0,1  CAP0,6  FAP0,1)
Error in `[.data.frame`(x, r, vars, drop = drop) : object CAP not found
In addition: Warning message:
In Ops.factor(PAP, 0) :  not meaningful for factors
 
 ekobn-as.numeric(as.character(ekob[[PAP]]))
Warning message:
NAs introduced by coercion 
 
 
Thanks!
 
/Jojje
 
_
[[elided Hotmail spam]]

px?sc_cmp2=JS_INT_SEMSN_NLPCV
[[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 to numeric

2008-04-24 Thread Prof Brian Ripley
The decimal point in R is always '.', never ','.

On Thu, 24 Apr 2008, Jojje Andersson wrote:


 Hello!
 I have a problem whith a data.frame. I want to make a subset where some of 
 the variables have values within ceartain limits.
 The variables are proportions like 1,00, 0,54, 0,00 etc.
 I don't get it right as R take the variables for factors.


 ekobsub1 - subset(ekob, PAP0,25  PAP0,6  CAP0,1  CAP0,6  FAP0,1)
 Error in `[.data.frame`(x, r, vars, drop = drop) : object CAP not found
 In addition: Warning message:
 In Ops.factor(PAP, 0) :  not meaningful for factors

 ekobn-as.numeric(as.character(ekob[[PAP]]))
 Warning message:
 NAs introduced by coercion


 Thanks!

 /Jojje

 _
 [[elided Hotmail spam]]

 px?sc_cmp2=JS_INT_SEMSN_NLPCV
   [[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,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] looping problem

2008-04-24 Thread Roslina Zakaria
Dear r-expert,
I would like to generate 30 sets of random numbers from uniform distribution 
(0,1). Each set of random numbers should have 90 data.  Here is my code:
rand.no - function(n,itr)
{ for (i in 1:itr)
  {rand.1 - runif(n,0,1)
  if (i ==1) rand.2 - rand.1
  else rand.2 - cbind(rand.2,rand.1)
  }
  rand.2
}
Question: The code is okay is just that it give me 31 sets instead of 30 sets. 
Can anybody any adjustment to my code.
Your help is really appreciated.
Thank you.


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

__
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] looping problem

2008-04-24 Thread Uwe Ligges


Roslina Zakaria wrote:
 Dear r-expert,
 I would like to generate 30 sets of random numbers from uniform distribution 
 (0,1). Each set of random numbers should have 90 data.  Here is my code:
 rand.no - function(n,itr)
 { for (i in 1:itr)
   {rand.1 - runif(n,0,1)
   if (i ==1) rand.2 - rand.1
   else rand.2 - cbind(rand.2,rand.1)
   }
   rand.2
 }
 Question: The code is okay is just that it give me 31 sets instead of 30 
 sets. 

Works for me as expected, but really, why don't you simply say:

rand.no - function(n,itr){
 matrix(runif(n*itr, 0, 1), nrow=n, ncol=itr)
}

which does the same, just much quicker...

Uwe Ligges




 Can anybody any adjustment to my code.
 Your help is really appreciated.
 Thank you.
 
 
   
 
 Be a better friend, newshound, and 
 know-it-all with Yahoo! Mobile.  Try it now.  
 http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
 
 __
 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] select rows from data based on a vector of char strings

2008-04-24 Thread seanpor

or using the %in% operator...

?%in%

data[data$label %in% flist,]

regards,
Sean


Applejus wrote:
 
 Hi,
 
 You are right the == doesn't work, but there's a workaround using regular
 expressions:
 
 flist-fun|food
 grep(flist, data$label)
 
 will give you the vector [2 4] which are the numbers of the rows of
 interest!
 
 
 Dirkheld wrote:
 
 Hi,
 
 I have loaded a dataset in R :
 data = 
 
 label   freq1   freq2
 news   54  35
 fun  37  21
 milk19  7
 food 3   3
  etc
 
 And I have a vector
 flist-c(fun,food)
 
 Now I want to use the vector 'flist' for selecting these values from
 'data' so that I get the following dataset :
 label   freq1   freq2
 fun  37  21
 food 3   3
 
 When I do 'data$label==flist[1]' I get 'F T F F', so it works for one
 item in the char vector flist.
 But, when I do 'data$label==flist' I get 'F F F F' while I expected 'F T
 F T'. It seems that I can't perform this action with a vector of
 charstrings? 
 
 Is there an other way to do so?
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/select-rows-from-data-based-on-a-vector-of-char-strings-tp16832735p16848199.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] significant variables in GPLS ?

2008-04-24 Thread Bjørn-Helge Mevik
There is little theory about significance and testing for PLSR (and, I
would guess, GPLSR).  Many practicioners use Jackknife variance
estimates as a basis for significance tests.  Note, however, that these
variance estimates are known to be biased (in general), and their
distribution is (to my knowledge) not known.  Any significance deduced
from them should therefore be regarede as merely indicators.

-- 
Bjørn-Helge Mevik

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] bug in file.path?

2008-04-24 Thread Javier Muñoz
Hello,

This is what i get in R-2.7.0 (with the completely internal file.path()):

 setwd(c:/jml/Valoración F1/04 BA/)
 filename - Valoración F1 PAG.mdb

 file.path(getwd(), filename)
[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb - worng

 file.path(c:/jml/Valoración F1/04 BA, filename)
[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb - ok

 file.path(paste(getwd()), filename)
[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb - ok

With the older file.path() all of these return c:/jml/Valoración F1/04
BA/Valoración F1 PAG.mdb

-- Session info ---

R version 2.7.0 (2008-04-22)
i386-pc-mingw32

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

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

other attached packages:
[1] RODBC_1.2-3



Is this a bug in the new file.path() or can I change something to make this
work as before?

Thanks.

Javier.

[[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] bug in file.path?

2008-04-24 Thread Peter Dalgaard
Javier Muñoz wrote:
 Hello,

 This is what i get in R-2.7.0 (with the completely internal file.path()):

   
 setwd(c:/jml/Valoraci�n F1/04 BA/)
 filename - Valoraci�n F1 PAG.mdb
 

   
 file.path(getwd(), filename)
 
 [1] c:/jml/Valoración F1/04 BA/Valoraci�n F1 PAG.mdb - worng

   
 file.path(c:/jml/Valoraci�n F1/04 BA, filename)
 
 [1] c:/jml/Valoraci�n F1/04 BA/Valoraci�n F1 PAG.mdb - ok

   
 file.path(paste(getwd()), filename)
 
 [1] c:/jml/Valoraci�n F1/04 BA/Valoraci�n F1 PAG.mdb - ok

 With the older file.path() all of these return c:/jml/Valoraci�n F1/04
 BA/Valoraci�n F1 PAG.mdb

 -- Session info ---

 R version 2.7.0 (2008-04-22)
 i386-pc-mingw32

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

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

 other attached packages:
 [1] RODBC_1.2-3

 

 Is this a bug in the new file.path() or can I change something to make this
 work as before?
   
This could well be related to the PATH issue reported yesterday by Erik
Joergensen, so please check whether R-patched fixes the issue (and
please make a habit of checking our prereleases...).

(Email encodings again: I assume that you see something weird in the one
place where I see the accented o in valoración, whereas you see the
accented o in all the places where I see a reverse-video question mark)

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] bug in file.path?

2008-04-24 Thread Prof Brian Ripley

See my reply to Erik Jørgensen yesterday.

Can you please send that again with a marked encoding, so we have a chance 
of reading it?  Or attach it as a plain text file and tell us what 
encoding the file is in?


Yes, there probably is a bug here but we do need to be able to reproduce 
it.


On Thu, 24 Apr 2008, Javier Muñoz wrote:


Hello,

This is what i get in R-2.7.0 (with the completely internal file.path()):


setwd(c:/jml/Valoraci?n F1/04 BA/)
filename - Valoraci?n F1 PAG.mdb



file.path(getwd(), filename)

[1] c:/jml/Valoraci??n F1/04 BA/Valoraci?n F1 PAG.mdb - worng


file.path(c:/jml/Valoraci?n F1/04 BA, filename)

[1] c:/jml/Valoraci?n F1/04 BA/Valoraci?n F1 PAG.mdb - ok


file.path(paste(getwd()), filename)

[1] c:/jml/Valoraci?n F1/04 BA/Valoraci?n F1 PAG.mdb - ok

With the older file.path() all of these return c:/jml/Valoraci?n F1/04
BA/Valoraci?n F1 PAG.mdb

-- Session info ---

R version 2.7.0 (2008-04-22)
i386-pc-mingw32

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

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

other attached packages:
[1] RODBC_1.2-3



Is this a bug in the new file.path() or can I change something to make this
work as before?

Thanks.

Javier.

[[alternative HTML version deleted]]




--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] changing format of a float value to another

2008-04-24 Thread orkun
hello

How can I change a vector's float value from (1.085714e-01) format to
a  simpler format (like 0.1xxx).

regards 


-- 
Ahmet Temiz
Jeo. Müh.
Afet İşleri Gen. Md.lüğü
Deprem Ar. D.

Ahmet Temiz
Geo. Eng.
General Dir. of 
Disaster Affairs



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

__
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] bug in file.path?

2008-04-24 Thread Javier Muñoz
Sorry,
this is the same test with R-patched (same results as well).

 setwd(c:/jml/Valoración F1/04 BA/)
 filename - Valoración F1 PAG.mdb

 file.path(getwd(), filename)
[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb - wrong

 file.path(c:/jml/Valoración F1/04 BA, filename)
[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb - ok

 file.path(paste(getwd()), filename)
[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb -ok

 getwd()
[1] c:/jml/Valoración F1/04 BA


R version 2.7.0 Patched (2008-04-23 r45466)
i386-pc-mingw32

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

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

other attached packages:
[1] RODBC_1.2-3

--

Thanks again.

2008/4/24, Prof Brian Ripley [EMAIL PROTECTED]:
 See my reply to Erik Jørgensen yesterday.

  Can you please send that again with a marked encoding, so we have a chance 
 of reading it?  Or attach it as a plain text file and tell us what encoding 
 the file is in?

  Yes, there probably is a bug here but we do need to be able to reproduce it.

  On Thu, 24 Apr 2008, Javier Muñoz wrote:


   Hello,
 
   This is what i get in R-2.7.0 (with the completely internal file.path()):
 
 
setwd(c:/jml/Valoraci?n F1/04 BA/)
filename - Valoraci?n F1 PAG.mdb
  
 
 
file.path(getwd(), filename)
  
   [1] c:/jml/Valoraci??n F1/04 BA/Valoraci?n F1 PAG.mdb - worng
 
 
file.path(c:/jml/Valoraci?n F1/04 BA, filename)
  
   [1] c:/jml/Valoraci?n F1/04 BA/Valoraci?n F1 PAG.mdb - ok
 
 
file.path(paste(getwd()), filename)
  
   [1] c:/jml/Valoraci?n F1/04 BA/Valoraci?n F1 PAG.mdb - ok
 
   With the older file.path() all of these return c:/jml/Valoraci?n F1/04
   BA/Valoraci?n F1 PAG.mdb
 
   -- Session info ---
 
   R version 2.7.0 (2008-04-22)
   i386-pc-mingw32
 
   locale:
   
  LC_COLLATE=Spanish_Spain.1252;LC_CTYPE=Spanish_Spain.1252;LC_MONETARY=Spanish_Spain.1252;LC_NUMERIC=C;LC_TIME=Spanish_Spain.1252
 
   attached base packages:
   [1] stats graphics  grDevices datasets  utils methods   base
 
   other attached packages:
   [1] RODBC_1.2-3
 
   
 
   Is this a bug in the new file.path() or can I change something to make this
   work as before?
 
   Thanks.
 
   Javier.
 
   [[alternative HTML version deleted]]
 
 
 

  --
  Brian D. Ripley,  [EMAIL PROTECTED]
  Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
  University of Oxford, Tel:  +44 1865 272861 (self)
  1 South Parks Road, +44 1865 272866 (PA)
  Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] bug in file.path?

2008-04-24 Thread Prof Brian Ripley

I can read that version, thanks.

The issue is probably that getwd() and filename are in different 
encodings, and file.path() was not expecting that.  You need R-patched = 
r45490 for that fix.


On Thu, 24 Apr 2008, Javier Muñoz wrote:


Sorry,
this is the same test with R-patched (same results as well).


setwd(c:/jml/Valoración F1/04 BA/)
filename - Valoración F1 PAG.mdb



file.path(getwd(), filename)

[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb - wrong


file.path(c:/jml/Valoración F1/04 BA, filename)

[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb - ok


file.path(paste(getwd()), filename)

[1] c:/jml/Valoración F1/04 BA/Valoración F1 PAG.mdb -ok


getwd()

[1] c:/jml/Valoración F1/04 BA


R version 2.7.0 Patched (2008-04-23 r45466)
i386-pc-mingw32

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

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

other attached packages:
[1] RODBC_1.2-3

--

Thanks again.

2008/4/24, Prof Brian Ripley [EMAIL PROTECTED]:

See my reply to Erik Jørgensen yesterday.

 Can you please send that again with a marked encoding, so we have a 
chance of reading it?  Or attach it as a plain text file and tell us 
what encoding the file is in?


 Yes, there probably is a bug here but we do need to be able to reproduce it.

 On Thu, 24 Apr 2008, Javier Muñoz wrote:



 Hello,

 This is what i get in R-2.7.0 (with the completely internal file.path()):



 setwd(c:/jml/Valoraci?n F1/04 BA/)
 filename - Valoraci?n F1 PAG.mdb





 file.path(getwd(), filename)


 [1] c:/jml/Valoraci??n F1/04 BA/Valoraci?n F1 PAG.mdb - worng



 file.path(c:/jml/Valoraci?n F1/04 BA, filename)


 [1] c:/jml/Valoraci?n F1/04 BA/Valoraci?n F1 PAG.mdb - ok



 file.path(paste(getwd()), filename)


 [1] c:/jml/Valoraci?n F1/04 BA/Valoraci?n F1 PAG.mdb - ok

 With the older file.path() all of these return c:/jml/Valoraci?n F1/04
 BA/Valoraci?n F1 PAG.mdb

 -- Session info ---

 R version 2.7.0 (2008-04-22)
 i386-pc-mingw32

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

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

 other attached packages:
 [1] RODBC_1.2-3

 

 Is this a bug in the new file.path() or can I change something to make this
 work as before?

 Thanks.

 Javier.

 [[alternative HTML version deleted]]





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




--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Minimise a parameter of a given function f, with f 0

2008-04-24 Thread Paul Smith
On Wed, Apr 23, 2008 at 8:51 PM, Kevin Lu [EMAIL PROTECTED] wrote:
  I need to find the minimum value of the parameter, s, such that the function
  f(s,t)  0 (where -Inf  t  Inf)

  I've looked into optim, constrOptim and others but they don't seem to do
  this. Des anyone have some suggestions?

In order to allow us to help you, please send us a minimal example.

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] changing format of a float value to another

2008-04-24 Thread Henrique Dallazuanna
Try this:

x - 1.085714e-01
format(as.numeric(x), scientific = F)



On Thu, Apr 24, 2008 at 7:28 AM, orkun [EMAIL PROTECTED] wrote:

 hello

 How can I change a vector's float value from (1.085714e-01) format to
 a  simpler format (like 0.1xxx).

 regards


 --
 Ahmet Temiz
 Jeo. Müh.
 Afet Ýþleri Gen. Md.lüðü
 Deprem Ar. D.

 Ahmet Temiz
 Geo. Eng.
 General Dir. of
 Disaster Affairs



 --
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] Memory usage

2008-04-24 Thread Christian Oswald
Hello,

I have aggregate a data.frame from 16MB (Object size). After some
minutes I get the error message cannot allocate vector of size 64.5MB.
My computer has a physical memory of 4GB under Windows Vista.

I have test the same command on another computer with the same OS and
2GB RAM. In nearly 2sec I get the result without problems.

Thanks


buch-read.delim(Y2006_1.csv,sep=;,as.is=TRUE,header=TRUE,dec=,)
ana01-aggregate(buch[,c(VALUELW,LZLW,SZLW)],by=data.frame(buch$PRODGRP,buch$LAND1,buch$KUNDE1),sum)

__
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] changing format of a float value to another

2008-04-24 Thread jim holtman
?sprintf

 x - 1.085714e-01
 sprintf(%.4f, as.numeric(x))
[1] 0.1086



On Thu, Apr 24, 2008 at 6:28 AM, orkun [EMAIL PROTECTED] wrote:
 hello

 How can I change a vector's float value from (1.085714e-01) format to
 a  simpler format (like 0.1xxx).

 regards


 --
 Ahmet Temiz
 Jeo. Müh.
 Afet İşleri Gen. Md.lüğü
 Deprem Ar. D.

 Ahmet Temiz
 Geo. Eng.
 General Dir. of
 Disaster Affairs



 --
 This message has been scanned for viruses and
 dangerous content by MailScanner, and is
 believed to be clean.

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


Re: [R] BB - a new package for solving nonlinear system of equations and for optimization with simple constraints

2008-04-24 Thread Zaihra T

   Dear Dr. Vardhan,

   From where can we download this package and its  details.

   Thanks

   HAve a nice day.

   On Wed, 23 Apr 2008 16:39:50 -0400 Ravi Varadhan wrote:
Hi,
   
   
   
We (Paul Gilbert and I) have just released a new R package on CRAN called
BB (stands for Barzilai-Borwein) that provides functionality for solving
large-scale (and small-scale) nonlinear system of equations. Until now, R
didn't have any functionality for solving nonlinear systems. We hope that
this package fills that need.
   
   
   
We also have an implementation of the spectral projected gradient method
   for
the optimization of (smooth) nonlinear objective functions, subject to
simple constraints that can be defined as a projection mapping. This
function, spg(), is suited for large-s! cale optimization. It generally
performs better than the conjugate-gradient methods in optim, and
complements the low-memory BFGS method for constraints that can be
   defined
by the user as projection mapping.
   
   
   
Best regards,
   
Ravi.
   
   
   
---
   
Ravi Varadhan, Ph.D.
   
Assistant Professor, The Center on Aging and Health
   
Division of Geriatric Medicine and Gerontology
   
Johns Hopkins University
   
Ph: (410) 502-2619
   
Fax: (410) 614-9625
   
Email: [EMAIL PROTECTED]
   
Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
   
   
   
---!
   -
   g t; 
   
   
   
   
[[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] Feed list of vectors to vioplot()?

2008-04-24 Thread Johannes Graumann
Dirty solution: switched off x-axis plotting via 'par' and added it the
personalized way with 'axis'.

Joh

Johannes Graumann wrote:

 Hm, now I have trouble using additional vioplot parameters.
 
 mu-2
 si-0.6
 bimodal-c(rnorm(1000,-mu,si),rnorm(1000,mu,si))
 uniform-runif(2000,-4,4)
 normal-rnorm(2000,0,3)
 mylist - list(bimodal,uniform,normal)
 # Easy
 do.call(vioplot,mylist)
 # Works
 do.call(vioplot,c(mylist,col=white))
 # Does not
 # vioplot expects names as a plain vector, not in the
 # form names=c(One,Two,Three) ...
 names - c(One,Two,Three)
 do.call(vioplot,c(mylist,col=white,names))
 
 Any help on how to do this?
 
 Thanks, Joh
 
 
 Johannes Graumann wrote:
 
 Off-list it was pointed out to me that the trivial solution to this would
 look like this:
 myfunction2 - function(x, ...){
   mylist - list(x, ...)
   # plenty of lapply stuff
   do.call(vioplot,mylist)
 }
 
 Thanks for everybodies patience,
 
 Joh
 
 Johannes Graumann wrote:
 
 posted  mailed
 
 Thanks for the very appropriate scolding.
 
 Here's my example (based on ?vioplot):
 mu-2
 si-0.6
 bimodal-c(rnorm(1000,-mu,si),rnorm(1000,mu,si))
 uniform-runif(2000,-4,4)
 normal-rnorm(2000,0,3)
 # Working just fine
 myfunction1 - function(x, ...){vioplot(x,...)}
 myfunction1(bimodal,uniform,normal)
 # What I (believe to) need
 myfunction2 - function(x, ...){
   mylist - list(x, ...)
   # plenty of lapply stuff
   vioplot(mylist)
 }
 myfunction2(bimodal,uniform,normal)
 -- Error in min(data) : invalid 'type' (list) of argument
 
 I'm at a loss on how to disentangle mylist - unlist just gives me one
 big vector back rather than the 3 I want to have back ...
 
 Thanks for your patience, Joh
 
 jim holtman wrote:
 
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html and provide commented,
 minimal, self-contained, reproducible code.
 
 It is hard to provide a solution if we do not understand the problem
 to be solved.  Sample data would be helpful along with an
 understanding of what you would expect for output.
 
 On Wed, Apr 23, 2008 at 10:11 AM, Johannes Graumann
 [EMAIL PROTECTED] wrote:

 Johannes Graumann wrote:

  Hi,
 
  I have a list of vectors and am trying to coerce them into something
  that vioplot will take as groups of data to be plotted
  independently. Can someone nudge me into the right direction?
 
  Thanks, Joh
 
  __
  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.

 I'll try less impolite and with more info ...

 I'm writing a function that contains this:

 # function(x, ... , morestuff){}

 which is gathered into a list like so:

 # mylist - list(x, ...)

 down the line I'd like to output all elements from mylist in
 seperate vioplots in a single coordiante system. Now I have a hell of
 a time with that because vioplot does not accept a list as input but
 only a succession of vectors ... how can I now force my list into that
 form so a can say

 # vioplot(magicfunction(mylist))

 and get a violin plot for each list-member?

 Thanks for any hint,


 Joh

 __
 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.
 
 __
 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] Can I get rid of this for loop using apply?

2008-04-24 Thread Mike Dugas
Great suggestions.  I tested the code on an example and the run time was
reduced from 1 min 12 sec to 3 sec.  Also, I like the suggestion to look at
the quantiles.  I will see what insight it provides in terms of detecting
masked interactions.

I have a couple questions about your code.
First, why not use
xs - seq(min(x1), max(x1), length = 100) instead of
xs - with(m, seq(min(x1), max(x1), length = 100)) ?
Second, what is the function geom_line()?  I couldn't find it.

Thanks,
Mike


On 4/23/08, hadley wickham [EMAIL PROTECTED] wrote:

 On Wed, Apr 23, 2008 at 8:33 PM, hadley wickham [EMAIL PROTECTED]
 wrote:
   Sure, I am creating a partial dependence plot (reference Friedman's
stochastic gradient paper from, I want to say, 2001).  The idea is to
 find
the relationship between one of the predictors, say x1, and y by
 creating
the following plot: take a random sample of actual data points, hold
 other
predictors fixed (x2-xp), vary x1 across its range, create a string of
 
   Put your code doesn't have a random component - you're trying to
   calculate everything combination of the new x_n and the existing data?
Is that right?

 And why are you using so many different values of the x variable?
 100's should be sufficient to get a smooth curve, not thousands.  I'd
 also think about displaying not just the mean, but a selection of
 quantiles as well:

 Here's one approach:

 model - lm(y ~ poly(x1, 2) + x2, data = m)


 xs - with(m, seq(min(x1), max(x1), length = 100))

 library(reshape)
 newdf - expand.grid.df(data.frame(x1 = xs), m[, c(x2), drop=F])

 predictions - predict(model, newdata = newdf)
 avg_pred - tapply(predictions, newdf$x1, mean)
 low_pred - tapply(predictions, newdf$x1, quantile, 0.25)
 high_pred - tapply(predictions, newdf$x1, quantile, 0.75)

 library(ggplot)
 qplot(xs, avg_pred, min = low_pred, max = high_pred, geom=ribbon) +
 geom_line()


 But following your code, it's exhaustive, not random.  This should be
 a little faster because all the predictions are done in one go.

 Hadley

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


[[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] Passing Inf from R to C using .C(myLibC...

2008-04-24 Thread Duncan Murdoch
On 4/24/2008 9:01 AM, Ardia David wrote:
 Dear all,
 How can I pass '-Inf' and 'Inf' values from R to C code using the 
 function '.C(...)'. When running my code, I get an error since C does 
 not recognize -Inf and Inf values. Of course, I could use instead a very 
 low (or high) number, but I was wondering whether a more elegant 
 solution exists. Thanks for your help.

C doesn't have any problem, but many C functions do, so .C by default 
prevents you from doing this.  However, if you know that it is safe, use 
the NAOK arg to .C and special values will get through.  (The name NAOK 
may not suggest it also means Inf is okay, but the docs do clearly say 
that.)

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] Extracting factor columns from a data frame

2008-04-24 Thread Serge Merzliakov
Hi All,
I have attempted to extract only the factor columns from  an 
existing data set inside a loop without success . I tried the transform 
function which worked, but not inside the loop (attempts with cbind did 
not work either - inside a loop). Here is my function:

getcatcolumns-function(x)
{
# ignore type checking for data frames etc
 res - data.frame()
 for(i in 1:length(x))
 {
if (class(x[,i]) ==factor) res - transform(res, colname = 
x[,i])  # append the factor column to the new data frame (res)
 }
   return(res)
}

The error I get is: arguments imply differing number of rows: 0, 5000

All help appreciated.
 
Regards,
 Serge Merzliakov

__
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] logit newbie question...

2008-04-24 Thread yoooooo

Hi, I'm new to the glm and logit world... and I'm reading some lecture notes
and examples. I would like to try and generate the same result in R.. but I
don't seem to be able to find the proper way to specify the formula
let's say i have

Desire Using Drugs Not Using Drugs
Yes 219 753
No   288 347

Desire is my explanatory and Drugs Using is my response... 

How can I specify the null model? Namely 
 logit(pi) = n
where mle should give n to be logit((219+288)/(753+347))

Also, if I want a one factor model
  logit(pi1) = n 
  logit(pi2) = n + alpha   
where mle should give me n to be logit(219 / 972) and alpha be
logit(288/635) - logit(219/972)

Thanks!



-- 
View this message in context: 
http://www.nabble.com/logit-newbie-question...-tp16850195p16850195.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] permutation of the rows of a matrix that minimizes the distance to another matrix

2008-04-24 Thread Carlos Soares
Hi!
I have 2 matrices of numbers m1 and m2 with the same number of columns 
and rows. I would like to compute m2', the permutation of the rows of m2 
such that the distance (e.g., sum(m1-m2') or sum((m1-m2')^2))  is 
minimized. Do you know of any function/algorithm to obtain such a 
permutation?
Best regards,
Carlos

__
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 for HP Integrity Superdome...

2008-04-24 Thread Nüzhet Dalfes
Hi,

We just installed a HP Integrity Superdome (an Itanium-based SMP  
machine with 64 cores + 128 GB memory, running Red Hat AS 4 update 6)  
at our National Center for High Performance Computing.

I would like to run R on it and use the hardware optimally. What is  
the best way? Is there a parallel (openMP ?) version of R. Or can one  
'make it' using (if available) optimized parallel libraries?

Any advise.suggestion will be appreciated.

H. Nüzhet Dalfes

Professor,
Istanbul Technical University
Eurasia Institute of Earth Sciences 
+90 (532) 206-1308
[EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-help Digest, Vol 62, Issue 24

2008-04-24 Thread Terry Therneau
---begin included message 
Hi,
i need to use pspline. In this pspline function coxph.wtest was used. When I
try to make some change to this function by pulling out the pspline
function, it turns out R gave me an error msg, saying coxph.wtest cannot be
found. Even if i dont change anything in pspline and just rename it and run
the function, it did not work out. Can any one help me with this? is there
anyway to get the coxph.wtest function? thank you

--- end included message

  Your question is not completely clear to me, but I will guess that you have 
pulled out some code from coxph and tried to run it separately.  If so, you 
are running into the name space problem: not all functions within the survival 
package are visible outside of the package.  (Those for which the authors 
assumed that no one would call the function themselves.)  A quick solution is 
to make your own local copy
   coxph.wtest - survival:::coxph.wtest

It will now be visible to you.  

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


Re: [R] Documentation General Comments

2008-04-24 Thread Beck, Kenneth (STP)
Agree that terseness is good, but I also agree with other posters that
better cross referencing or maybe an index of synonyms would be good. 

So far, the best suggestion is the pdf at this link 

(http://www.medepi.net/epir/epir_chap02.pdf). 

Is there a way to pop at least part of this into the R-base help page?
Are there legal or copyright issues? If I had known this from the start,
it would have been much better. A good analogy is that old cartoon of
the blind guys trying to figure out what an elephant is. The guys
feeling at the front get a much different impression than the guys
poking at the back side. I felt like that using R data structures,  had
to blindly poke around trying different things, 90% of which did not
work, yeilding only error messages, but now knowing the underlying
organisation it is going much more smoothly. Ideally this kind of basic
info would be in the core R docuemtation, you should not have to search
this hard to get it!

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Bert Gunter
Sent: Tuesday, April 22, 2008 10:29 AM
To: r-help@r-project.org
Subject: Re: [R] Documentation General Comments

FWIW:

I consider the documentation of Core R to be one of its great strengths:
it is terse (read: to the point), detailed, and accurate. I find it
eminently useful and helpful. Indeed, it was why I made the decision
some years ago to switch from S-Plus to R (I readily acknowledge that
S-Plus may have improved its docs since then -- haven't looked at it in
years). While I understand that it may not suit everyone -- learning
styles differ, after all -- may I at least say that there is one user
out here who is appreciative of the hard work and care that has gone
into the documentation. Far FAR better than anything I could do!

-- Bert Gunter
Genentech

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Greg Snow
Sent: Tuesday, April 22, 2008 8:16 AM
To: Beck, Kenneth (STP); r-help@r-project.org
Subject: Re: [R] Documentation General Comments

This is a case of you can't please everyone.  A while back there was
some complaint that Introduction to R spent to much time on talking
about the different types of variables, just the opposite complaint of
yours.

There are several other sources of documentation (look under the books
link on the R homepage or the contributed documentation link on any CRAN
site, also browse through the newsletter).  For more in depth
information on variable types and object oriented programming in R you
may want to invest in a copy of S Programming by Venables and Ripley.

If you have specific questions (about data types, or other) then tell us
what you have read and what you still do not understand and you are more
likely to get a useful answer.  (also read the posting guide that is
referenced at the bottom of almost all posts to the list).

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Beck, Kenneth (STP)
 Sent: Monday, April 21, 2008 3:56 PM
 To: r-help@r-project.org
 Subject: [R] Documentation General Comments
 
 I realize the R developers are probably overwhelmed and have little 
 time for this, but the documentation really needs some serious 
 reorganizaton.
 A good through description of basic variable types would help a lot, 
 e.g. the difference between lists, arrays, matrices and frames. And, 
 it appears there is some object-orientation to R, but it is not 
 complete. I can't, for instance find a metafile method for a 
 recordedplot type, using either the variable direclty or the 
 replayPlot() method. I am sorry to post this, but I am really having 
 trouble sorting out certain methods in R. The basic tutorial 
 Introduction to R is so basic, it hardly helps at all, then digging 
 through documentation is really an exercise in frustration. The 
 SimpleR is also so basic it is of little help other than to just get 
 started. I occasionally find answers in the mailing list. See my later

 post on recordPlot for a good example.
 

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

Re: [R] Extracting factor columns from a data frame

2008-04-24 Thread Henrique Dallazuanna
Try this:

dat - data.frame(x = gl(4, 5), y = gl(5, 4), z = rnorm(20))
res - dat[sapply(dat, is.factor)]


On Thu, Apr 24, 2008 at 9:14 AM, Serge Merzliakov [EMAIL PROTECTED]
wrote:

 Hi All,
I have attempted to extract only the factor columns from  an
 existing data set inside a loop without success . I tried the transform
 function which worked, but not inside the loop (attempts with cbind did
 not work either - inside a loop). Here is my function:

 getcatcolumns-function(x)
 {
# ignore type checking for data frames etc
 res - data.frame()
 for(i in 1:length(x))
 {
if (class(x[,i]) ==factor) res - transform(res, colname =
 x[,i])  # append the factor column to the new data frame (res)
 }
   return(res)
 }

 The error I get is: arguments imply differing number of rows: 0, 5000

 All help appreciated.

 Regards,
  Serge Merzliakov

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] Can I get rid of this for loop using apply?

2008-04-24 Thread hadley wickham
 Great suggestions.  I tested the code on an example and the run time was
 reduced from 1 min 12 sec to 3 sec.  Also, I like the suggestion to look at
 the quantiles.  I will see what insight it provides in terms of detecting
 masked interactions.

Well that's a decent speed up :)

 I have a couple questions about your code.
 First, why not use
 xs - seq(min(x1), max(x1), length = 100) instead of
 xs - with(m, seq(min(x1), max(x1), length = 100)) ?

No real reason, just to make it a bit easier when you generalise to
other data sets / models

 Second, what is the function geom_line()?  I couldn't find it.

It's in ggplot2 - http://had.co.nz/ggplot2/geom_line.html  -
?geom_line should find it too though (provided you have version 0.6 of
ggplot2)

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.


[R] Name of objects in a list

2008-04-24 Thread Marc
Hi useRs,

I am trying to compare several distance matrices obtained from subsets 
of variables from the same experiment. I put all the subsets in a list 
and then calculated the distance matrices with lapply. In order to do a 
mantel test between them I wrote a function the returns a list with the 
output of single tests. I would like to include the name of the tests, 
so I know what each element of the result list is. My code is as follows:

land - list(s1536 = s1536, s384L = s384L, s96L = s96L, s384c = s384c, 
s96c = s96c, s384r = s384r, s96r = s96r)
library(analogue)
ldis - lapply(land, function(x) as.dist(distance(x, method = mixed)))
mantel.list - function(x, ...) {
  require(ade4)
  for (i in 2:length(x)) {
x1 - x[[i - 1]]
x2 - x[[i]]
y[[i]] - mantel.rtest(x1, x2)
  }
  return(y)
}
lmantel - mantel.list(ldis)

  str(ldis)
List of 7
 $ s1536:Class 'dist'  atomic [1:15400] 0.357 0.260 0.341 0.342 0.267 ...
  .. ..- attr(*, Labels)= chr [1:176] CS301 CS302 CS303 CS304 ...
  .. ..- attr(*, Size)= int 176
  .. ..- attr(*, call)= language as.dist.default(m = distance(x, 
method = mixed))
  .. ..- attr(*, Diag)= logi FALSE
  .. ..- attr(*, Upper)= logi FALSE
 $ s384L:Class 'dist'  atomic [1:15400] 0.497 0.243 0.453 0.440 0.277 ...
  .. ..- attr(*, Labels)= chr [1:176] CS301 CS302 CS303 CS304 ...
  .. ..- attr(*, Size)= int 176
  .. ..- attr(*, call)= language as.dist.default(m = distance(x, 
method = mixed))
  .. ..- attr(*, Diag)= logi FALSE
  .. ..- attr(*, Upper)= logi FALSE

(...)

  str(lmantel)
List of 7
 $ :List of 5
  ..$ sim   : num [1:99]  0.007734  0.002429 -0.021489 -0.000181  
0.021703 ...
  ..$ obs   : num 0.785
  ..$ rep   : int 99
  ..$ pvalue: num 0.01
  ..$ call  : language mantelnoneuclid(m1 = m1, m2 = m2, nrepet = nrepet)
  ..- attr(*, class)= chr rtest
 $ :List of 5
  ..$ sim   : num [1:99]  0.00749  0.02850 -0.01301 -0.01376  0.00883 ...
  ..$ obs   : num 0.785
  ..$ rep   : int 99
  ..$ pvalue: num 0.01
  ..$ call  : language mantelnoneuclid(m1 = m1, m2 = m2, nrepet = nrepet)
  ..- attr(*, class)= chr rtest
(...)

I would like to get something like

  str(lmantel)
List of 7
 $ s1536_s384L
 :List of 5
  ..$ sim   : num [1:99]  0.007734  0.002429 -0.021489 -0.000181  
0.021703 ...
  ..$ obs   : num 0.785
  ..$ rep   : int 99
  ..$ pvalue: num 0.01
  ..$ call  : language mantelnoneuclid(m1 = m1, m2 = m2, nrepet = nrepet)
  ..- attr(*, class)= chr rtest
(...)

Thanks for your help.

Marc.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] temporal dependence?

2008-04-24 Thread wvguy8258

Hi,

I'm not sure where to look for help with this problem. I don't even know the
right search terms for it.

First let me describe the analysis.

I have land use data from satellite imagery (individual pixels or cells) for
years 1985 and 1990. I am recoding development as 1 and non-development
(forest, etc) as a zero. I am attempting to predict the probability of
transition by cell over these 5 years from 0 to 1 as a function of several
variables (slope, etc). I'm quite sure there will be spatial autocorrelation
since development breeds new development. I know of ways to deal with this
(autoregression, mixed models). I also expect a time dependency, if this is
the correct term, for the following reason. Development that occurs in 1986
will affect future time periods and 1987 will also, etc. So, the dependent
variables are not independent from each other either in space or time. I do
not know from the data what year a particular cell was developed only that
it occurred between 1985 and 1990. So, development will occur near other
development that occurred prior to it, but I don't know the time ordering
other than to say that development either occured before 1985 or between
1985 and 1990. 

I can think of a way to do this via simulation by starting at 1985 and
assuming a basic relationship between development, past development, and
other covariates (like slope). I would then apply this relationship to the
landscape as of 1985 to assign probabilities of development. Next, I could
develop some cells using a random number generator (creating a binary
landscape that is a possible realization of the model) and repeat the
process for 1986 and each year until 1990. I could do this many times and
see the frequency with which each cell was developed and use this to
estimate the likelihood. I could then adjust the functions in an attempt to
maximize likelihood. This is very brute-force and I don't want to do it, if
avoidable. 

Thanks for reading,
Seth

-- 
View this message in context: 
http://www.nabble.com/temporal-dependence--tp16850739p16850739.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] Documentation General Comments

2008-04-24 Thread Duncan Murdoch
On 4/24/2008 10:22 AM, Beck, Kenneth (STP) wrote:
 Agree that terseness is good, but I also agree with other posters that
 better cross referencing or maybe an index of synonyms would be good. 
 
 So far, the best suggestion is the pdf at this link 
 
 (http://www.medepi.net/epir/epir_chap02.pdf). 
 
 Is there a way to pop at least part of this into the R-base help page?

That's an easy question to answer:  no.  There is no way to just pop it 
in.  Incorporating it would take a lot of thought and work.

 Are there legal or copyright issues?

That's also easy:  yes, there are.  The authors of that chapter 
presumably have copyright in it (unless they've transferred it to 
someone else).  Without their permission it would be illegal to pop it 
into R.

  If I had known this from the start,
 it would have been much better. A good analogy is that old cartoon of
 the blind guys trying to figure out what an elephant is. The guys
 feeling at the front get a much different impression than the guys
 poking at the back side. I felt like that using R data structures,  had
 to blindly poke around trying different things, 90% of which did not
 work, yeilding only error messages, but now knowing the underlying
 organisation it is going much more smoothly. Ideally this kind of basic
 info would be in the core R docuemtation, you should not have to search
 this hard to get it!

All of the (correct) information in that chapter is in the core 
documentation.  They make a number of simplifications, which I think are 
appropriate for their audience, but you shouldn't believe everything you 
read there.  The core documentation has to aim for a different target, 
because it needs to be correct.

Duncan Murdoch

 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Bert Gunter
 Sent: Tuesday, April 22, 2008 10:29 AM
 To: r-help@r-project.org
 Subject: Re: [R] Documentation General Comments
 
 FWIW:
 
 I consider the documentation of Core R to be one of its great strengths:
 it is terse (read: to the point), detailed, and accurate. I find it
 eminently useful and helpful. Indeed, it was why I made the decision
 some years ago to switch from S-Plus to R (I readily acknowledge that
 S-Plus may have improved its docs since then -- haven't looked at it in
 years). While I understand that it may not suit everyone -- learning
 styles differ, after all -- may I at least say that there is one user
 out here who is appreciative of the hard work and care that has gone
 into the documentation. Far FAR better than anything I could do!
 
 -- Bert Gunter
 Genentech
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Greg Snow
 Sent: Tuesday, April 22, 2008 8:16 AM
 To: Beck, Kenneth (STP); r-help@r-project.org
 Subject: Re: [R] Documentation General Comments
 
 This is a case of you can't please everyone.  A while back there was
 some complaint that Introduction to R spent to much time on talking
 about the different types of variables, just the opposite complaint of
 yours.
 
 There are several other sources of documentation (look under the books
 link on the R homepage or the contributed documentation link on any CRAN
 site, also browse through the newsletter).  For more in depth
 information on variable types and object oriented programming in R you
 may want to invest in a copy of S Programming by Venables and Ripley.
 
 If you have specific questions (about data types, or other) then tell us
 what you have read and what you still do not understand and you are more
 likely to get a useful answer.  (also read the posting guide that is
 referenced at the bottom of almost all posts to the list).
 
 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 (801) 408-8111
  
  
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Beck, Kenneth (STP)
 Sent: Monday, April 21, 2008 3:56 PM
 To: r-help@r-project.org
 Subject: [R] Documentation General Comments
 
 I realize the R developers are probably overwhelmed and have little 
 time for this, but the documentation really needs some serious 
 reorganizaton.
 A good through description of basic variable types would help a lot, 
 e.g. the difference between lists, arrays, matrices and frames. And, 
 it appears there is some object-orientation to R, but it is not 
 complete. I can't, for instance find a metafile method for a 
 recordedplot type, using either the variable direclty or the 
 replayPlot() method. I am sorry to post this, but I am really having 
 trouble sorting out certain methods in R. The basic tutorial 
 Introduction to R is so basic, it hardly helps at all, then digging 
 through documentation is really an exercise in frustration. The 
 SimpleR is also so basic it is of little help other than to just get 
 started. I occasionally find answers in the mailing list. See my later
 
 post on recordPlot for a good 

[R] inverse F distribution in R?

2008-04-24 Thread Jennifer Balch
Dear all,

I'm looking for a function that calls the inverse F-distribution.  
Something equivalent to FINV in matlab or excel.

Does anyone know if such a function already exists for R? (I haven't  
been able to find one.)

Thanks for any leads.

Best,
Jennifer

__
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] inverse F distribution in R?

2008-04-24 Thread Jorge Ivan Velez
Hi Jennifer,

Try ?qf or  help.search(F distribution)

HTH,

Jorge

On Thu, Apr 24, 2008 at 10:49 AM, Jennifer Balch [EMAIL PROTECTED]
wrote:

 Dear all,

 I'm looking for a function that calls the inverse F-distribution.
 Something equivalent to FINV in matlab or excel.

 Does anyone know if such a function already exists for R? (I haven't
 been able to find one.)

 Thanks for any leads.

 Best,
 Jennifer

 __
 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] inverse F distribution in R?

2008-04-24 Thread Peter Dalgaard
Jennifer Balch wrote:
 Dear all,

 I'm looking for a function that calls the inverse F-distribution.  
 Something equivalent to FINV in matlab or excel.

 Does anyone know if such a function already exists for R? (I haven't  
 been able to find one.)

 Thanks for any leads.

   
I would guess that they are qf() or a variant thereof. I gather that
_fpdf
http://www.mathworks.com/access/helpdesk/help/toolbox/stats/fpdf.html__,
fcdf
http://www.mathworks.com/access/helpdesk/help/toolbox/stats/fcdf.html,
finv
http://www.mathworks.com/access/helpdesk/help/toolbox/stats/finv.html,
frnd
http://www.mathworks.com/access/helpdesk/help/toolbox/stats/frnd.html
i_n matlab is df, pf, qf, and rf in R. We don't have an equivalent of
fstat for mean and variance of the F distribution (this might actually
be nice to have).




 Best,
 Jennifer

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


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Documentation General Comments

2008-04-24 Thread Beck, Kenneth (STP)
OK I've spent a lot of time with the core documentation, and I never
found anything as simple as their table 2.1, which elucidated the
difference between a vector, matrix and array first, then the higher
level structures, frame and list.  Maybe I'm not a good searcher, but
believe me for every initial posting I submit to this group, I have
spent hours trying to find the answer elsewhere. And, as you state,
maybe I am now deluded by that presentation, maybe it is not this
simple!

Look at the help for data.frame. VERY terse explanation, with not a good
comparison to the other data types. Then, look at the titles list. Where
is a topic for data types Every other programming language I have used
(C++, Pascal, SAS, Java) has a basic chapter in the documentation that
goes over data types, what arrays are, higher level structures, etc.
When I typed help.search(data type) I get the following:

Help files with alias or concept or title matching 'data type' using
fuzzy matching:
character-class(methods)
Classes Corresponding to Basic Data Types
sqlTypeInfo(RODBC)  Request Information about DataTypes in an ODBC
Database

Looking for the term character-class(methods) yields nothing. I don't
think that is what I want!

Given all this complaining, I actually have completed several nice
project using R, it is an impressive package. Somehow, though, we need
to make the documentation better.

-Original Message-
From: Duncan Murdoch [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 24, 2008 9:51 AM
To: Beck, Kenneth (STP)
Cc: Bert Gunter; r-help@r-project.org
Subject: Re: [R] Documentation General Comments

On 4/24/2008 10:22 AM, Beck, Kenneth (STP) wrote:
 Agree that terseness is good, but I also agree with other posters that

 better cross referencing or maybe an index of synonyms would be good.
 
 So far, the best suggestion is the pdf at this link
 
 (http://www.medepi.net/epir/epir_chap02.pdf). 
 
 Is there a way to pop at least part of this into the R-base help page?

That's an easy question to answer:  no.  There is no way to just pop it
in.  Incorporating it would take a lot of thought and work.

 Are there legal or copyright issues?

That's also easy:  yes, there are.  The authors of that chapter
presumably have copyright in it (unless they've transferred it to
someone else).  Without their permission it would be illegal to pop it
into R.

  If I had known this from the start,
 it would have been much better. A good analogy is that old cartoon of 
 the blind guys trying to figure out what an elephant is. The guys 
 feeling at the front get a much different impression than the guys 
 poking at the back side. I felt like that using R data structures,  
 had to blindly poke around trying different things, 90% of which did 
 not work, yeilding only error messages, but now knowing the underlying

 organisation it is going much more smoothly. Ideally this kind of 
 basic info would be in the core R docuemtation, you should not have to

 search this hard to get it!

All of the (correct) information in that chapter is in the core
documentation.  They make a number of simplifications, which I think are
appropriate for their audience, but you shouldn't believe everything you
read there.  The core documentation has to aim for a different target,
because it needs to be correct.

Duncan Murdoch

 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
 On Behalf Of Bert Gunter
 Sent: Tuesday, April 22, 2008 10:29 AM
 To: r-help@r-project.org
 Subject: Re: [R] Documentation General Comments
 
 FWIW:
 
 I consider the documentation of Core R to be one of its great
strengths:
 it is terse (read: to the point), detailed, and accurate. I find it 
 eminently useful and helpful. Indeed, it was why I made the decision 
 some years ago to switch from S-Plus to R (I readily acknowledge that 
 S-Plus may have improved its docs since then -- haven't looked at it 
 in years). While I understand that it may not suit everyone -- 
 learning styles differ, after all -- may I at least say that there is 
 one user out here who is appreciative of the hard work and care that 
 has gone into the documentation. Far FAR better than anything I could
do!
 
 -- Bert Gunter
 Genentech
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
 On Behalf Of Greg Snow
 Sent: Tuesday, April 22, 2008 8:16 AM
 To: Beck, Kenneth (STP); r-help@r-project.org
 Subject: Re: [R] Documentation General Comments
 
 This is a case of you can't please everyone.  A while back there was 
 some complaint that Introduction to R spent to much time on talking 
 about the different types of variables, just the opposite complaint of

 yours.
 
 There are several other sources of documentation (look under the books

 link on the R homepage or the contributed documentation link on any 
 CRAN site, also browse through the newsletter).  For more in depth 
 information on 

Re: [R] inverse F distribution in R?

2008-04-24 Thread Matthias Kohl
just a comment to fstat...

Using package distrEx one also has fstat functionality

library(distrEx)
E(Fd(df1 = 3, df2 = 3))
E(Fd(df1 = 4, df2 = 4))
E(Fd(df1 = 5, df2 = 5))
var(Fd(df1 = 5, df2 = 5))

for more functionals (skewness, kurtosis, IQR, ...) see for instance
help(var, package = distrEx)

Best
Matthias

Peter Dalgaard wrote:
 Jennifer Balch wrote:
   
 Dear all,

 I'm looking for a function that calls the inverse F-distribution.  
 Something equivalent to FINV in matlab or excel.

 Does anyone know if such a function already exists for R? (I haven't  
 been able to find one.)

 Thanks for any leads.

   
 
 I would guess that they are qf() or a variant thereof. I gather that
 _fpdf
 http://www.mathworks.com/access/helpdesk/help/toolbox/stats/fpdf.html__,
 fcdf
 http://www.mathworks.com/access/helpdesk/help/toolbox/stats/fcdf.html,
 finv
 http://www.mathworks.com/access/helpdesk/help/toolbox/stats/finv.html,
 frnd
 http://www.mathworks.com/access/helpdesk/help/toolbox/stats/frnd.html
 i_n matlab is df, pf, qf, and rf in R. We don't have an equivalent of
 fstat for mean and variance of the F distribution (this might actually
 be nice to have).




   
 Best,
 Jennifer

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


   

-- 
Dr. Matthias Kohl
www.stamats.de

__
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] Documentation General Comments

2008-04-24 Thread hadley wickham
  Help files with alias or concept or title matching 'data type' using
  fuzzy matching:
  character-class(methods)
 Classes Corresponding to Basic Data Types
  sqlTypeInfo(RODBC)  Request Information about DataTypes in an ODBC
 Database


One small, but concrete improvement to the output from help.search
would be to list the functions like:

methods::character-class
Classes Corresponding to Basic Data Types
RODBC::sqlTypeInfo  Request Information about DataTypes in an ODBC
Database

and then extend ? to correctly parse (e.g.)  ?methods::character-class
 (although perhaps there a better display would be
methods::character-class).  This change would make function calling
and accessing documentation a little more consistent.

It would also be useful to list keywords in the help documentation, so
that one could more easily figure out what other documentation might
be related.

Hadley

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] Factor to numeric

2008-04-24 Thread Jojje Andersson
Hello!
 
Thanks!
 
I changed the , to . in both datafile and code but the problem remains 
identical.
Cheers!
Jojje
 



 Date: Thu, 24 Apr 2008 09:16:38 +0100 From: [EMAIL PROTECTED] To: [EMAIL 
 PROTECTED] CC: r-help@r-project.org Subject: Re: [R] Factor to numeric  
 The decimal point in R is always '.', never ','.  On Thu, 24 Apr 2008, 
 Jojje Andersson wrote:Hello!  I have a problem whith a data.frame. 
 I want to make a subset where some of the variables have values within 
 ceartain limits.  The variables are proportions like 1,00, 0,54, 0,00 etc. 
  I don't get it right as R take the variables for factors.
 ekobsub1 - subset(ekob, PAP0,25  PAP0,6  CAP0,1  CAP0,6  FAP0,1)  
 Error in `[.data.frame`(x, r, vars, drop = drop) : object CAP not found  
 In addition: Warning message:  In Ops.factor(PAP, 0) :  not meaningful for 
 factors   ekobn-as.numeric(as.character(ekob[[PAP]]))  Warning 
 message:  NAs introduced by coercionThanks!   /Jojje   
 _  [[elide!
 d Hotmail spam]]   px?sc_cmp2=JS_INT_SEMSN_NLPCV  [[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, [EMAIL 
PROTECTED] Professor of Applied Statistics, 
http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 
(self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 
1865 272595
_
[[elided Hotmail spam]]

[[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] help needed: Plotting step by step.

2008-04-24 Thread Charles C. Berry
On Thu, 24 Apr 2008, Atul Kulkarni wrote:

 Hi,

 Thanks for help.

 The ecdf has jumps of 1/n but I need jumps of 1. How do I do this? if I can

See
?stepfun

HTH,

Chuck
 do this then I think Ic an plot the data properly. I am plotting epidemic
 simulation and want to plot my 2 processes Infection and Symptoms (after
 incubation) on the same chart to compare them.

 Atul.

 On Wed, Apr 23, 2008 at 12:35 PM, Charles C. Berry [EMAIL PROTECTED]
 wrote:


 Maybe like this?

  proc.1 - rexp(200,1)
 proc.2 - rexp(200,2)
 plot( ecdf( proc.1 ), xlim=range( proc.1, proc.2 ) )
 plot( ecdf( proc.2 ), add=T, col.points='red' )


 See

?ecdf
?plot.stepfun


 HTH,

 Chuck


 On Wed, 23 Apr 2008, Greg Snow wrote:

  Can you show us the code you used for the 5 to 10 points? (either
 generate some random data, or use a sample dataset).

 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 (801) 408-8111



  -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Atul Kulkarni
 Sent: Wednesday, April 23, 2008 9:07 AM
 To: r-help@r-project.org
 Subject: [R] help needed: Plotting step by step.

 Hello,

 I have generated 2 Poisson processes and want to plot them on
 a single graph in a step by step manner in order to be able
 to compare them. I tried plot and biplot but it does not
 help, I could connect two points by hand for point graph if
 they were 5 or 10 I have more than 200 such point to be
 connected and Poisson cluster makes it difficult for me to
 even read them properly.

 Can anyone tell me which is the function that can plot a
 stepwise graph for me? I did google over the plot for step
 fun but did not understand much of it. A simpler help would
 be more useful to me, as I am not a expert either in Statistics or R.

 Regards,
 Atul.

 --
 Atul S. Kulkarni
 Graduate Student,
 Department of Computer Science,
 University Of Minnesota,
 Duluth, MN 55812.
 www.d.umn.edu/~kulka053 http://www.d.umn.edu/%7Ekulka053
 -
 Before you start some work, always ask yourself three
 questions - Why am I doing it, What the results might be and
 Will I be successful. Only when you think deeply and find
 satisfactory answers to these questions, go ahead.
 Chanakya quotes (Indian politician, strategist and writer,
 350 BC-275 BC)

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


 Charles C. Berry(858) 534-2098
Dept of Family/Preventive
 Medicine
 E mailto:[EMAIL PROTECTED]   UC San Diego
 http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901





 -- 
 Atul S. Kulkarni
 Graduate Student,
 Department of Computer Science,
 University Of Minnesota,
 Duluth, MN 55812.
 www.d.umn.edu/~kulka053
 -
 Before you start some work, always ask yourself three questions - Why am I
 doing it, What the results might be and Will I be successful. Only when you
 think deeply and find satisfactory answers to these questions, go ahead.
 Chanakya quotes (Indian politician, strategist and writer, 350 BC-275 BC)


Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
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 needed: Plotting step by step.

2008-04-24 Thread Atul Kulkarni
Hi,

Thanks for help.

The ecdf has jumps of 1/n but I need jumps of 1. How do I do this? if I can
do this then I think Ic an plot the data properly. I am plotting epidemic
simulation and want to plot my 2 processes Infection and Symptoms (after
incubation) on the same chart to compare them.

Atul.

On Wed, Apr 23, 2008 at 12:35 PM, Charles C. Berry [EMAIL PROTECTED]
wrote:


 Maybe like this?

  proc.1 - rexp(200,1)
  proc.2 - rexp(200,2)
  plot( ecdf( proc.1 ), xlim=range( proc.1, proc.2 ) )
  plot( ecdf( proc.2 ), add=T, col.points='red' )
 
 
 See

?ecdf
?plot.stepfun


 HTH,

 Chuck


 On Wed, 23 Apr 2008, Greg Snow wrote:

  Can you show us the code you used for the 5 to 10 points? (either
  generate some random data, or use a sample dataset).
 
  --
  Gregory (Greg) L. Snow Ph.D.
  Statistical Data Center
  Intermountain Healthcare
  [EMAIL PROTECTED]
  (801) 408-8111
 
 
 
   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] On Behalf Of Atul Kulkarni
   Sent: Wednesday, April 23, 2008 9:07 AM
   To: r-help@r-project.org
   Subject: [R] help needed: Plotting step by step.
  
   Hello,
  
   I have generated 2 Poisson processes and want to plot them on
   a single graph in a step by step manner in order to be able
   to compare them. I tried plot and biplot but it does not
   help, I could connect two points by hand for point graph if
   they were 5 or 10 I have more than 200 such point to be
   connected and Poisson cluster makes it difficult for me to
   even read them properly.
  
   Can anyone tell me which is the function that can plot a
   stepwise graph for me? I did google over the plot for step
   fun but did not understand much of it. A simpler help would
   be more useful to me, as I am not a expert either in Statistics or R.
  
   Regards,
   Atul.
  
   --
   Atul S. Kulkarni
   Graduate Student,
   Department of Computer Science,
   University Of Minnesota,
   Duluth, MN 55812.
   www.d.umn.edu/~kulka053 http://www.d.umn.edu/%7Ekulka053
   -
   Before you start some work, always ask yourself three
   questions - Why am I doing it, What the results might be and
   Will I be successful. Only when you think deeply and find
   satisfactory answers to these questions, go ahead.
   Chanakya quotes (Indian politician, strategist and writer,
   350 BC-275 BC)
  
  [[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.
 
 
 Charles C. Berry(858) 534-2098
Dept of Family/Preventive
 Medicine
 E mailto:[EMAIL PROTECTED]   UC San Diego
 http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901





-- 
Atul S. Kulkarni
Graduate Student,
Department of Computer Science,
University Of Minnesota,
Duluth, MN 55812.
www.d.umn.edu/~kulka053
-
Before you start some work, always ask yourself three questions - Why am I
doing it, What the results might be and Will I be successful. Only when you
think deeply and find satisfactory answers to these questions, go ahead.
Chanakya quotes (Indian politician, strategist and writer, 350 BC-275 BC)

[[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 to numeric

2008-04-24 Thread Prof Brian Ripley

On Thu, 24 Apr 2008, Jojje Andersson wrote:


Hello!
 
Thanks!
 
I changed the , to . in both datafile and code but the problem remains 
identical.


Then we will need a reproducible example, as requested in the message 
footer.


BTW, your example is a perfect illustration of the problem.  Unless spaces 
are significant (and they are not in general in R nor in most computer 
languages)


1,00, 0,54, 0,00

looks just like

1, 00, 0, 54, 0, 00

and R's parser takes it as such.




Cheers!
Jojje



 

__
 Date: Thu, 24 Apr 2008 09:16:38 +0100
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 CC: r-help@r-project.org
 Subject: Re: [R] Factor to numeric

 The decimal point in R is always '.', never ','.

 On Thu, 24 Apr 2008, Jojje Andersson wrote:

 
  Hello!
  I have a problem whith a data.frame. I want to make a subset where some of 
the
variables have values within ceartain limits.
  The variables are proportions like 1,00, 0,54, 0,00 etc.
  I don't get it right as R take the variables for factors.
 
 
  ekobsub1 - subset(ekob, PAP0,25  PAP0,6  CAP0,1  CAP0,6  FAP0,1)
  Error in `[.data.frame`(x, r, vars, drop = drop) : object CAP not found
  In addition: Warning message:
  In Ops.factor(PAP, 0) :  not meaningful for factors
 
  ekobn-as.numeric(as.character(ekob[[PAP]]))
  Warning message:
  NAs introduced by coercion
 
 
  Thanks!
 
  /Jojje
 
  _
  [[elided Hotmail spam]]
 
  px?sc_cmp2=JS_INT_SEMSN_NLPCV
  [[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, [EMAIL PROTECTED]
 Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel: +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UK Fax: +44 1865 272595

__
Tokbilliga solresor  gratis reseguider! MSN Resor



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Factor to numeric

2008-04-24 Thread Jorge Ivan Velez
Hi Jojje,

Try this:

ekob=data.frame(PAP=seq(0,4,by=0.5),CAP=seq(1,5,by=0.5),FAP=seq(4,8,by=0.5))
attach(ekob)

# Option 1
ekob[PAP1.5  PAP0.5  CAP1  CAP3  FAP4,]

# Option 2
subset(ekob,PAP1.5  PAP0.5  CAP1  CAP3  FAP4)

HTH,

Jorge


On Thu, Apr 24, 2008 at 11:31 AM, Jojje Andersson [EMAIL PROTECTED]
wrote:

 Hello!

 Thanks!

 I changed the , to . in both datafile and code but the problem remains
 identical.
 Cheers!
 Jojje




  Date: Thu, 24 Apr 2008 09:16:38 +0100 From: [EMAIL PROTECTED] To:
 [EMAIL PROTECTED] CC: r-help@r-project.org Subject: Re: [R] Factor
 to numeric  The decimal point in R is always '.', never ','.  On Thu, 24
 Apr 2008, Jojje Andersson wrote:Hello!  I have a problem whith a
 data.frame. I want to make a subset where some of the variables have values
 within ceartain limits.  The variables are proportions like 1,00, 0,54,
 0,00 etc.  I don't get it right as R take the variables for factors. 
   ekobsub1 - subset(ekob, PAP0,25  PAP0,6  CAP0,1  CAP0,6 
 FAP0,1)  Error in `[.data.frame`(x, r, vars, drop = drop) : object CAP
 not found  In addition: Warning message:  In Ops.factor(PAP, 0) :  not
 meaningful for factors  
 ekobn-as.numeric(as.character(ekob[[PAP]]))  Warning message:  NAs
 introduced by coercionThanks!   /Jojje  
 _ 
 [[elide!
  d Hotmail spam]]   px?sc_cmp2=JS_INT_SEMSN_NLPCV  [[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, [EMAIL PROTECTED] Professor of Applied Statistics,
 http://www.stats.ox.ac.uk/~ripley/ http://www.stats.ox.ac.uk/%7Eripley/
 University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44
 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
 _
 [[elided Hotmail spam]]

[[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] Documentation General Comments

2008-04-24 Thread Martin Maechler
Hmm,

 KeBe == Beck, Kenneth (STP) [EMAIL PROTECTED]
 on Thu, 24 Apr 2008 10:12:19 -0500 writes:

KeBe OK I've spent a lot of time with the core
KeBe documentation, and I never found anything as simple as
KeBe their table 2.1, which elucidated the difference
KeBe between a vector, matrix and array first, then the
KeBe higher level structures, frame and list.  Maybe I'm
KeBe not a good searcher, but believe me for every initial
KeBe posting I submit to this group, I have spent hours
KeBe trying to find the answer elsewhere. And, as you
KeBe state, maybe I am now deluded by that presentation,
KeBe maybe it is not this simple!

Well, I get the impression that you've never read the manual
  Introduction to R 
  (or some good book such as Peter Dalgaard's)
but have directly jumped into reading  help() pages  ???

Maybe a good idea would be to improve the Introduction to R
rather than thinking of misusing the help() collection
{which is the reference manual, not the user manual !!}
by making it easy to understand (and consequently less precise) ??

Patches (well reflected ..) to the Introduction are quite
welcome, indeed.
The (development) source is always available
at https://svn.r-project.org/R/trunk/doc/manual/R-intro.texi

(and yes, the source does look a bit less user-friendly, 
 than its PDF output, e.g.
 http://cran.r-project.org/doc/manuals/R-intro.pdf
 or its  daily updated  HTML output at
 http://stat.ethz.ch/R-manual/R-devel/doc/manual/R-intro.html
)

Regards,
Martin

KeBe Look at the help for data.frame. VERY terse
KeBe explanation, with not a good comparison to the other
KeBe data types. Then, look at the titles list. Where is a
KeBe topic for data types Every other programming
KeBe language I have used (C++, Pascal, SAS, Java) has a
KeBe basic chapter in the documentation that goes over data
KeBe types, what arrays are, higher level structures, etc.
KeBe When I typed help.search(data type) I get the
KeBe following:

KeBe Help files with alias or concept or title matching
KeBe 'data type' using fuzzy matching:
KeBe character-class(methods) Classes Corresponding to
KeBe Basic Data Types sqlTypeInfo(RODBC) Request
KeBe Information about DataTypes in an ODBC Database

KeBe Looking for the term character-class(methods) yields
KeBe nothing. I don't think that is what I want!

KeBe Given all this complaining, I actually have completed
KeBe several nice project using R, it is an impressive
KeBe package. Somehow, though, we need to make the
KeBe documentation better.

KeBe -Original Message- From: Duncan Murdoch
KeBe [mailto:[EMAIL PROTECTED] Sent: Thursday, April
KeBe 24, 2008 9:51 AM To: Beck, Kenneth (STP) Cc: Bert
KeBe Gunter; r-help@r-project.org Subject: Re: [R]
KeBe Documentation General Comments

KeBe On 4/24/2008 10:22 AM, Beck, Kenneth (STP) wrote:
 Agree that terseness is good, but I also agree with other
 posters that

 better cross referencing or maybe an index of synonyms
 would be good.
 
 So far, the best suggestion is the pdf at this link
 
 (http://www.medepi.net/epir/epir_chap02.pdf).
 
 Is there a way to pop at least part of this into the
 R-base help page?

KeBe That's an easy question to answer: no.  There is no
KeBe way to just pop it in.  Incorporating it would take a
KeBe lot of thought and work.

 Are there legal or copyright issues?

KeBe That's also easy: yes, there are.  The authors of that
KeBe chapter presumably have copyright in it (unless
KeBe they've transferred it to someone else).  Without
KeBe their permission it would be illegal to pop it into R.

KeBe   If I had known this from the start,
 it would have been much better. A good analogy is that
 old cartoon of the blind guys trying to figure out what
 an elephant is. The guys feeling at the front get a much
 different impression than the guys poking at the back
 side. I felt like that using R data structures, had to
 blindly poke around trying different things, 90% of which
 did not work, yeilding only error messages, but now
 knowing the underlying

 organisation it is going much more smoothly. Ideally this
 kind of basic info would be in the core R docuemtation,
 you should not have to

 search this hard to get it!

KeBe All of the (correct) information in that chapter is in
KeBe the core documentation.  They make a number of
KeBe simplifications, which I think are appropriate for
KeBe their audience, but you shouldn't believe everything
KeBe you read there.  The core documentation has to aim for
KeBe a different target, because it needs to be correct.

KeBe Duncan Murdoch

 
 -Original Message- From:
 [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Bert
 Gunter 

Re: [R] Factor to numeric

2008-04-24 Thread Don MacQueen
If you have a variable that is supposed to be numeric, but R thinks 
it is a factor, then you may (probably) have something in your input 
that is not a number. You changed the commas to decimal points at 
Prof. Ripley's suggestion. You still have the same error message. 
Therefore, you probably still have something in your input that is 
not a number.

try:
   unique(ekob$PAP)
and see what you get

Assuming you created this dataframe using read.table() (or 
read.delim(), etc.), I'd suggest you read the documentation for that 
function very carefully, and inspect your input data for non-numeric 
strings where there should be a numeric string.

It would be helpful if you show what you tried, and the error 
message, from *after* you changed to decimal points.

-Don

At 5:31 PM +0200 4/24/08, Jojje Andersson wrote:
Hello!

Thanks!

I changed the , to . in both datafile and code but the problem 
remains identical.
Cheers!
Jojje




  Date: Thu, 24 Apr 2008 09:16:38 +0100 From: 
[EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: 
r-help@r-project.org Subject: Re: [R] Factor to numeric  The 
decimal point in R is always '.', never ','.  On Thu, 24 Apr 
2008, Jojje Andersson wrote:Hello!  I have a problem 
whith a data.frame. I want to make a subset where some of the 
variables have values within ceartain limits.  The variables are 
proportions like 1,00, 0,54, 0,00 etc.  I don't get it right as R 
take the variables for factors.ekobsub1 - subset(ekob, 
PAP0,25  PAP0,6  CAP0,1  CAP0,6  FAP0,1)  Error in 
`[.data.frame`(x, r, vars, drop = drop) : object CAP not found  
In addition: Warning message:  In Ops.factor(PAP, 0) :  not 
meaningful for factors   
ekobn-as.numeric(as.character(ekob[[PAP]]))  Warning 
message:  NAs introduced by coercionThanks!   
/Jojje   
_  
[[elide!
  d Hotmail spam]]   px?sc_cmp2=JS_INT_SEMSN_NLPCV  
[[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, [EMAIL PROTECTED] Professor of Applied 
Statistics, http://www.stats.ox.ac.uk/~ripley/ University of 
Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 
272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
_
[[elided Hotmail spam]]

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


-- 
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062

__
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] Documentation General Comments

2008-04-24 Thread Duncan Murdoch
On 4/24/2008 12:08 PM, Martin Maechler wrote:
 Hmm,
 
 KeBe == Beck, Kenneth (STP) [EMAIL PROTECTED]
 on Thu, 24 Apr 2008 10:12:19 -0500 writes:
 
 KeBe OK I've spent a lot of time with the core
 KeBe documentation, and I never found anything as simple as
 KeBe their table 2.1, which elucidated the difference
 KeBe between a vector, matrix and array first, then the
 KeBe higher level structures, frame and list.  Maybe I'm
 KeBe not a good searcher, but believe me for every initial
 KeBe posting I submit to this group, I have spent hours
 KeBe trying to find the answer elsewhere. And, as you
 KeBe state, maybe I am now deluded by that presentation,
 KeBe maybe it is not this simple!
 
 Well, I get the impression that you've never read the manual
   Introduction to R 
   (or some good book such as Peter Dalgaard's)
 but have directly jumped into reading  help() pages  ???

That's not correct.  Kenneth started the thread (on Monday) saying:

The basic tutorial Introduction to R is so basic, it
hardly helps at all, then digging through documentation is really an
exercise in frustration.

Duncan Murdoch

 
 Maybe a good idea would be to improve the Introduction to R
 rather than thinking of misusing the help() collection
 {which is the reference manual, not the user manual !!}
 by making it easy to understand (and consequently less precise) ??
 
 Patches (well reflected ..) to the Introduction are quite
 welcome, indeed.
 The (development) source is always available
 at https://svn.r-project.org/R/trunk/doc/manual/R-intro.texi
 
 (and yes, the source does look a bit less user-friendly, 
  than its PDF output, e.g.
  http://cran.r-project.org/doc/manuals/R-intro.pdf
  or its  daily updated  HTML output at
  http://stat.ethz.ch/R-manual/R-devel/doc/manual/R-intro.html
 )
 
 Regards,
 Martin
 
 KeBe Look at the help for data.frame. VERY terse
 KeBe explanation, with not a good comparison to the other
 KeBe data types. Then, look at the titles list. Where is a
 KeBe topic for data types Every other programming
 KeBe language I have used (C++, Pascal, SAS, Java) has a
 KeBe basic chapter in the documentation that goes over data
 KeBe types, what arrays are, higher level structures, etc.
 KeBe When I typed help.search(data type) I get the
 KeBe following:
 
 KeBe Help files with alias or concept or title matching
 KeBe 'data type' using fuzzy matching:
 KeBe character-class(methods) Classes Corresponding to
 KeBe Basic Data Types sqlTypeInfo(RODBC) Request
 KeBe Information about DataTypes in an ODBC Database
 
 KeBe Looking for the term character-class(methods) yields
 KeBe nothing. I don't think that is what I want!
 
 KeBe Given all this complaining, I actually have completed
 KeBe several nice project using R, it is an impressive
 KeBe package. Somehow, though, we need to make the
 KeBe documentation better.
 
 KeBe -Original Message- From: Duncan Murdoch
 KeBe [mailto:[EMAIL PROTECTED] Sent: Thursday, April
 KeBe 24, 2008 9:51 AM To: Beck, Kenneth (STP) Cc: Bert
 KeBe Gunter; r-help@r-project.org Subject: Re: [R]
 KeBe Documentation General Comments
 
 KeBe On 4/24/2008 10:22 AM, Beck, Kenneth (STP) wrote:
  Agree that terseness is good, but I also agree with other
  posters that
 
  better cross referencing or maybe an index of synonyms
  would be good.
  
  So far, the best suggestion is the pdf at this link
  
  (http://www.medepi.net/epir/epir_chap02.pdf).
  
  Is there a way to pop at least part of this into the
  R-base help page?
 
 KeBe That's an easy question to answer: no.  There is no
 KeBe way to just pop it in.  Incorporating it would take a
 KeBe lot of thought and work.
 
  Are there legal or copyright issues?
 
 KeBe That's also easy: yes, there are.  The authors of that
 KeBe chapter presumably have copyright in it (unless
 KeBe they've transferred it to someone else).  Without
 KeBe their permission it would be illegal to pop it into R.
 
 KeBe   If I had known this from the start,
  it would have been much better. A good analogy is that
  old cartoon of the blind guys trying to figure out what
  an elephant is. The guys feeling at the front get a much
  different impression than the guys poking at the back
  side. I felt like that using R data structures, had to
  blindly poke around trying different things, 90% of which
  did not work, yeilding only error messages, but now
  knowing the underlying
 
  organisation it is going much more smoothly. Ideally this
  kind of basic info would be in the core R docuemtation,
  you should not have to
 
  search this hard to get it!
 
 KeBe All of the (correct) information in that chapter is in
 KeBe the core documentation.  They make a number of
 KeBe 

Re: [R] Minimise a parameter of a given function f, with f 0

2008-04-24 Thread Kevin Lu
The function is

f(s,t) = ( a1*t + a2*t^2 + ( a3*t + a4*t^2 )*d1*s^2*t^2 + (a5*t +
a6*t^2)*d1^2*b^4*t^4 )*exp(-0.5*d1*s^2*t^2) + a8

where a1,a2,...,a8,d1 are some constants (can be positive or negative),
which are computed from a given set of data.

The objective is to find the minimum value of s 0.5, which satisfies f(s,t)
0 where t can be any value on the real line. It may be that such s does not
exist for the given dataset

If the conditions f(s,t)0 and s0.5 were not needed, then optim could be
used to find the minimum values for both (s,t) with the range setting at
-Inf and Inf.

I suppose one way to do it (I haven't tried out) is to substitute the values
of (s,t) found and see if they satisfy f(s,t)0, but it may be that s found
is  0.5, and there is another one just 0.5 There are also other potential
problems and computational disadvantages.


2008/4/24 Paul Smith [EMAIL PROTECTED]:

 On Wed, Apr 23, 2008 at 8:51 PM, Kevin Lu [EMAIL PROTECTED] wrote:
   I need to find the minimum value of the parameter, s, such that the
 function
   f(s,t)  0 (where -Inf  t  Inf)
 
   I've looked into optim, constrOptim and others but they don't seem to do
   this. Des anyone have some suggestions?

 In order to allow us to help you, please send us a minimal example.

 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.


[[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] truncate row names

2008-04-24 Thread Summer Nitely
Hi,

I would like to truncate row names.  Is that possible?

I ran a regression with the covariates in a matrix, and in the results the
coefficients have the matrix name concatenated with the variable name:


 full.t.ag - Icens(lfirst_well, llast_well, lfirst_ill, formula=~ t.ag.X,
breaks=t.ag.int, data=t.ag)
 full.t.ag$cov$coeff

  t.ag.Xnyearct.ag.Xhorset.ag.Xswine  t.ag.Xpett.ag.Xother
t.ag.Xpoultry t.ag.Xyr.horse
   -0.29497437 0.77857817-0.53315929-1.02745065
-0.17775268-0.08237047-0.36606818


I want these coefficients to have the t.ag.X removed from the names. ie.
nyearchorse swine
petother  poultry yr.horse
   -0.29497437 0.77857817-0.53315929-1.02745065
-0.17775268-0.08237047-0.36606818


I have a lot of results, so going through and renaming every row is not a
very appealing option.  Is there another way?  Is there a way to cut off the
first 5 character positions in the row name?  Or to force R to take the
column names rather than concatenate the matrix and column names in the
regression?

Any help would be greatly appreciated.
Thanks,
Summer

[[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] truncate row names

2008-04-24 Thread Henrique Dallazuanna
Try:

cof - full.t.ag$cov$coeff
gsub(t.ag.X, , names(cof))

On Thu, Apr 24, 2008 at 1:47 PM, Summer Nitely [EMAIL PROTECTED]
wrote:

 Hi,

 I would like to truncate row names.  Is that possible?

 I ran a regression with the covariates in a matrix, and in the results the
 coefficients have the matrix name concatenated with the variable name:


  full.t.ag - Icens(lfirst_well, llast_well, lfirst_ill, formula=~
 t.ag.X,
 breaks=t.ag.int, data=t.ag)
  full.t.ag$cov$coeff

  t.ag.Xnyearct.ag.Xhorset.ag.Xswine  t.ag.Xpett.ag.Xother
 t.ag.Xpoultry t.ag.Xyr.horse
   -0.29497437 0.77857817-0.53315929-1.02745065
 -0.17775268-0.08237047-0.36606818


 I want these coefficients to have the t.ag.X removed from the names. ie.
 nyearchorse swine
 petother  poultry yr.horse
   -0.29497437 0.77857817-0.53315929-1.02745065
 -0.17775268-0.08237047-0.36606818


 I have a lot of results, so going through and renaming every row is not a
 very appealing option.  Is there another way?  Is there a way to cut off
 the
 first 5 character positions in the row name?  Or to force R to take the
 column names rather than concatenate the matrix and column names in the
 regression?

 Any help would be greatly appreciated.
 Thanks,
 Summer

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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 Newbie Question/Data Model

2008-04-24 Thread guox
Given a data set and a set of predictors and a response in the data,
we would like to find a model that fits the data set best.
Suppose that we do not know what kind of model (linear, polynomial
regression,... ) might be good, we are wondering if there is R-package(s)
can auctomatically do this.
Otherwise, can you direct me, or point out reference(s),
basic steps to do this. Thanks.

-james

__
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] alternatives to RColorBrewer?

2008-04-24 Thread Andrew Yee
I've found RColorBrewer useful for its qualitative palettes, but wished that
it could generate more than 12 qualitative palettes (e.g. with Set3).  Any
suggestions for alternative color palette generators that can handle e.g. 18
distinctive colors?  (I'm aware of using rainbow(), but this doesn't
generate enough distinct colors when the number of palettes is large).

Thanks,
Andrew

[[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] alternatives to RColorBrewer?

2008-04-24 Thread Dieter Menne
Andrew Yee andrewjyee at gmail.com writes:

 
 I've found RColorBrewer useful for its qualitative palettes, but wished that
 it could generate more than 12 qualitative palettes (e.g. with Set3).  Any
 suggestions for alternative color palette generators that can handle e.g. 18
 distinctive colors?  (I'm aware of using rainbow(), but this doesn't
 generate enough distinct colors when the number of palettes is large).

Assume you want 40 colors, get a basic color palette from RcolorBrewer, and use
colorRampPalette to interpolate

# Brewer palette Paired 12
pal12 = c(#A6CEE3, #1F78B4, #B2DF8A, #33A02C, #FB9A99, 
#E31A1C, #FDBF6F, #FF7F00, #CAB2D6, #6A3D9A,
#99, #B15928)

colorRampPalette(pal12)(40)

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.


Re: [R] alternatives to RColorBrewer?

2008-04-24 Thread Achim Zeileis
On Thu, 24 Apr 2008, Andrew Yee wrote:

 I've found RColorBrewer useful for its qualitative palettes, but wished that
 it could generate more than 12 qualitative palettes (e.g. with Set3).  Any
 suggestions for alternative color palette generators that can handle e.g. 18
 distinctive colors?  (I'm aware of using rainbow(), but this doesn't
 generate enough distinct colors when the number of palettes is large).

Package vcd implements several palette generators in HCL space which are
somewhat similar to the palettes in ColorBrewer but provide some more
flexibility. The underlying ideas are explained here
  http://epub.wu-wien.ac.at/dyn/openURL?id=oai:epub.wu-wien.ac.at:epub-wu-01_c87
See also help(rainbow_hcl, package = vcd) which has a few more
examples. However, I guess that it will be hard to select a qualitative
palette with 18 distinct colors...I couldn't imagine a plot where it would
be sufficiently easy for humans to decode that. But maybe you can combine
that with some sequential or diverging palette or so?

Best,
Z

 Thanks,
 Andrew

   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] re shaping long-form longitudinal data from sql query

2008-04-24 Thread Tubin

hi, I'm a total noob who is having to ramp up to full speed very quickly due
to an unfortunate abrupt staffing change at my job :)

I have longitudinal data that looks like this:
   PID OBSDATEDaysAgo CleanValue  
NAME
1  1410164934000610  8/17/2004 13:03:3813456.2HGBA1C
2  1410164934000610 11/16/2004 10:39:5112547.1HGBA1C
...etc

I'd like to end up with a wide-format table like:
PID OBSDATE.1DaysAgo.1CleanValue.1 [...] OBSDATE.n   DaysAgo.n   
CleanValue.n

The problem:  Every patient's on a different schedule, so there's no natural
timevar value to reshape with.

My solution involved creating another column for the timevar and looping
through the dataframe to populate that column with correct values; however,
it's a pretty big table and so the loop runs really slowly.  I need to do
this particular operation on quite a few datafiles on a regular basis, and
my database keeps getting bigger - so I anticipate this solution won't be
ideal in the future.

Can anyone recommend a more efficient solution?  

-- 
View this message in context: 
http://www.nabble.com/reshaping-%22long-form%22-longitudinal-data-from-sql-query-tp16851308p16851308.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] extracting averages from smooth.ppp output on spatstat

2008-04-24 Thread Graham Smith
I have used smooth.ppp in spatstat to create a smoothed surface plot based
on randomly selected depths across a lake (as marks).

I wonder if based on the smoothed surface plot if I can calculate the
average depth for each 10x10 grid square across the lake.

I can't see any obvious way of doing this and would appreciate some
pointers.

Many thanks,

Graham

[[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 with image.smooth

2008-04-24 Thread F. De Sales
   Hi all,
   I was wondering if anyone in here is familiar with
the command image.smooth.
   How can set the arguments dx, dy and theta so my
resulting matrix is not smoothed out too much?
   Thank you.

   


  


[[elided Yahoo spam]]

__
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] alternatives to RColorBrewer?

2008-04-24 Thread Andrew Yee
Great, thanks, that was helpful.

Andrew

On Thu, Apr 24, 2008 at 2:15 PM, Achim Zeileis [EMAIL PROTECTED]
wrote:

 On Thu, 24 Apr 2008, Andrew Yee wrote:

  I've found RColorBrewer useful for its qualitative palettes, but wished
 that
  it could generate more than 12 qualitative palettes (e.g. with Set3).
  Any
  suggestions for alternative color palette generators that can handle e.g.
 18
  distinctive colors?  (I'm aware of using rainbow(), but this doesn't
  generate enough distinct colors when the number of palettes is large).

 Package vcd implements several palette generators in HCL space which are
 somewhat similar to the palettes in ColorBrewer but provide some more
 flexibility. The underlying ideas are explained here

 http://epub.wu-wien.ac.at/dyn/openURL?id=oai:epub.wu-wien.ac.at:epub-wu-01_c87
 See also help(rainbow_hcl, package = vcd) which has a few more
 examples. However, I guess that it will be hard to select a qualitative
 palette with 18 distinct colors...I couldn't imagine a plot where it would
 be sufficiently easy for humans to decode that. But maybe you can combine
 that with some sequential or diverging palette or so?

 Best,
 Z

  Thanks,
  Andrew
 
[[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] alternatives to RColorBrewer?

2008-04-24 Thread Dieter Menne
Achim Zeileis Achim.Zeileis at wu-wien.ac.at writes:
 However, I guess that it will be hard to select a qualitative
 palette with 18 distinct colors...I couldn't imagine a plot where it would
 be sufficiently easy for humans to decode that. But maybe you can combine
 that with some sequential or diverging palette or so?

I slightly disagree here. In many cases, in color-coded surface plots, you do
not want to attribute the colors to, let's say, altitudes, but rather use the
color transitions as contour lines without explicitly drawing contours. You
could also use continuous colors, but it is amazing how this fails, while
something like 25 colors looks good.

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.


Re: [R] re shaping long-form longitudinal data from sql query

2008-04-24 Thread Gabor Grothendieck
If DF is your data frame then create a time column like this:

DF$time - ave(DF$DaysAgo, DF$PID, FUN = seq_along)

and now use the reshape command on DF (or melt/cast
from the reshape package).

On Thu, Apr 24, 2008 at 2:13 PM, Tubin [EMAIL PROTECTED] wrote:

 hi, I'm a total noob who is having to ramp up to full speed very quickly due
 to an unfortunate abrupt staffing change at my job :)

 I have longitudinal data that looks like this:
   PID OBSDATEDaysAgo CleanValue
 NAME
 1  1410164934000610  8/17/2004 13:03:3813456.2HGBA1C
 2  1410164934000610 11/16/2004 10:39:5112547.1HGBA1C
 ...etc

 I'd like to end up with a wide-format table like:
 PID OBSDATE.1DaysAgo.1CleanValue.1 [...] OBSDATE.n   DaysAgo.n
 CleanValue.n

 The problem:  Every patient's on a different schedule, so there's no natural
 timevar value to reshape with.

 My solution involved creating another column for the timevar and looping
 through the dataframe to populate that column with correct values; however,
 it's a pretty big table and so the loop runs really slowly.  I need to do
 this particular operation on quite a few datafiles on a regular basis, and
 my database keeps getting bigger - so I anticipate this solution won't be
 ideal in the future.

 Can anyone recommend a more efficient solution?

 --
 View this message in context: 
 http://www.nabble.com/reshaping-%22long-form%22-longitudinal-data-from-sql-query-tp16851308p16851308.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] a simple question of importing data

2008-04-24 Thread tzsmile

i just want to read data from Excel and i copied it and pasted into a txt
file.
then i want to use read.table to read it. but however i tried, it doesn't
work.
can someone help me?
data is attached.
thanks http://www.nabble.com/file/p16851853/weekly.txt weekly.txt 
-- 
View this message in context: 
http://www.nabble.com/a-simple-question-of-importing-data-tp16851853p16851853.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] R Newbie Question/Data Model

2008-04-24 Thread Greg Snow
First off there are multiple definitions of best, you need to decide
which best is best for you.

Second, for reasonable definitions of best, deciding between, linear,
polynomial, and ... Requires backgroud knowledge and real thought.

R can fit many different models and give you numerical and graphical
summaries of those models, but determining the best model requires at
least 1 person, some actual knowledge, and some real thought.

Basic steps:  Take a bunch more statistics classes and/or hire a
statistician.

If you can come back with a bit more of an example of what you are
trying to accomplish along with background, what you mean by best, and
show what your thought process has been so far, then we may be able to
direct you better.  You should also read through the posting guide that
is linked to at the bottom of most posts to the group.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
 Sent: Thursday, April 24, 2008 10:58 AM
 To: r-help@r-project.org
 Subject: [R] R Newbie Question/Data Model
 
 Given a data set and a set of predictors and a response in 
 the data, we would like to find a model that fits the data set best.
 Suppose that we do not know what kind of model (linear, 
 polynomial regression,... ) might be good, we are wondering 
 if there is R-package(s) can auctomatically do this.
 Otherwise, can you direct me, or point out reference(s), 
 basic steps to do this. Thanks.
 
 -james
 
 __
 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] a simple question of importing data

2008-04-24 Thread Charles Danko
try:
var - read.table(weekly.txt, sep=\t, header=TRUE)

Charles

On Thu, Apr 24, 2008 at 3:29 PM, tzsmile [EMAIL PROTECTED] wrote:

  i just want to read data from Excel and i copied it and pasted into a txt
  file.
  then i want to use read.table to read it. but however i tried, it doesn't
  work.
  can someone help me?
  data is attached.
  thanks http://www.nabble.com/file/p16851853/weekly.txt weekly.txt
  --
  View this message in context: 
 http://www.nabble.com/a-simple-question-of-importing-data-tp16851853p16851853.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] a simple question of importing data

2008-04-24 Thread Nordlund, Dan (DSHS/RDA)
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of tzsmile
 Sent: Thursday, April 24, 2008 12:30 PM
 To: r-help@r-project.org
 Subject: [R] a simple question of importing data
 
 
 i just want to read data from Excel and i copied it and 
 pasted into a txt
 file.
 then i want to use read.table to read it. but however i 
 tried, it doesn't
 work.
 can someone help me?
 data is attached.
 thanks http://www.nabble.com/file/p16851853/weekly.txt weekly.txt 
 -- 
 View this message in context: 
 http://www.nabble.com/a-simple-question-of-importing-data-tp16
851853p16851853.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.
 

Have you looked at the foreign package?  It should help do what you want.  Or 
you could use Excel to output a .csv and read that with read.table().

Hope this is helpful,

Dan

__
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] a simple question of importing data

2008-04-24 Thread Jorge Ivan Velez
Try also,

setwd(C:\\)
yourdata=read.table(tzmile.txt,header=TRUE)
attach(yourdata)
yourdata[1:10,]
 warcode  date weeklyrt
130001 16-Dec-05  -0.0043
230001 23-Dec-05   0.1313
330001 30-Dec-05  -0.0844
430001  6-Jan-06   0.0097
530001 13-Jan-06  -0.1009
630001 20-Jan-06  -0.0450
730001 25-Jan-06  -0.1700
830001 10-Feb-06   0.3060
930001 17-Feb-06  -0.0721
10   30001 24-Feb-06   0.2260

HTH,

Jorge



On Thu, Apr 24, 2008 at 3:53 PM, Charles Danko [EMAIL PROTECTED] wrote:

 try:
 var - read.table(weekly.txt, sep=\t, header=TRUE)

 Charles

 On Thu, Apr 24, 2008 at 3:29 PM, tzsmile [EMAIL PROTECTED] wrote:
 
   i just want to read data from Excel and i copied it and pasted into a
 txt
   file.
   then i want to use read.table to read it. but however i tried, it
 doesn't
   work.
   can someone help me?
   data is attached.
   thanks http://www.nabble.com/file/p16851853/weekly.txt weekly.txt
   --
   View this message in context:
 http://www.nabble.com/a-simple-question-of-importing-data-tp16851853p16851853.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.


[[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] a simple question of importing data

2008-04-24 Thread Abhijit Dasgupta
Or you could use the read.xls program in the gdata library that uses a 
perl script underneath.

Charles Danko wrote:
 try:
 var - read.table(weekly.txt, sep=\t, header=TRUE)

 Charles

 On Thu, Apr 24, 2008 at 3:29 PM, tzsmile [EMAIL PROTECTED] wrote:
   
  i just want to read data from Excel and i copied it and pasted into a txt
  file.
  then i want to use read.table to read it. but however i tried, it doesn't
  work.
  can someone help me?
  data is attached.
  thanks http://www.nabble.com/file/p16851853/weekly.txt weekly.txt
  --
  View this message in context: 
 http://www.nabble.com/a-simple-question-of-importing-data-tp16851853p16851853.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.
   

[[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] Obtaining correlation parameters for multiple rows

2008-04-24 Thread jpnitya

Hi,

I would like to obtain correlation parameters (e.g., coefficients, p-value)
for multiple samples in regard to a reference. I have my data in a table
with the reference as the second row (first row are headers) and then each
sample in a row. What I do so far is load up the data, get the reference
sample and use apply and lm to do the regression:

x - read.table(file.txt,header=TRUE)
x - t(x)
ref - x[,1]
test - apply(x,2,function(z)lm(z~ref))

My problem is that while I can see the results in test and even obtain the
F-statistic with summary for individual rows (i.e., summary(test[[1]]), I
can't seem to be able to apply the summary to all rows or get only the
coefficients from test so I can save them to a new file. Ideally, I would
like to save a new table to a file withthe correlation coefficients and the
F-statistic for each of my samples.

Any suggestions would be extremely useful.

Thanks.

-- 
View this message in context: 
http://www.nabble.com/Obtaining-correlation-parameters-for-multiple-rows-tp16851980p16851980.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] alternatives to RColorBrewer?

2008-04-24 Thread Achim Zeileis
On Thu, 24 Apr 2008, Dieter Menne wrote:

 Achim Zeileis Achim.Zeileis at wu-wien.ac.at writes:
  However, I guess that it will be hard to select a qualitative
  palette with 18 distinct colors...I couldn't imagine a plot where it would
  be sufficiently easy for humans to decode that. But maybe you can combine
  that with some sequential or diverging palette or so?

 I slightly disagree here. In many cases, in color-coded surface plots, you do
 not want to attribute the colors to, let's say, altitudes, but rather use the
 color transitions as contour lines without explicitly drawing contours. You
 could also use continuous colors, but it is amazing how this fails, while
 something like 25 colors looks good.

I think it depends a lot on what you want to bring out in such a graphic.
Qualitative palettes will convey the impression of different groups in
the data so that distinction of various levels is easier but the
impression of an underlying smooth curve is often lost. However, if you
use a sequential palette, the smoothness is conveyed much better and it is
easy to identify the peaks but much harder to compare other levels of
your curve.

(Re: my original comment. What I meant was that it would be challenging
to decode some truly categorical data, i.e., without an underlying
continuous scale, with 18 levels from a qualitative palette with 18
different colors.)

Best,
Z

 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-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] system() function

2008-04-24 Thread Jeff Breiwick
Hi,

I am trying to run the command: R CMD INSTALL -l mypath mypackagename
from within R (Windows XP) using system() and get the following error:

ARGUMENT 'CMD INSTALL -l D:/R/JMB.LIBS jmb.test' __ignored__

Fatal error: you must specify '--save', '--no-save' or '--vanilla'

My function contains these 3 lines:
  setwd(D:/R/R.pkgs) # path to files set using package.skeleton()
  commands - shQuote(CMD INSTALL -l D:/R/JMB.LIBS jmb.test)
  system(paste('R',commands))

Can anyone tell me where I have gone astray? I suspect the problem lies in 
quoting the strings. The command (R CMD INSTALL etc.) runs OK if I run it in 
a windows shell.
Thank you.

Jeff Breiwick

__
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 test for NULL?

2008-04-24 Thread Olivier Lefevre
x == NULL returns logical(0) instead of FALSE or TRUE as you might expect 
and I cannot find the right way to write this test in R.

Thanks in advance for any hint,

-- O.L.

__
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 test for NULL?

2008-04-24 Thread chenxh007
is.null

Olivier Lefevre wrote:
 x == NULL returns logical(0) instead of FALSE or TRUE as you might expect 
 and I cannot find the right way to write this test in R.
 
 Thanks in advance for any hint,
 
 -- O.L.
 
 __
 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] Using image function to plot character values

2008-04-24 Thread Eric Bell
Hello. I am a newbie to R. If I should be reading some FAQ or manual
that could help answer my question please tell me and I will go there.

Problem: 

I have a spreadsheet that contains a character code in each cell. The
columns in the spreadsheet represent time and the rows represent people.
I want to use the image function to display this information, but the
image function requires numeric data. I know how to read in the
spreadsheet into a data frame, but if I use data.matrix to convert data
frame into a numeric matrix, each column gets converted separately, so
that the same character code may get converted to a different numeric
code depending on the column. How do I apply the character to numeric
conversion so that each character gets converted to the same numeric
value?

A secondary problem is that after I do the conversion, I need to know
what codes were converted to what numeric values.

Example:

In the example below, B gets converted to 2 in the first column, but
gets converted to 1 in the second column.

 dv - read.csv( SourceFileName, header=TRUE)
 dv
  m1 m2
1  A  B
2  B  C
3  C  D
 data.matrix(dv)
 m1 m2
[1,]  1  1
[2,]  2  2
[3,]  3  3

Thanks in advance,

--eric

__
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] matrix from list

2008-04-24 Thread Olivier Lefevre
Another possibly simple thing that I cannot get right is how to extract the 
data part of a list as a matrix. The data were read from xls, with labels, 
and thus are of list mode, e.g.,

   col1 col2
1 0.1  1.1
2 0.2  1.2

I want to extract from that just the numeric data part, i.e., (in this 
case) the same thing that matrix(c(0.1, 0.2, 1.1, 1.2), 2, 2) would return. 
I am grasping for a syntax like list[[1:2]] but that doesn't work and I 
can't find anything that does.

Thanks,

-- O.L.

__
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] matrix from list

2008-04-24 Thread Jorge Ivan Velez
Hi Olivier,

is this what you want?

x=col1 col2
1 0.1  1.1
2 0.2  1.2

m=read.table(textConnection(x),header=TRUE)
m1=matrix(unlist(m),ncol=2)
m1
[,1] [,2]
[1,]  0.1  1.1
[2,]  0.2  1.2

HTH,

Jorge


On Thu, Apr 24, 2008 at 6:02 PM, Olivier Lefevre [EMAIL PROTECTED] wrote:

 Another possibly simple thing that I cannot get right is how to extract the
 data part of a list as a matrix. The data were read from xls, with labels,
 and thus are of list mode, e.g.,

   col1 col2
 1 0.1  1.1
 2 0.2  1.2

 I want to extract from that just the numeric data part, i.e., (in this
 case) the same thing that matrix(c(0.1, 0.2, 1.1, 1.2), 2, 2) would return.
 I am grasping for a syntax like list[[1:2]] but that doesn't work and I
 can't find anything that does.

 Thanks,

 -- O.L.

 __
 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 to test for NULL?

2008-04-24 Thread Olivier Lefevre
chenxh007 wrote:
 is.null

Thanks! That one is mentioned in the LRM under §2.1.6 (NULL), so I should 
have found it...

-- O.L.

__
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 test for NULL?

2008-04-24 Thread John Fox
Dear Olivier,

You can use is.null(). 

apropos(null) finds is.null(), and help.search(null) turns up ?NULL,
which documents is.null().

I hope this helps,
 John

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

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Olivier Lefevre
 Sent: April-24-08 5:19 PM
 To: [EMAIL PROTECTED]
 Subject: [R] How to test for NULL?
 
 x == NULL returns logical(0) instead of FALSE or TRUE as you might
 expect
 and I cannot find the right way to write this test in R.
 
 Thanks in advance for any hint,
 
 -- O.L.
 
 __
 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] matrix from list

2008-04-24 Thread Olivier Lefevre
Yes, unlist is the magic wand I was looking for. Thanks a million!

Having said that, I find it rather arbitrary that you can write mat[1:4] 
but not list[[1:2]]; IMO there should be no need for a magic operator 
like unlist: list[[1:length(list)]] could do the job.

-- O.L.

__
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] why R doesn't recognize my file?

2008-04-24 Thread tzsmile

i want to read a txt file weekly. this file is in d:/my documents
i tried the following 
 a-read.table(d:/my documents/weekly, sep= , header=TRUE)
but get the following error:
Error in open.connection(file, r) : unable to open connection
In addition: Warning message:
cannot open file 'd:/my documents/weekly', reason 'No such file or
directory' in: open.connection(file, r) 
why?
-- 
View this message in context: 
http://www.nabble.com/why-R-doesn%27t-recognize-my-file--tp16852537p16852537.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] why R doesn't recognize my file?

2008-04-24 Thread Jorge Ivan Velez
Hi there,

You need the extension txt. Try this:

a-read.table(d:/my documents/weekly.txt, sep= , header=TRUE)

HTH,

Jorge



On Thu, Apr 24, 2008 at 4:43 PM, tzsmile [EMAIL PROTECTED] wrote:


 i want to read a txt file weekly. this file is in d:/my documents
 i tried the following
  a-read.table(d:/my documents/weekly, sep= , header=TRUE)
 but get the following error:
 Error in open.connection(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file 'd:/my documents/weekly', reason 'No such file or
 directory' in: open.connection(file, r)
 why?
 --
 View this message in context:
 http://www.nabble.com/why-R-doesn%27t-recognize-my-file--tp16852537p16852537.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.


[[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] why R doesn't recognize my file?

2008-04-24 Thread Duncan Murdoch
tzsmile wrote:
 i want to read a txt file weekly. this file is in d:/my documents
 i tried the following 
  a-read.table(d:/my documents/weekly, sep= , header=TRUE)
 but get the following error:
 Error in open.connection(file, r) : unable to open connection
 In addition: Warning message:
 cannot open file 'd:/my documents/weekly', reason 'No such file or
 directory' in: open.connection(file, r) 
 why?
   
Perhaps it has a filename extension, which Microsoft in their infinite 
wisdom is suppressing?

The easiest way to open a file in windows is to use file.choose() in 
place of a specification of the filename.  It will return a correct 
filename, which read.table can use, i.e.

read.table(file.choose(), header=TRUE)

or

f - file.choose()
read.table(f, header=TRUE)

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] Sum of random values

2008-04-24 Thread Ricardo Bessa

Hello,
I have two random variables with their percentiles which correspond to their 
probability distribution function. My objective is to sum these two random 
variables. There exists any algorithm or procedure in R capable of converting 
the percentiles to a probability density function? is the fast Fourier 
transform function of R(fft) capable of doing the sum with a convolution?
 
I'm just starting with this specific problem, so any help it will be very 
useful.
 
Best regards,
Ricardo Bessa
 
_

[[elided Hotmail spam]]

[[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 on read in a txt file

2008-04-24 Thread ss
Dear list,

Hello! I had a problem of reading in a txt file and need your help.
The txt file, called A, comprises of 592 columns and 34179 rows.
I need to note that for some cells of A , A[i,j], are blank.

I used read.table() and got the warning message:

 A-read.table(file=A.txt,sep=\t)
Warning message:
In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  number of items read is not a multiple of the number of columns
 dim(A)
[1] 33623   592

However, as some rows were missed because the original number
of rows is 34179, after read.table(), it was decreased to 33623.
I have no idea whether it has anything to do with the warning message.

Do you have any suggestions for this problem?

Thanks much,
Alex

[[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] means and variances of several groups in the matrix

2008-04-24 Thread Julian Burgos
Hy Katie,

There are many ways to do this.  A simple one is to create a vector of 
the same length than your 'x' vector, containing a group label.

  group=rep(c(1,2,3),times=nr[1,])

Then you can use tapply to apply a function (in this case mean and 
variance) of the values of x within each group.

  means=tapply(x,group,mean)
  vars=tapply(x,group,var)

  means
   1   2   3
-0.14711206  0.28314274 -0.07861427
  vars
 1 2 3
1.4584971 0.3611996 0.6300624

Julian


kathie wrote:
 Dear R users, 
 
 I have 32 observations in data x.  After sorting this, I want to compute
 means and variances of 3 groups divided by nr.
 
 Actually, the number of groups is flexible.  Any suggestion will be greatly
 appreciated. 
 
 Kathryn Lord
 
 ---
 x=rnorm(32)
 y=sort(x)
 
 nr=matrix(c(12,11,10,10,10,11),2,3)
 nr
  [,1] [,2] [,3]
 [1,]   12   10   10- sum=32
 [2,]   11   10   11- sum=32
 
 For the 1st row in nr, index of y = (1,..,12,   13,...,23,   24,...32)
 
 I want to compute means and variances for 3 groups 
 
 (1st group is 1 through 12; 2nd group is 13-23; 3rd group is 24-32)
 
 
 For the 2nd row in nr, index of y = (1,..,11,   12,...,22,   23,...32)
 
 also, I want to compute means and variances for 3 groups 
 
 (1st group is 1 through 11; 2nd group is 12-22; 3rd group is 23-32)
 
 


__
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 on read in a txt file

2008-04-24 Thread jim holtman
It seems to indicate that you don't have 592 columns on all lines.
Try the following to see how many columns are in each line:

x - count.fields(A.txt, sep=\t)
which(x != 592)  # print out the lines that are not correct

You might also try:

read.table(a.txt, sep=\t, fill=TRUE)

On Thu, Apr 24, 2008 at 8:32 PM, ss [EMAIL PROTECTED] wrote:
 Dear list,

 Hello! I had a problem of reading in a txt file and need your help.
 The txt file, called A, comprises of 592 columns and 34179 rows.
 I need to note that for some cells of A , A[i,j], are blank.

 I used read.table() and got the warning message:

  A-read.table(file=A.txt,sep=\t)
 Warning message:
 In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  number of items read is not a multiple of the number of columns
  dim(A)
 [1] 33623   592

 However, as some rows were missed because the original number
 of rows is 34179, after read.table(), it was decreased to 33623.
 I have no idea whether it has anything to do with the warning message.

 Do you have any suggestions for this problem?

 Thanks much,
Alex

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




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

What is the problem 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.


Re: [R] Help on read in a txt file

2008-04-24 Thread ss
Thanks Jim.


I got this:

 A-read.table(a.txt, sep=\t, fill=TRUE)
 dim(A)
[1] 33623   592
 x - count.fields(a.txt, sep=\t)
which(x != 592)  # print out the lines that are not correct
 which(x != 592)  # print out the lines that are not correct
[1] 31279 31281 33625


Actually, I just need from the txt file to grab 83 columns whose column
names have the pattern '_A01/Ratio'.

For instance, I am listing the column names of the first 23 columns and I
only need
the columns ends with '_A01/Ratio'. So is there a way to get around reading
in all
the data first?

Thanks,
   Alex


Database ebi.ac.uk:Database:ensembl
Database ebi.ac.uk:Database:locus
Database ebi.ac.uk:Database:refseq
Database ebi.ac.uk:Database:tigr_thc
Database www.chem.agilent.com:Database:agp
Reporter group
Reporter identifier
Reporter name
Reporter sequence type
MBA: US14702370_16012391010920_S01_A01/Log(Ratio)
MBA: US14702370_16012391010920_S01_A01/Ratio
MBA: US14702370_16012391010920_S01_A01/Fold Change
MBA: US14702370_16012391010920_S01_A01/Log(Error)
MBA: US14702370_16012391010920_S01_A01/P-Value
MBA: US14702370_16012391010920_S01_A01/Intensity 1
MBA: US14702370_16012391010920_S01_A01/Intensity 2
MBA: US14702370_16012391010525_S01_A01/Log(Ratio)
MBA: US14702370_16012391010525_S01_A01/Ratio
MBA: US14702370_16012391010525_S01_A01/Fold Change
MBA: US14702370_16012391010525_S01_A01/Log(Error)
MBA: US14702370_16012391010525_S01_A01/P-Value
MBA: US14702370_16012391010525_S01_A01/Intensity 1
MBA: US14702370_16012391010525_S01_A01/Intensity 2



On Thu, Apr 24, 2008 at 9:27 PM, jim holtman [EMAIL PROTECTED] wrote:

 It seems to indicate that you don't have 592 columns on all lines.
 Try the following to see how many columns are in each line:

 x - count.fields(A.txt, sep=\t)
 which(x != 592)  # print out the lines that are not correct

 You might also try:

 read.table(a.txt, sep=\t, fill=TRUE)

 On Thu, Apr 24, 2008 at 8:32 PM, ss [EMAIL PROTECTED] wrote:
  Dear list,
 
  Hello! I had a problem of reading in a txt file and need your help.
  The txt file, called A, comprises of 592 columns and 34179 rows.
  I need to note that for some cells of A , A[i,j], are blank.
 
  I used read.table() and got the warning message:
 
   A-read.table(file=A.txt,sep=\t)
  Warning message:
  In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
   number of items read is not a multiple of the number of columns
   dim(A)
  [1] 33623   592
 
  However, as some rows were missed because the original number
  of rows is 34179, after read.table(), it was decreased to 33623.
  I have no idea whether it has anything to do with the warning message.
 
  Do you have any suggestions for this problem?
 
  Thanks much,
 Alex
 
 [[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.
 



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

 What is the problem you are trying to solve?


[[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] Differentiate alphanumeric vs numeric strings

2008-04-24 Thread jim holtman
The following will return the indices or the values of character
strings that are all numeric:

 x - c(12345, 123AS23, A123, 398457)
 grep(^[[:digit:]]*$, x)   # index
[1] 1 4
 grep(^[[:digit:]]*$, x, value=TRUE)   # values
[1] 12345  398457




On Thu, Apr 24, 2008 at 10:39 PM, Farrel Buchinsky [EMAIL PROTECTED] wrote:
 I have a bunch of tables in a Microsoft Access database. An updated database
 is sent to me every week containing a new table. I know that is inefficient
 and weird but welcome to my life. I want to read the tables whose names are
 something such as 040207 but not the ones that have alphanumeric names
 such as everyone. Using RODBC I am easily able to create a character
 vector of the names of the tables. Is there a function that can
 differentiate values consisting only of digits (numerics) as opposed to ones
 that contain letters (and perhaps digts as well)? I am sure there is. What
 is it and where should I have found it?

 --
 Farrel Buchinsky
 GrandCentral Tel: (412) 567-7870

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




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

What is the problem 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.


Re: [R] Differentiate alphanumeric vs numeric strings

2008-04-24 Thread Gabor Grothendieck
This has the disadvantage of producing a warning when it finds
non-numerics and also there
are situations like 1E1 which it will regard as numeric so using
a regexp is probably preferred but it is simple:

!is.na(as.numeric(x))


On Thu, Apr 24, 2008 at 10:39 PM, Farrel Buchinsky [EMAIL PROTECTED] wrote:
 I have a bunch of tables in a Microsoft Access database. An updated database
 is sent to me every week containing a new table. I know that is inefficient
 and weird but welcome to my life. I want to read the tables whose names are
 something such as 040207 but not the ones that have alphanumeric names
 such as everyone. Using RODBC I am easily able to create a character
 vector of the names of the tables. Is there a function that can
 differentiate values consisting only of digits (numerics) as opposed to ones
 that contain letters (and perhaps digts as well)? I am sure there is. What
 is it and where should I have found it?

 --
 Farrel Buchinsky
 GrandCentral Tel: (412) 567-7870

[[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] Documentation General Comments

2008-04-24 Thread Kingsford Jones
I just read through this thread and I didn't see the R Language
Definition mentioned.  As with An Introduction to R it can be accessed
-- at least in my Windows GUI -- via the menu bar: Help - Manuals (in
PDF).  If An Introduction to R is too basic, then the Language
Definition should be a good place to look for more details on R
objects (Ch 2).  However An Introduction to R does include
authoritative introductions to the data types mentioned by the
original poster: factors (Ch4), arrays and matrices (Ch 5), and lists
and data frames (Ch 6).

That said, I agree that learning efficiency could be improved by
augmenting the manuals with tables similar to the table 2.1 that was
referenced earlier in the thread (aside: are functions, or even lists,
really Data Objects?). Of course, as pointed out by Duncan, we are
collaborators not consumers, so if I think there should be more tables
in the documents then the onus is on me to try to get my ideas
incorporated (see
http://wiki.r-project.org/rwiki/doku.php?id=misc:rpatch ).

Kingsford Jones

On Thu, Apr 24, 2008 at 9:37 AM, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 4/24/2008 12:08 PM, Martin Maechler wrote:
   Hmm,
  
   KeBe == Beck, Kenneth (STP) [EMAIL PROTECTED]
   on Thu, 24 Apr 2008 10:12:19 -0500 writes:
  
   KeBe OK I've spent a lot of time with the core
   KeBe documentation, and I never found anything as simple as
   KeBe their table 2.1, which elucidated the difference
   KeBe between a vector, matrix and array first, then the
   KeBe higher level structures, frame and list.  Maybe I'm
   KeBe not a good searcher, but believe me for every initial
   KeBe posting I submit to this group, I have spent hours
   KeBe trying to find the answer elsewhere. And, as you
   KeBe state, maybe I am now deluded by that presentation,
   KeBe maybe it is not this simple!
  
   Well, I get the impression that you've never read the manual
 Introduction to R
 (or some good book such as Peter Dalgaard's)
   but have directly jumped into reading  help() pages  ???

  That's not correct.  Kenneth started the thread (on Monday) saying:


  The basic tutorial Introduction to R is so basic, it
  hardly helps at all, then digging through documentation is really an
  exercise in frustration.

  Duncan Murdoch



  
   Maybe a good idea would be to improve the Introduction to R
   rather than thinking of misusing the help() collection
   {which is the reference manual, not the user manual !!}
   by making it easy to understand (and consequently less precise) ??
  
   Patches (well reflected ..) to the Introduction are quite
   welcome, indeed.
   The (development) source is always available
   at https://svn.r-project.org/R/trunk/doc/manual/R-intro.texi
  
   (and yes, the source does look a bit less user-friendly,
than its PDF output, e.g.
http://cran.r-project.org/doc/manuals/R-intro.pdf
or its  daily updated  HTML output at
http://stat.ethz.ch/R-manual/R-devel/doc/manual/R-intro.html
   )
  
   Regards,
   Martin
  
   KeBe Look at the help for data.frame. VERY terse
   KeBe explanation, with not a good comparison to the other
   KeBe data types. Then, look at the titles list. Where is a
   KeBe topic for data types Every other programming
   KeBe language I have used (C++, Pascal, SAS, Java) has a
   KeBe basic chapter in the documentation that goes over data
   KeBe types, what arrays are, higher level structures, etc.
   KeBe When I typed help.search(data type) I get the
   KeBe following:
  
   KeBe Help files with alias or concept or title matching
   KeBe 'data type' using fuzzy matching:
   KeBe character-class(methods) Classes Corresponding to
   KeBe Basic Data Types sqlTypeInfo(RODBC) Request
   KeBe Information about DataTypes in an ODBC Database
  
   KeBe Looking for the term character-class(methods) yields
   KeBe nothing. I don't think that is what I want!
  
   KeBe Given all this complaining, I actually have completed
   KeBe several nice project using R, it is an impressive
   KeBe package. Somehow, though, we need to make the
   KeBe documentation better.
  
   KeBe -Original Message- From: Duncan Murdoch
   KeBe [mailto:[EMAIL PROTECTED] Sent: Thursday, April
   KeBe 24, 2008 9:51 AM To: Beck, Kenneth (STP) Cc: Bert
   KeBe Gunter; r-help@r-project.org Subject: Re: [R]
   KeBe Documentation General Comments
  
   KeBe On 4/24/2008 10:22 AM, Beck, Kenneth (STP) wrote:
Agree that terseness is good, but I also agree with other
posters that
  
better cross referencing or maybe an index of synonyms
would be good.
   
So far, the best suggestion is the pdf at this link
   
(http://www.medepi.net/epir/epir_chap02.pdf).
   
Is there a way to pop at least part of this into the
R-base help page?
  
   

[R] make check errors with R 2.7.0

2008-04-24 Thread Patrick Connolly
I installed R-2.7.0 from the tar.gz file.  It's the end of make check
that my question is about.

make[3]: Entering directory `/usr/local/R-2.7.0/tests'
make[3]: `reg-tests-1.Rout' is up to date.
make[3]: `reg-tests-2.Rout' is up to date.
running code in 'reg-IO.R' ... OK
comparing 'reg-IO.Rout' to './reg-IO.Rout.save' ...44c44
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
---
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
88c88
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
---
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
111c111
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
---
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
134c134
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
---
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
make[3]: *** [reg-IO.Rout] Error 1
make[3]: Leaving directory `/usr/local/R-2.7.0/tests'
make[2]: *** [test-Reg] Error 2
make[2]: Leaving directory `/usr/local/R-2.7.0/tests'
make[1]: *** [test-all-basics] Error 1
make[1]: Leaving directory `/usr/local/R-2.7.0/tests'
make: *** [check] Error 2


When I look at testIO.R, it seems indeed to be designed to have a
missing CR at the end.  Is this simply testing to see if it is found,
or does the fact that it exits with Error 2 mean that it's not going
onto other tests?  It did seem to be rather a lot shorter than I
remember other installations.

I did not have any difficulty in installing the lme4 package and its
dependencies which might indicate that the installation has been
successful.

Do I have any cause for concern?


-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~} Great minds discuss ideas
 _( Y )_Middle minds discuss events 
(:_~*~_:)Small minds discuss people  
 (_)-(_)   . Anon
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
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] Documentation General Comments

2008-04-24 Thread Lawrence Hanser
Dear Colleagues,

It seems to me that the issue is not whether the information we seek
is in the documentation.  I, for one, am amazed at the quality of the
documentation of R and of contributed materials.  For me the issue is
one of finding the information in an efficient way out of the
mountains of information in the official and unofficial documentation
of R.  Part of this is on the head of the seeker of information to
generate keywords that will lead a search engine to find what we are
looking for.  But part of it is on the heads of contributors to insure
that relevant keywords are associated with relevant content in a way
that the search engine will find it and rank order it in a sensible
way.

Take RSiteSearch(), for example.  Are we as a user and contributor
group familiar with the scoring scheme that Namazu uses to score and
order the information it finds?  I refer you to:
http://www.namazu.org/doc/tips.html for this information.  For
example, if Namazu finds a keyword in a meta name =keywords
content=... tag the score is bumped by 32 points.  Finding a
keyword in a title tag is worth 16 points, etc.  Also on the
referenced url page we are essentially told not to use more than two
words in the search.  It seems to me that knowing these things alone
will help authors increase the quality of searches and seekers to more
easily find what they are looking for.

My thanks to all the contributors who have made R a terrific system.

Regards,

Larry


On Thu, Apr 24, 2008 at 8:55 PM, Kingsford Jones
[EMAIL PROTECTED] wrote:
 I just read through this thread and I didn't see the R Language
  Definition mentioned.  As with An Introduction to R it can be accessed
  -- at least in my Windows GUI -- via the menu bar: Help - Manuals (in
  PDF).  If An Introduction to R is too basic, then the Language
  Definition should be a good place to look for more details on R
  objects (Ch 2).  However An Introduction to R does include
  authoritative introductions to the data types mentioned by the
  original poster: factors (Ch4), arrays and matrices (Ch 5), and lists
  and data frames (Ch 6).

  That said, I agree that learning efficiency could be improved by
  augmenting the manuals with tables similar to the table 2.1 that was
  referenced earlier in the thread (aside: are functions, or even lists,
  really Data Objects?). Of course, as pointed out by Duncan, we are
  collaborators not consumers, so if I think there should be more tables
  in the documents then the onus is on me to try to get my ideas
  incorporated (see
  http://wiki.r-project.org/rwiki/doku.php?id=misc:rpatch ).

  Kingsford Jones

  On Thu, Apr 24, 2008 at 9:37 AM, Duncan Murdoch [EMAIL PROTECTED] wrote:
   On 4/24/2008 12:08 PM, Martin Maechler wrote:
 Hmm,

 KeBe == Beck, Kenneth (STP) [EMAIL PROTECTED]
 on Thu, 24 Apr 2008 10:12:19 -0500 writes:

 KeBe OK I've spent a lot of time with the core
 KeBe documentation, and I never found anything as simple as
 KeBe their table 2.1, which elucidated the difference
 KeBe between a vector, matrix and array first, then the
 KeBe higher level structures, frame and list.  Maybe I'm
 KeBe not a good searcher, but believe me for every initial
 KeBe posting I submit to this group, I have spent hours
 KeBe trying to find the answer elsewhere. And, as you
 KeBe state, maybe I am now deluded by that presentation,
 KeBe maybe it is not this simple!

 Well, I get the impression that you've never read the manual
   Introduction to R
   (or some good book such as Peter Dalgaard's)
 but have directly jumped into reading  help() pages  ???
  
That's not correct.  Kenneth started the thread (on Monday) saying:
  
  
The basic tutorial Introduction to R is so basic, it
hardly helps at all, then digging through documentation is really an
exercise in frustration.
  
Duncan Murdoch
  
  
  

 Maybe a good idea would be to improve the Introduction to R
 rather than thinking of misusing the help() collection
 {which is the reference manual, not the user manual !!}
 by making it easy to understand (and consequently less precise) ??

 Patches (well reflected ..) to the Introduction are quite
 welcome, indeed.
 The (development) source is always available
 at https://svn.r-project.org/R/trunk/doc/manual/R-intro.texi

 (and yes, the source does look a bit less user-friendly,
  than its PDF output, e.g.
  http://cran.r-project.org/doc/manuals/R-intro.pdf
  or its  daily updated  HTML output at
  http://stat.ethz.ch/R-manual/R-devel/doc/manual/R-intro.html
 )

 Regards,
 Martin

 KeBe Look at the help for data.frame. VERY terse
 KeBe explanation, with not a good comparison to the other
 KeBe data types. Then, look at the titles list. Where is a
 KeBe topic for data 

Re: [R] Obtaining correlation parameters for multiple rows

2008-04-24 Thread Jorge Ivan Velez
Hi,

I'm sure it could be better but try this:

# F statistics based on lm
FSTAT=function(y,x) summary(lm(y~x))$f[1]

# Correlation and p-value
CORR=function(y,x){
tc=cor.test(x,y,method=spearman,alternative=two.sided)
temp=matrix(c(tc$estimate,tc$p.value),ncol=2)
colnames(temp)=c('rho','pvalue')
temp
}

# 1000 variables and 100 samples
set.seed(124)
X=matrix(rnorm(1000*100),ncol=100)

# Correlation coefficient, p-value and F statistics
corr=t(apply(X[-1,],1,CORR,x=X[1,]))  # Your reference is X[1,]
fs=apply(X[-1,],1,FSTAT,x=X[1,])  # Your reference is X[1,]

# Report
temp=data.frame(fstats=fs,rho=corr[,1],pvalue=corr[,2])
rownames(temp)=paste(X,2:nrow(X),sep=)
dim(temp)
[1] 999   3

temp[1:10,]
fstats rho pvalue
X2  1.421307790 -0.05038104 0.61807912
X3  0.051423768 -0.04614461 0.64795111
X4  0.128000634  0.01795380 0.85902211
X5  0.990235820 -0.06540654 0.51730942
X6  5.569006085  0.24232823 0.01532172
X7  0.001862766 -0.01436544 0.88703532
X8  1.025363077 -0.10628263 0.29206908
X9  0.679794149  0.06509451 0.51927479
X10 1.296034903  0.09492949 0.34686211
X11 0.126636867  0.05137714 0.61110106


HTH,

Jorge


On Thu, Apr 24, 2008 at 3:40 PM, jpnitya [EMAIL PROTECTED]
wrote:


 Hi,

 I would like to obtain correlation parameters (e.g., coefficients, p-value)
 for multiple samples in regard to a reference. I have my data in a table
 with the reference as the second row (first row are headers) and then each
 sample in a row. What I do so far is load up the data, get the reference
 sample and use apply and lm to do the regression:

 x - read.table(file.txt,header=TRUE)
 x - t(x)
 ref - x[,1]
 test - apply(x,2,function(z)lm(z~ref))

 My problem is that while I can see the results in test and even obtain the
 F-statistic with summary for individual rows (i.e., summary(test[[1]]), I
 can't seem to be able to apply the summary to all rows or get only the
 coefficients from test so I can save them to a new file. Ideally, I would
 like to save a new table to a file withthe correlation coefficients and the
 F-statistic for each of my samples.

 Any suggestions would be extremely useful.

 Thanks.

 --
 View this message in context:
 http://www.nabble.com/Obtaining-correlation-parameters-for-multiple-rows-tp16851980p16851980.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.

[[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] force glm estimates to be nonnegative

2008-04-24 Thread Michele Christina Itten
Is there a way to force certain formula parameters to be nonnegative?

What I want to do is to estimate student capacity over time, namely by

  capacity ~ Student + Student:Day

I add this formula to a glm call and obtain negative learning slope estimates 
(Student:Day) in some cases. 
However, I don't want to allow for that. In such a case, glm should solve 

 capacity ~ Student

and I will set the slope to zero. 

Is there an option to constrain a parameter set to nonnegative values?




Many thanks in advance!

Michele Itten,
BS. Carnegie Mellon

__
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] system() function

2008-04-24 Thread Prof Brian Ripley
You don't want shQuote - that makes it a single argument.

Shells strip quotes, but system() does not use a shell on Windows -- you 
could use shell() not system(), but that would be overkill here.

On Thu, 24 Apr 2008, Jeff Breiwick wrote:

 Hi,

 I am trying to run the command: R CMD INSTALL -l mypath mypackagename
 from within R (Windows XP) using system() and get the following error:

 ARGUMENT 'CMD INSTALL -l D:/R/JMB.LIBS jmb.test' __ignored__

 Fatal error: you must specify '--save', '--no-save' or '--vanilla'

 My function contains these 3 lines:
  setwd(D:/R/R.pkgs) # path to files set using package.skeleton()
  commands - shQuote(CMD INSTALL -l D:/R/JMB.LIBS jmb.test)
  system(paste('R',commands))

 Can anyone tell me where I have gone astray? I suspect the problem lies in
 quoting the strings. The command (R CMD INSTALL etc.) runs OK if I run it in
 a windows shell.
 Thank you.

 Jeff Breiwick

 __
 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,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] force glm estimates to be nonnegative

2008-04-24 Thread Prof Brian Ripley
On Fri, 25 Apr 2008, Michele Christina Itten wrote:

 Is there a way to force certain formula parameters to be nonnegative?

 What I want to do is to estimate student capacity over time, namely by

  capacity ~ Student + Student:Day

 I add this formula to a glm call and obtain negative learning slope estimates 
 (Student:Day) in some cases.
 However, I don't want to allow for that. In such a case, glm should solve

 capacity ~ Student

 and I will set the slope to zero.

 Is there an option to constrain a parameter set to nonnegative values?

Not in glm().  Easily if you fit the model by optim(), and there is 
example code for binomial GLMs in MASS chapter 16 (and the scripts in its 
package).





 Many thanks in advance!

 Michele Itten,
 BS. Carnegie Mellon

 __
 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,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] make check errors with R 2.7.0

2008-04-24 Thread Prof Brian Ripley
Note that the problem is not that you got the message, but an apparent 
whitespace issue in the output.  That's clearer in this version: note that 
the output for reg-IO.Rout.save is shifted left one column.  But I don't 
trust email to transmit these things faithfully (especially after the last 
two days of encoding issues).

So the problem is most likely either the way reg-IO.Rout.save got unpacked 
or your 'diff' function.

You don't mention an OS, but my recollection is that you usually use 
Linux.  I *have* seen an error in this test on Cygwin, where the issue was 
the unpacking by tar.

If this is Linux, it has been tested successfully many times by others, 
and I don't recall any change to that test since 2.6.2 (and nor do the SVN 
logs).


On Fri, 25 Apr 2008, Patrick Connolly wrote:

 I installed R-2.7.0 from the tar.gz file.  It's the end of make check
 that my question is about.

 make[3]: Entering directory `/usr/local/R-2.7.0/tests'
 make[3]: `reg-tests-1.Rout' is up to date.
 make[3]: `reg-tests-2.Rout' is up to date.
 running code in 'reg-IO.R' ... OK
 comparing 'reg-IO.Rout' to './reg-IO.Rout.save' ...44c44
  In readLines(testIO.R) : incomplete final line found on 'testIO.R'
 ---
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
 88c88
  In readLines(testIO.R) : incomplete final line found on 'testIO.R'
 ---
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
 111c111
  In readLines(testIO.R) : incomplete final line found on 'testIO.R'
 ---
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
 134c134
  In readLines(testIO.R) : incomplete final line found on 'testIO.R'
 ---
 In readLines(testIO.R) : incomplete final line found on 'testIO.R'
 make[3]: *** [reg-IO.Rout] Error 1
 make[3]: Leaving directory `/usr/local/R-2.7.0/tests'
 make[2]: *** [test-Reg] Error 2
 make[2]: Leaving directory `/usr/local/R-2.7.0/tests'
 make[1]: *** [test-all-basics] Error 1
 make[1]: Leaving directory `/usr/local/R-2.7.0/tests'
 make: *** [check] Error 2


 When I look at testIO.R, it seems indeed to be designed to have a
 missing CR at the end.  Is this simply testing to see if it is found,
 or does the fact that it exits with Error 2 mean that it's not going
 onto other tests?  It did seem to be rather a lot shorter than I
 remember other installations.

That's a late test, but it did terminate with an error.


 I did not have any difficulty in installing the lme4 package and its
 dependencies which might indicate that the installation has been
 successful.

 Do I have any cause for concern?

Some, but with your toolset.



 -- 
 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
   ___Patrick Connolly
 {~._.~}Great minds discuss ideas
 _( Y )_   Middle minds discuss events
 (:_~*~_:)  Small minds discuss people
 (_)-(_)  . Anon

 ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

 __
 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,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.