[R] self organizing map advice for categorical data

George Chen glchen at stanford.edu
Tue May 5 18:36:08 CEST 2009


Hello,

Could anybody offer any advice about implementing a Kohonen self organizing map for categorical data?  Specifically I am wondering if there are any pre-existent packages that can deal with categorical data and/or how one would compare the input vector of categoricals with the self organizing map nodes.

Thanks in advance.

George Chen

----- Original Message -----
From: r-help-request at r-project.org
To: r-help at r-project.org
Sent: Tuesday, May 5, 2009 3:00:09 AM GMT -08:00 US/Canada Pacific
Subject: R-help Digest, Vol 75, Issue 5

Send R-help mailing list submissions to
	r-help at r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
	r-help-request at r-project.org

You can reach the person managing the list at
	r-help-owner at r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

   1. Randomized-complete blocks design and R (alis villiyam)
   2. Re: clear screen? (Duncan Murdoch)
   3. Re: Surface for R outside of R (Duncan Murdoch)
   4. Re: wrong if-else syntax (Duncan Murdoch)
   5. Creating a variable which is the sum of equal rows in a
      dataframe (Cecilia Carmo)
   6. Re: Creating a variable which is the sum of equal rows in a
      dataframe (baptiste auguie)
   7. levelplot question (Antje)
   8. Re: clear screen? (Gabor Grothendieck)
   9. Odp: Creating a variable which is the sum of equal rows in a
      dataframe (Petr PIKAL)
  10. Re: Creating a variable which is the sum of equal rows in a
      dataframe (Fredrik Karlsson)
  11. Re: Creating a variable which is the sum of equal rows in a
      dataframe (Gabor Grothendieck)
  12. Re: normality test for large a large dataset ? (Ben Bolker)
  13. Re: Caret package: coeffcients for regression (Max Kuhn)
  14. can install.packages() copy utility files to the public_html
      directory ? (Markus Loecher)
  15. Re: Need to clean a table, and compute mean and SD (Luc Villandre)
  16. Re: levelplot question (Dieter Menne)
  17. Re: Nelson-Aalen estimator of cumulative hazard (Ravi Varadhan)
  18. Re: Surface for R outside of R (Hans-Peter Suter)
  19. Re: Dynamic visualisation of R data using Adobe FLEX (Harsh)
  20. Re: About the Transfer Function Model(ARIMAX) (David Winsemius)
  21. Reversing axis label order (Steve Murray)
  22. how to remove ( ) ? when using write.csv(chron.object)
      (Qianfeng Li)
  23. Re: can install.packages() copy utility files to the
      public_html directory ? (Uwe Ligges)
  24. Re: how to remove ( ) ? when using write.csv(chron.object)
      (Gabor Grothendieck)
  25. Re: can install.packages() copy utility files to the
      public_html directory ? (Gabor Grothendieck)
  26. Re: Support Vector Machines (excalibur)
  27.  levelplot question (Antje)
  28. Re: Support Vector Machines (David Winsemius)
  29. mosaic plot with two factors and one continous variable
      (Karsten Weinert)
  30. Re: Reversing axis label order (Patrizio Frederic)
  31. Re: mosaic plot with two factors and one continous variable
      (Achim Zeileis)
  32. Zelig, oprobit error (Jennifer Brea)
  33. Handling Error Thrown After source(...), read.table(...),	and
      readLines(...) (Jason Rupert)
  34. Re: normality test for large a large dataset ? (Greg Snow)
  35.  Cox Proportional Odds Model (Steve Jaffe)
  36. Code of the max() function (Paul Smith)
  37. help_if command_new column (barbara horta e costa)
  38. Java-R (andrea.spano at quantide.com)
  39. Re: Hierarchical Diagram of Networks in sna or otherwise?
      (jebyrnes)
  40. Re: help_if command_new column (David Winsemius)
  41. Re: Surface for R outside of R (Francisco J. Zagmutt)
  42. Producing a legend successfullly (Steve Murray)
  43. Re: Code of the max() function (David Winsemius)
  44. [R-pkgs] frontier 0.99 is NOT backward compatible
      (Arne Henningsen)
  45. Re: Surface for R outside of R (Francisco J. Zagmutt)
  46. Re: Hierarchical Diagram of Networks in sna or otherwise?
      (William Revelle)
  47. ellipsis problem (tyler)
  48. Re: Surface for R outside of R (Gabor Grothendieck)
  49. Re: Surface for R outside of R (Gabor Grothendieck)
  50. Re: Producing a legend successfullly (Peter Flom)
  51. Re: Producing a legend successfullly (Sarah Goslee)
  52. Re: Producing a legend successfullly (Jorge Ivan Velez)
  53. rotate texts (phoebe kong)
  54. Re: ellipsis problem (Duncan Murdoch)
  55. Re: Producing a legend successfullly (baptiste auguie)
  56. Re: rotate texts (David Winsemius)
  57. Re: rotate texts (Sarah Goslee)
  58. Re: Code of the max() function (Paul Smith)
  59. Calculating relative ratios in a data frame.. (Zeljko Vrba)
  60. sm.density.compare (Claudia Penaloza)
  61. to the person who asked about dividing by the base row
      (markleeds at verizon.net)
  62. Re: Calculating relative ratios in a data frame.. (jim holtman)
  63. ellipse (Antonio Lucadamo)
  64. FOURIER INTEGRALS IN R (Achilleas Achilleos)
  65.  A variation on the bar plot (dxc13)
  66. Re: Optim function in the loop (Rstarer)
  67. Re: A variation on the bar plot (Gabor Grothendieck)
  68. questions about function arima0 (Be?ta Darabos)
  69. Re: A variation on the bar plot (S Ellison)
  70. Re: ellipsis problem (tyler)
  71. S4 slot of type connection [Sec=Unclassified] (Troy Robertson)
  72. Re: FOURIER INTEGRALS IN R (andrew)
  73. Way to handle variable length and numbers of columns using
      read.table(...) (Jason Rupert)
  74. Re: Way to handle variable length and numbers of columns
      using	read.table(...) (jim holtman)
  75. Re: Way to handle variable length and numbers of columns
      using	read.table(...) (Gabor Grothendieck)
  76. Re: Way to handle variable length and numbers of columns
      using	read.table(...) (Jason Rupert)
  77. Re: Way to handle variable length and numbers of columns
      using	read.table(...) (Gabor Grothendieck)
  78. Re: Calculating relative ratios in a data frame.. (Zeljko Vrba)
  79. [R-pkgs] RSiteSearch package? (spencerg)
  80. Re: Randomized-complete blocks design and R (Dieter Menne)
  81. Re: levelplot question (Antje)
  82. Re: Hierarchical Diagram of Networks in sna or otherwise?
      (G?bor Cs?rdi)
  83. Heatmap without levelplot (Antje)
  84. "prob" in predict(randomForest) (H?ring)
  85. Re: About the Transfer Function Model(ARIMAX) (Ramanath Roy)
  86.  Time series ARIMAX and multivariate models (Ramanath Roy)
  87.  smoothing spline in package gam (? ??)
  88. Re: Support Vector Machines (excalibur)
  89. Can't build termstrc package from source (Chirantan Kundu)
  90. Re: Reversing axis label order (Jim Lemon)
  91. noisy quantisation (William Simpson)
  92. limits (Hassan Mohamed)
  93. stepAICc function (based on MASS:::stepAIC.default)
      (Christoph Scherber)
  94. JGR (r at quantide.com)
  95.  problem with rgl package (Erin Hodgess)


----------------------------------------------------------------------

Message: 1
Date: Mon, 4 May 2009 12:50:39 +0200
From: alis villiyam <aalisiyan at gmail.com>
Subject: [R] Randomized-complete blocks design and R
To: r-help at r-project.org
Message-ID:
	<509507040905040350m6603bcb1hbb90e07a398af777 at mail.gmail.com>
Content-Type: text/plain

Hi,

I am new in R.I am trying to analysis of variance for Randomized-complete
blocks design. I have 4 treatments and 3 replication,





Without intraction.then .I is going to use LSD test or Duncan test for
comparison between average values of treatments.

I want to know, is there any significant change between treatment and
between weeks? Because I did experiment for 8 weeks.



I am not familiar with R very well. Dose anybody has this Code?

Please help me.



Kind regards,

Alisa

	[[alternative HTML version deleted]]



------------------------------

Message: 2
Date: Mon, 04 May 2009 06:50:40 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] clear screen?
To: Charles.Annis at StatisticalEngineering.com
Cc: r-help at r-project.org
Message-ID: <49FEC880.2030403 at stats.uwo.ca>
Content-Type: text/plain; charset=windows-1252; format=flowed

On 03/05/2009 6:50 PM, Charles Annis, P.E. wrote:
> I?ve been using this routine for several years.  I?m sorry, I don?t remember
> where I got it.  It works as it should, viz. it blanks the R console.  But
> it requires package rcom and now that requires rscproxy.
> 
> cls <-
> function () 
> {
>     require(rcom)
>     wsh <- comCreateObject("Wscript.Shell")
>     comInvoke(wsh, "SendKeys", "\f")
>     invisible(wsh)
> }
> 
>> cls()
> Loading required package: rcom
> Loading required package: rscproxy
> 
> This seems like overkill to me just to blank the R console, especially since
> I am trying to diminish the number of necessary packages to support my
> home-brew package.
> 
> So, is there an easier way to blank the R console in Windows?

Ctrl-L will do it.  If you want to put it in a function, I don't think so.

An item that has been on my wish list for a long time is to rewrite the 
menu system in the Windows gui so that all items can be invoked from R 
code.  It's been sitting there in the section entitled "I wish someone 
else would do this."  It would not be hard, but it would be a lot of 
tedious work.

Duncan Murdoch

> 
> 
> 
>> sessionInfo()
> R version 2.8.1 (2008-12-22) 
> i386-pc-mingw32 
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] splines   tcltk     stats     graphics  grDevices utils     datasets
> methods   base     
> 
> other attached packages:
> [1] rcom_2.1-1         rscproxy_1.2-0     survival_2.35-3
> RColorBrewer_1.0-2   RODBC_1.2-5       myhomebrew
> 
> loaded via a namespace (and not attached):
> [1] tools_2.8.1
> 
> 
> 
> Charles Annis, P.E.
> 
> Charles.Annis at StatisticalEngineering.com
> phone: 561-352-9699
> eFax:  614-455-3265
> http://www.StatisticalEngineering.com
>  
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 3
Date: Mon, 04 May 2009 06:56:36 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] Surface for R outside of R
To: koj <jens.koch at gmx.li>
Cc: r-help at r-project.org
Message-ID: <49FEC9E4.8010609 at stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 04/05/2009 4:12 AM, koj wrote:
> Hi all,
> 
> i am new here and this is my first posting. My coding experience in R ist
> okay, but I have a problem which is related to another aspect of R.
> 
> I am searching for a surface which execute my commands in R via a click on a
> button OUTSIDE of R. Concrete: I will write some programs in R and want to
> execute this files outside of R, so I don't want to start R eyery time if i
> want an analysis. The best case were a surface of e.g. 8 Buttons, each click
> leads to start a specific R file. My outputs are JPEG or CSV, so I don`t
> need the output inside of R. Could anyone can give me some recommendations,
> what could be a solution (e. g. Java)? Is such a solution possible? 

There are many solutions.  Java (through JRI in rJava) may be the most 
portable one; there are others that are specific to particular operating 
systems.

Duncan Murdoch



------------------------------

Message: 4
Date: Mon, 04 May 2009 07:04:31 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] wrong if-else syntax
To: mauede at alice.it
Cc: r-help at stat.math.ethz.ch
Message-ID: <49FECBBF.2000509 at stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 04/05/2009 5:08 AM, mauede at alice.it wrote:
> What is wrong in the following nested if-else statements:
> 
>   if (Condition_1) {              # begin IF_1                  
>      statement_1
>      statement_2
>      statement_3
>      if (Condition_2) {                 # begin IF_2
>         a<- a +1
>      }                                       # end IF_2
>      statement_4  
>      statement_5
>      statement_6
>      statement_7
>      if (Condition_3) {                # begin IF_2                                                 
>         statement_8
>      } else {                             # ELSE_2
>         statement_9
>         statement_10
>      }                                      # end IF_2
>   } else {                           # ELSE_1
>       statement_11
>   }                                   # end IF_1
> 
> 
> It looks like R interpret does not like the above syntax. In fact in my script I have the following instructions:
> 
>   if (DonohoAplhaON){                                
>       tms <<- xx[,"sampamp"]                               #EXTRACT SIGNAL AMPLITUDE
>       tmsLen <<- length(tms)
>       J <<- ilogb(tmsLen, base=2)
>       if (logb(tmsLen, base=2)%%2 > 0) {
>          J <<- J + 1
>       }
>       rm(xx)
>       rawtms <- tms 
>       X <- PreProcessor(tms,tmsLen,J)
>       BestWavList <- FindBestWavelet (X,tmsLen,J,Step1NumHighScalesOFF)
>       if (!is.null(BestWavList)) {                                                         #COMPUTE SIGNAL DONOHO-ALPHA
>          features.mat[ns,"alpha"]<- CalcDonohoAlpha(rawtms,BestWavList$No,J,tmsLen,Step3NumHighScalesOFF,Step3AllCoefON)
>       } else {
>          cat("\n\n Could not compute Best Wavelet Basis for Signal: ",fln,"  Skip current signal! \n\n")
>          next
>      }
>   } else {
>       features.mat[ns,"alpha"] <- NA
>   }
> 
> It keeps printing out an error referred to the second " } else {" as if it could not realize that the inner if-statement has been closed:

I just tried the full block above, and it was fine.

> 
>>      if(!is.null(BestWavList)) {                                                         #COMPUTE SIGNAL DONOHO-ALPHA

Notice the prompt here is >, not +.  The problem occurred earlier:  R 
thinks this is a new statement, not part of the "if (DonohoAplhaON) {" 
block as you intended.

> +         features.mat[ns,"alpha"]<- CalcDonohoAlpha(rawtms,BestWavList$No,J,tmsLen,Step3NumHighScalesOFF,Step3AllCoefON)
> +      }else {
> +         cat("\n\n Could not compute Best Wavelet Basis for Signal: ",fln,"  Skip current signal! \n\n")
> +         next
> +      }

This finishes the statement, so the else doesn't make sense.

>>   }else {

The spacing here doesn't match what you showed above.  Are you sure 
you're pasting the right file?

You'll get better error handling using source() than cut and paste. 
source() will stop at the first error; cut and paste just keeps going.

Duncan Murdoch


> Error: unexpected '}' in "  }"
>>      features.mat[ns,"alpha"] <- NA
>>   }
> Error: unexpected '}' in "  }"
> 
> 
> Thank you for clarifying my doubts
> Maura
> 
> 
> 
> 
> tutti i telefonini TIM!
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 5
Date: Mon, 04 May 2009 12:19:15 +0100
From: "Cecilia Carmo" <cecilia.carmo at ua.pt>
Subject: [R] Creating a variable which is the sum of equal rows in a
	dataframe
To: r-help at r-project.org
Message-ID: <web-78295735 at controller.cgpmail.ua.pt>
Content-Type: text/plain;charset=iso-8859-1;format="flowed"

Hi everyone:

I need to count the number of banks of each firm in my 
data. The firm is identified by the fiscal number. The 
banks of each firm appears like this:

Firm                     Banks
500600700          Citybank
500600700          CGD
500600700          BES
500600800          Citybank
500600800          Bank1
500600900          CGD
?

I want to obtain the following dataframe:
Firm            numberofbanks
500600700          3
500600800          2
500600900          1
?

This is a question of counting the times each firm 
appears, but I don?t know which function do this. If 
anyone could help me I appreciate.

Thank you in advance for the help you could give me,

Cecilia Carmo (Portugal)



------------------------------

Message: 6
Date: Mon, 4 May 2009 13:34:12 +0200
From: baptiste auguie <ba208 at exeter.ac.uk>
Subject: Re: [R] Creating a variable which is the sum of equal rows in
	a	dataframe
To: Cecilia Carmo <cecilia.carmo at ua.pt>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID: <E0EDEDE1-0D3F-40FF-A602-193760C4C00E at exeter.ac.uk>
Content-Type: text/plain; charset=WINDOWS-1252; format=flowed

Try this,

# d <- read.table(pipe("pbpaste"), head=T) # read your data

table(d)

# library(reshape)
cast(as.data.frame(table(d)), .~Firm, fun=sum)


HTH,

baptiste


On 4 May 2009, at 13:19, Cecilia Carmo wrote:

> Hi everyone:
>
> I need to count the number of banks of each firm in my
> data. The firm is identified by the fiscal number. The
> banks of each firm appears like this:
>
> Firm                     Banks
> 500600700          Citybank
> 500600700          CGD
> 500600700          BES
> 500600800          Citybank
> 500600800          Bank1
> 500600900          CGD
> ?
>
> I want to obtain the following dataframe:
> Firm            numberofbanks
> 500600700          3
> 500600800          2
> 500600900          1
> ?
>
> This is a question of counting the times each firm
> appears, but I don?t know which function do this. If
> anyone could help me I appreciate.
>
> Thank you in advance for the help you could give me,
>
> Cecilia Carmo (Portugal)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

_____________________________

Baptiste Augui?

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag



------------------------------

Message: 7
Date: Mon, 04 May 2009 13:35:57 +0200
From: Antje <niederlein-rstat at yahoo.de>
Subject: [R] levelplot question
To: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch>

Content-Type: text/plain; charset=ISO-8859-15; format=flowed

Hi there,

I have a question concerning the behaviour of the colouring with levelplot. (I 
hope, I manage to explain)

If I give the parameters "at" and "col.regions" like this:

at <- c(1,2,3,4,5,6)
col.regions <- c("blue","blue","blue","yellow","yellow","yellow")

Which color would have the value 3.5?
I would have expected yellow, no?

In my more complex example I wanted to create a heatmap (like yellow to red) up 
to a fixed threshold. All values above should get another color (like blue).
Automatically, I generated both vectors like this:

at <- 		c(vectorOfLowerValues, myThreshold, vectorOfHigherValues)
col.regions <-  c(vectorOfHeatmapColors, lastHeatmapColor, vectorOfColor"blue")

But I get some values above the threshold which are not blue... Can anybody
explain me why? (I've checked the length of both vectors and it's parts - this 
is correct - so 'myThreshold' would get 'lastHeatmapColor' by the same vector 
position)

I'm very confused...

Antje



------------------------------

Message: 8
Date: Mon, 4 May 2009 07:36:27 -0400
From: Gabor Grothendieck <ggrothendieck at gmail.com>
Subject: Re: [R] clear screen?
To: Duncan Murdoch <murdoch at stats.uwo.ca>
Cc: r-help at r-project.org, Charles.Annis at statisticalengineering.com
Message-ID:
	<971536df0905040436k458a596w5b2fdc730df8730b at mail.gmail.com>
Content-Type: text/plain; charset=windows-1252

On Mon, May 4, 2009 at 6:50 AM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> On 03/05/2009 6:50 PM, Charles Annis, P.E. wrote:
>>
>> I?ve been using this routine for several years. ?I?m sorry, I don?t
>> remember
>> where I got it. ?It works as it should, viz. it blanks the R console. ?But
>> it requires package rcom and now that requires rscproxy.
>>
>> cls <-
>> function () {
>> ? ?require(rcom)
>> ? ?wsh <- comCreateObject("Wscript.Shell")
>> ? ?comInvoke(wsh, "SendKeys", "\f")
>> ? ?invisible(wsh)
>> }
>>
>>> cls()
>>
>> Loading required package: rcom
>> Loading required package: rscproxy
>>
>> This seems like overkill to me just to blank the R console, especially
>> since
>> I am trying to diminish the number of necessary packages to support my
>> home-brew package.
>>
>> So, is there an easier way to blank the R console in Windows?
>
> Ctrl-L will do it. ?If you want to put it in a function, I don't think so.
>
> An item that has been on my wish list for a long time is to rewrite the menu
> system in the Windows gui so that all items can be invoked from R code.
> ?It's been sitting there in the section entitled "I wish someone else would
> do this." ?It would not be hard, but it would be a lot of tedious work.

Note that the same technique used to clear the screen could be used for
this as well. For example, this causes the FAQ to appear by sending
the appropriate set of characters to active the menu:

sendKeys <- function (x) {
	require(RDCOMClient)
	wsh <- COMCreate("Wscript.Shell")
	wsh$SendKeys(x)
	invisible(wsh)
}
faq <- function() sendKeys("%HF\n")

faq()

Might have to add some Sys.sleep calls to slow it down but so far it
seems to work for me.



------------------------------

Message: 9
Date: Mon, 4 May 2009 13:38:55 +0200
From: Petr PIKAL <petr.pikal at precheza.cz>
Subject: [R] Odp: Creating a variable which is the sum of equal rows
	in a	dataframe
To: "Cecilia Carmo" <cecilia.carmo at ua.pt>
Cc: r-help at r-project.org
Message-ID:
	<OF924A8328.8F8F5FDA-ONC12575AC.003FD6A7-C12575AC.003FEE20 at precheza.cz>
	
Content-Type: text/plain; charset="UTF-8"

Hi
r-help-bounces at r-project.org napsal dne 04.05.2009 13:19:15:

> Hi everyone:
> 
> I need to count the number of banks of each firm in my 
> data. The firm is identified by the fiscal number. The 
> banks of each firm appears like this:
> 
> Firm                     Banks
> 500600700          Citybank
> 500600700          CGD
> 500600700          BES
> 500600800          Citybank
> 500600800          Bank1
> 500600900          CGD
> ?
> 
> I want to obtain the following dataframe:
> Firm            numberofbanks
> 500600700          3
> 500600800          2
> 500600900          1
> ?

E.g.

as.data.frame(rowSums(table(test)))

Regards
Petr

> 
> This is a question of counting the times each firm 
> appears, but I don?t know which function do this. If 
> anyone could help me I appreciate.
> 
> Thank you in advance for the help you could give me,
> 
> Cecilia Carmo (Portugal)
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


------------------------------

Message: 10
Date: Mon, 4 May 2009 13:41:37 +0200
From: Fredrik Karlsson <dargosch at gmail.com>
Subject: Re: [R] Creating a variable which is the sum of equal rows in
	a	dataframe
To: Cecilia Carmo <cecilia.carmo at ua.pt>
Cc: r-help at r-project.org
Message-ID:
	<376e97ec0905040441y23e8a223p20dad4038a97f752 at mail.gmail.com>
Content-Type: text/plain; charset=windows-1252

Hi Cecilia,

You can use table for this:

#Generate a dataframe
> dat.df <- data.frame(Firm = sample(c(500600700,500600800,500600800),6,replace=TRUE),Banks=sample(c("Citybank","CGD","DES","Bank1"),6,replace=TRUE)  )

#Get the counts in a table format
> with(dat.df, table(Firm,Banks))
           Banks
Firm        Bank1 CGD Citybank DES
  500600700     0   0        1   0
  500600800     2   1        1   1

#Or, if you prefer the data.frame format, you can reshape it.
> as.data.frame(with(dat.df, table(Firm,Banks)))
       Firm    Banks Freq
1 500600700    Bank1    0
2 500600800    Bank1    2
3 500600700      CGD    0
4 500600800      CGD    1
5 500600700 Citybank    1
6 500600800 Citybank    1
7 500600700      DES    0
8 500600800      DES    1

Hope this helps.

/Fredrik

On Mon, May 4, 2009 at 1:19 PM, Cecilia Carmo <cecilia.carmo at ua.pt> wrote:
> Hi everyone:
>
> I need to count the number of banks of each firm in my data. The firm is
> identified by the fiscal number. The banks of each firm appears like this:
>
> Firm ? ? ? ? ? ? ? ? ? ? Banks
> 500600700 ? ? ? ? ?Citybank
> 500600700 ? ? ? ? ?CGD
> 500600700 ? ? ? ? ?BES
> 500600800 ? ? ? ? ?Citybank
> 500600800 ? ? ? ? ?Bank1
> 500600900 ? ? ? ? ?CGD
> ?
>
> I want to obtain the following dataframe:
> Firm ? ? ? ? ? ?numberofbanks
> 500600700 ? ? ? ? ?3
> 500600800 ? ? ? ? ?2
> 500600900 ? ? ? ? ?1
> ?
>
> This is a question of counting the times each firm appears, but I don?t know
> which function do this. If anyone could help me I appreciate.
>
> Thank you in advance for the help you could give me,
>
> Cecilia Carmo (Portugal)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
"Life is like a trumpet - if you don't put anything into it, you don't
get anything out of it."



------------------------------

Message: 11
Date: Mon, 4 May 2009 07:56:50 -0400
From: Gabor Grothendieck <ggrothendieck at gmail.com>
Subject: Re: [R] Creating a variable which is the sum of equal rows in
	a	dataframe
To: Cecilia Carmo <cecilia.carmo at ua.pt>
Cc: r-help at r-project.org
Message-ID:
	<971536df0905040456x418713f6h52657a0acbd05d18 at mail.gmail.com>
Content-Type: text/plain; charset=windows-1252

Try aggregate. First we read the data into DF and
then apply aggregate:

> Lines <- "Firm                     Banks
+ 500600700          Citybank
+ 500600700          CGD
+ 500600700          BES
+ 500600800          Citybank
+ 500600800          Bank1
+ 500600900          CGD"
> # DF <- read.table("myfile.dat", header = TRUE)
> DF <- read.table(textConnection(Lines), header = TRUE)
>
> aggregate(DF["Banks"], DF["Firm"], length)
       Firm Banks
1 500600700     3
2 500600800     2
3 500600900     1

On Mon, May 4, 2009 at 7:19 AM, Cecilia Carmo <cecilia.carmo at ua.pt> wrote:
> Hi everyone:
>
> I need to count the number of banks of each firm in my data. The firm is
> identified by the fiscal number. The banks of each firm appears like this:
>
> Firm ? ? ? ? ? ? ? ? ? ? Banks
> 500600700 ? ? ? ? ?Citybank
> 500600700 ? ? ? ? ?CGD
> 500600700 ? ? ? ? ?BES
> 500600800 ? ? ? ? ?Citybank
> 500600800 ? ? ? ? ?Bank1
> 500600900 ? ? ? ? ?CGD
> ?
>
> I want to obtain the following dataframe:
> Firm ? ? ? ? ? ?numberofbanks
> 500600700 ? ? ? ? ?3
> 500600800 ? ? ? ? ?2
> 500600900 ? ? ? ? ?1
> ?
>
> This is a question of counting the times each firm appears, but I don?t know
> which function do this. If anyone could help me I appreciate.
>
> Thank you in advance for the help you could give me,
>
> Cecilia Carmo (Portugal)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 12
Date: Mon, 4 May 2009 06:03:01 -0700 (PDT)
From: Ben Bolker <bolker at ufl.edu>
Subject: Re: [R] normality test for large a large dataset ?
To: r-help at r-project.org
Message-ID: <23366862.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii




Martial Sankar wrote:
> 
> Do you know a R implemented normality test like the shapiro test but more
> suitable for large data set ?
> 

Try installing the "nortest" package.


-- 
View this message in context: http://www.nabble.com/normality-test-for-large-a-large-dataset---tp23364526p23366862.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 13
Date: Mon, 4 May 2009 09:27:05 -0400
From: Max Kuhn <mxkuhn at gmail.com>
Subject: Re: [R] Caret package: coeffcients for regression
To: Alex Roy <alexroy2008 at gmail.com>
Cc: r-help at r-project.org
Message-ID:
	<6731304c0905040627i387cf645i905423007b24b14f at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Alex,

> I am using "Caret"package for SVM regression and elastic net
> regression . I can get the final fiited vs observed values. How can I get
> the coefficients? Any ideas?

You didn't say what version of caret and R you are using, what kernel
or what type of coefficients.

If you tune a model using train:

  fit <- train(x, y, "enet")

then fit$finalModel contains an enet object with the final parameters.
You can use coef() or any other appropriate function on this object.

In the case of the elastic net, see ?predict.enet, specifically the
type argument to get the regression coefficients.

If you need to get to the final tuning parameters for the model, you
can access them via x$finalModel$tuneValue. There are a few exceptions
to this: models using S4 classes won't allow adding new objects.

For SVMs, you haven't said what kernel type you used. caret uses
kernel methods from kernlab (for no other reason that I like the
package). The only package that I know gives the *regression*
coefficients for linear kernels is svmpath (there could be others). If
you want the SV coefficients (typically denoted by alpha), kernlab has
a slot called coef that you can use.

You should really provide more information for your questions to be
answered well.

-- 

Max



------------------------------

Message: 14
Date: Mon, 4 May 2009 09:30:46 -0400
From: Markus Loecher <markus.loecher at gmail.com>
Subject: [R] can install.packages() copy utility files to the
	public_html	directory ?
To: r-help at r-project.org
Message-ID:
	<bf460e020905040630y44577d6o2e3bd918b3bb3189 at mail.gmail.com>
Content-Type: text/plain

Dear fellow R-users,
I am about to publish an HTML utility package to CRAN that expands on the
R2HTML package and includes a few goodies such as sorted tables, easy
automation of framed HTML reporting, etc.
However, some of the resulting dynamic HTML pages need to access JavaScript
code that should sit in a specific subdirectory of public_html.
My more general question is hence, (i) how do I include the directory
containing the JavaScript code in my R package and (ii) is it possible to
copy this directory to the user's public_html path during installation ?

Thanks!
Markus

	[[alternative HTML version deleted]]



------------------------------

Message: 15
Date: Mon, 04 May 2009 09:40:09 -0400
From: Luc Villandre <villandl at dms.umontreal.ca>
Subject: Re: [R] Need to clean a table, and compute mean and SD
To: Thom_249 <thomas.jordan at heig-vd.ch>
Cc: r-help at r-project.org
Message-ID: <49FEF039.6030401 at dms.umontreal.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Thom_249 wrote:
> Hi
>
> For a school project I have a file with 120 columns and  ~2000 lines. This
> file contains timestamps of spike detected in 60 channels, and the time
> elapsed between the last spike.
>
> I need to clean too high values. About 98% of values are between 0 and 2000
> and 2% are between 2000 and 20'000. I want to get rid of theses values.
>
> Please could you help me?
>
> Regards 
>
> Thom
>   
Hi,

If you are dealing with a data frame, you can simply use the index 
function like this,

my.data.frame[my.data.frame>2000] = NA

This way, all values in your data.frame that are greater than 2000 will 
be transformed into NAs. However, this kind of substitution wouldn't be 
recommended if your goal is to fit a regression model to the data. 
Missing data can sometimes be informative, hence the importance to be 
careful when doing such substitutions.
-- 
*Luc Villandr?*



------------------------------

Message: 16
Date: Mon, 4 May 2009 13:42:13 +0000 (UTC)
From: Dieter Menne <dieter.menne at menne-biomed.de>
Subject: Re: [R] levelplot question
To: r-help at stat.math.ethz.ch
Message-ID: <loom.20090504T133651-909 at post.gmane.org>
Content-Type: text/plain; charset=us-ascii

Antje <niederlein-rstat <at> yahoo.de> writes:

> I have a question concerning the behaviour of the colouring with levelplot. > 
> If I give the parameters "at" and "col.regions" like this:
> 
> at <- c(1,2,3,4,5,6)
> col.regions <- c("blue","blue","blue","yellow","yellow","yellow")
> 
> Which color would have the value 3.5?
> I would have expected yellow, no?

You implicitly expect round(). 

[1] "blue"
> col.regions[3.5]
[1] "blue"
> col.regions[round(3.5)]
[1] "yellow"

Your question implies that you may also susceptible to the problem of
R FAQ 7.31, "Why doesn't R think these numbers are equal?"

Dieter



------------------------------

Message: 17
Date: Mon, 4 May 2009 09:47:06 -0400
From: "Ravi Varadhan" <RVaradhan at jhmi.edu>
Subject: Re: [R] Nelson-Aalen estimator of cumulative hazard
To: "'Ravi Varadhan'" <rvaradhan at jhmi.edu>, <r-help at r-project.org>
Message-ID: <002901c9ccbe$cffe93b0$7c94100a at win.ad.jhu.edu>
Content-Type: text/plain;	charset="us-ascii"

Hi,

I figure out the reason for the difference.  There are ties in failure times
in the data set.  Consequently, it matters which method is used to handle
ties in "coxph". The default is "efron".  If I use method="breslow", there
is no difference between the 2 different ways of computing the Nelson-Aalen
estimte.

require(foreign)

gb <- read.dta("GB.dta")  # Green & Byar data; N = 483

# Method 1 (note the use of Breslow estimator)

fit1 <- coxph( Surv(time, status=="Cancer" | status=="CVD" |
status=="Other") ~ 1, method="breslow", data=gb) 

h1 <- basehaz(fit1)

# Method 2

fit2 <- survfit(Surv(time, status=="Cancer" | status=="CVD" |
status=="Other") ~ 1, data=gb)

jump <- fit2$n.event > 0

h2 <-  cumsum(fit2$n.event[jump]/fit2$n.risk[jump])

	> min(abs(h1$hazard - h2))
	[1] 1.387779e-17



Best,
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: rvaradhan at jhmi.edu

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html



----------------------------------------------------------------------------
--------


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Ravi Varadhan
Sent: Monday, May 04, 2009 12:33 AM
To: r-help at r-project.org
Subject: [R] Nelson-Aalen estimator of cumulative hazard

Hi,

I am computing the Nelson-Aalen (NA) estimate of baseline cumulative hazard
in two different ways using the "survival" package.  I am expecting that
they should be identical.  However, they are not. Their difference is a
monotonically increasing with time.  This difference is probably not large
to make any impact in the application, but is annoyingly non-trivial for me
to just ignore it.  

This is a competing risks problem, with the Green & Byar (1980) data set
(the STATA data set is attached).

Can anyone explain to me the reason for the discrepancy?


require(foreign)

gb <- read.dta("GB.dta")  # Green & Byar data; N = 483

# Method 1

fit1 <- coxph( Surv(time, status=="Cancer" | status=="CVD" |
status=="Other") ~ 1, data=gb) 

h1 <- basehaz(fit1)

# Method 2

fit2 <- survfit(Surv(time, status=="Cancer" | status=="CVD" |
status=="Other") ~ 1, data=gb)

jump <- fit2$n.event > 0

h2 <-  cumsum(fit2$n.event[jump]/fit2$n.risk[jump])

plot(h1$time, h1$hazard - h2)

Thank you,
Ravi.
____________________________________________________________________

Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology School of Medicine Johns
Hopkins University

Ph. (410) 502-2619
email: rvaradhan at jhmi.edu



------------------------------

Message: 18
Date: Mon, 4 May 2009 15:51:26 +0200
From: Hans-Peter Suter <gchappi at gmail.com>
Subject: Re: [R] Surface for R outside of R
To: koj <jens.koch at gmx.li>
Cc: r-help at r-project.org
Message-ID:
	<47fce0650905040651j2527bc15o600d0f1acaa2de52 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

> want an analysis. The best case were a surface of e.g. 8 Buttons, each click
> leads to start a specific R file. My outputs are JPEG or CSV, so I don`t
> need the output inside of R. Could anyone can give me some recommendations,
> what could be a solution (e. g. Java)? Is such a solution possible?

?What about batch scripts which would be called by your GUI? (maybe
you could even skip the gui...)
(see ?Rscript (unix alike) or Windows FAQ, 2.12)

--
Regards,
Hans-Peter



------------------------------

Message: 19
Date: Mon, 4 May 2009 19:28:21 +0530
From: Harsh <singhalblr at gmail.com>
Subject: Re: [R] Dynamic visualisation of R data using Adobe FLEX
To: Yihui Xie <xieyihui at gmail.com>
Cc: r-help at r-project.org
Message-ID:
	<e0bbde350905040658u633adab4pd31e7ce1ef64de5c at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Yihui,
In trying to make FLEX and R talk, I have decided to approach it by
using the Rserver JRclient as the middle tier in a three tier
approach.
Tier 1: FLEX Visualisation
Tier 2: JRclient (http://rosuda.org/Rserve/example.shtml)
Tier 3: Rserver

I have yet to begin working on this front, but would like to know what
you think about this approach. I understand FLEX and JAVA communicate
seamlessly and a JAVA client to communicate with Rserver seems to seal
the deal for making FLEX and R talk to each other.

Thanks
Harsh Singhal




On Sat, May 2, 2009 at 12:37 PM, Yihui Xie <xieyihui at gmail.com> wrote:
> Hi Harsh,
>
> If your project is so specific on the regression model, my suggestion
> is to use tcl/tk or Gtk2 interface instead of FLEX, because your
> requirement on interaction is simple (e.g. you don't need to
> drag-and-drop points).
>
> I think the example 'run.cor2.examp()' in 'TeachingDemos' package can
> give you enough inspiration.
>
> Or if you want to do the job (to change the slope) automatically, you
> may want to see the example in the 'animation' package:
>
> ##
> install.packages("animation")
> library(animation)
>
> # default animation in R: with slope changing
> least.squares()
>
> # animation in an HTML page
> oopt = ani.options(ani.height = 450, ani.width = 600,
> ? ?outdir = tempdir(), nmax = 50, title = "Demonstration of Least Squares",
> ? ?description = "We want to find an estimate for the slope
> ? ? ? ? in 50 candidate slopes, so we just compute the RSS one by one. ")
> ani.start()
> par(mar = c(4, 4, 0.5, 0.1), mgp = c(2, 0.5, 0), tcl = -0.3)
> least.squares()
> ani.stop()
> ani.options(oopt)
> ##
>
> P. S. I'm quite interested in interactive visualization using R and
> Flash (you may also want to know Flare and SWF Tools!), so please let
> me know if there's any progress in your project.
>
> Regards,
> Yihui
> --
> Yihui Xie <xieyihui at gmail.com>
> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
> Mobile: +86-15810805877
> Homepage: http://www.yihui.name
> School of Statistics, Room 1037, Mingde Main Building,
> Renmin University of China, Beijing, 100872, China
>
>
>
> On Thu, Apr 30, 2009 at 2:54 AM, Harsh <singhalblr at gmail.com> wrote:
>> Hi useRs,
>>
>> I had posted about Adobe FLEX talking to R for rich visualisation.
>> Reply from Jeffery Horner contained links to the
>> revolution-computing.com webpage which had information pertaining to
>> the Bay Users R group Meetup on Web Dashboards with R.
>>
>> I have a very specific project that I need to implement.
>> I wish to use the graphics capabilities provided by Adobe FLEX to
>> visualise outputs from R.
>> For example:
>> I would like to fit a regression model to a dataset in R and provide a
>> FLEX interface wherein, a user may manipulate a slider which would
>> increase or decrease
>> a parameter estimate (between the confidence intervals of the
>> estimate) of a variable to see the effect on the predicted values.
>>
>> I necessarily have to use FLEX for the interface.
>> In trying to make sense of how to go about this task, I have
>> speculated on the following technologies:
>> 1) Using RSOAP which requires a Python client. I am not sure how I can
>> implement this in Flex.
>> 2) Using RSOAP provided by the Biocep project. This is a java
>> implementation and maybe this would suit my requirements.
>> 3) The StatDataML package in R provides the creation of xml files of R
>> objects. Maybe I can use these XML files as encapsulators of R object
>> data and pass it on to FLEX.
>> 4) Since R has interfaces that connect to most SQL database servers, I
>> can convert results of lm objects (summary(lmobject)) to data frames
>> and push them into the SQL database. FLEX can
>> then read the table and extract the relevant fields for output.
>>
>> I am aware that I not a computer programmer which is why I may not be
>> making a whole lot of sense in describing the above scenarios, but I
>> am trying to gain as much information and programming skills to
>> 'decipher'
>> the secret behind using FLEX and R.
>>
>> I have looked at Jeffery Horner's ?BBPLOT project
>> (http://data.vanderbilt.edu/rapache/bbplot) and honestly I'm amazed.
>> Replicating this with a FLEX interface is the closest I can get in
>> describing my requirements.
>>
>> Any information/technical sources/tutorials etc in this regard will be
>> much appreciated.
>>
>> Thank you for your time.
>>
>> Regards
>> Harsh Singhal
>> Decision Systems
>> Mu Sigma Inc.
>> Chicago, IL
>>
>



------------------------------

Message: 20
Date: Mon, 4 May 2009 10:05:43 -0400
From: David Winsemius <dwinsemius at comcast.net>
Subject: Re: [R] About the Transfer Function Model(ARIMAX)
To: Ramanath Roy <r.roy at decisioncraft.com>
Cc: r-help at r-project.org
Message-ID: <F8AC4659-7972-47C5-B455-EACC5A6038F3 at comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

pages 43-54 of:

http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf

... is an article by Uwe Ligges on accesssing source code.

On Apr 2, 2009, at 4:20 AM, Ramanath Roy wrote:

> Dear ALL,
>
> I would appreciate if someone help me by letting me know the code of  
> above model in R.I would request you to please let me know how i could
> make arimax model in auto.arima.
>
>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



------------------------------

Message: 21
Date: Mon, 4 May 2009 14:18:24 +0000
From: Steve Murray <smurray444 at hotmail.com>
Subject: [R] Reversing axis label order
To: <r-help at r-project.org>
Message-ID: <BAY135-W50E45AF12A29779799305F88680 at phx.gbl>
Content-Type: text/plain; charset="Windows-1252"


Dear R Users,

I am executing the following command to produce a line graph:

matplot(aggregate_1986[,1], aggregate_1986[,2:3], type="l", col=2:3)

On the x-axis I have values of Latitude (in column 1) ranging from -60 to +80 (left to right on the x-axis). However, I wish to have these values shown in reverse on the x-axis, going from +80 to -60 (ie. North to South in terms of Latitude). I have tried doing this by altering the command as follows:

matplot(-aggregate_1986[,1], aggregate_1986[,2:3], type="l", col=2:3)

...but this produces the inverse sign of the latitude values along the axis - ie. it goes from -80 to +60.

How do I reverse the display of the axis labels correctly and of course, maintain the associated data values correctly?

Many thanks,

Steve



------------------------------

Message: 22
Date: Mon, 4 May 2009 07:34:58 -0700 (PDT)
From: Qianfeng Li <qflichem at yahoo.com>
Subject: [R] how to remove ( ) ? when using write.csv(chron.object)
To: R-help at r-project.org
Message-ID: <747175.5338.qm at web53501.mail.re2.yahoo.com>
Content-Type: text/plain

Hello all,

I don' like to have ( ) around my datetime, when send the csv file to somebody. 

How to remove it?

>library(chron)
>mydate <- c("2009-05-03","2009-06-07")
>mytime <- c("10:30:00","10:20:00")
>mydatetime <- chron(dates=mydate,times=mytime,format=c("y-m-d","h:m:s"))
>write.csv(mydatetime)
�
"","x"
"1",(09-05-03 10:30:00)
"2",(09-06-07 10:20:00)
�
thanks!
Jeff 


      
	[[alternative HTML version deleted]]



------------------------------

Message: 23
Date: Mon, 04 May 2009 16:55:27 +0200
From: Uwe Ligges <ligges at statistik.tu-dortmund.de>
Subject: Re: [R] can install.packages() copy utility files to the
	public_html directory ?
To: Markus Loecher <markus.loecher at gmail.com>
Cc: r-help at r-project.org
Message-ID: <49FF01DF.80107 at statistik.tu-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed



Markus Loecher wrote:
> Dear fellow R-users,
> I am about to publish an HTML utility package to CRAN that expands on the
> R2HTML package and includes a few goodies such as sorted tables, easy
> automation of framed HTML reporting, etc.
> However, some of the resulting dynamic HTML pages need to access JavaScript
> code that should sit in a specific subdirectory of public_html.
> My more general question is hence, (i) how do I include the directory
> containing the JavaScript code in my R package and 

Yes, in directory ./inst/JavaScript for example that is copied to 
./JavaScript during installation of the package.


> (ii) is it possible to
> copy this directory to the user's public_html path during installation ?

Yes, if it is a source package (not for a binary package), BUT you 
should not write such code that copyies files to a directory different 
than the package's directory in the library that it is installed to. 
Things that install files to suprising locations are sometimes 
considered to be some kind of malware.

Uwe Ligges



> 
> Thanks!
> Markus
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



------------------------------

Message: 24
Date: Mon, 4 May 2009 11:01:36 -0400
From: Gabor Grothendieck <ggrothendieck at gmail.com>
Subject: Re: [R] how to remove ( ) ? when using
	write.csv(chron.object)
To: Qianfeng Li <qflichem at yahoo.com>
Cc: R-help at r-project.org
Message-ID:
	<971536df0905040801u42e7242dk2aa77764c7118137 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Try:

> write.csv(format(mydatetime, enclosed = c("", "")))
"","x"
"1","09-05-03 10:30:00"
"2","09-06-07 10:20:00"


On Mon, May 4, 2009 at 10:34 AM, Qianfeng Li <qflichem at yahoo.com> wrote:
> Hello all,
>
> I don' like to have ( ) around my datetime, when send the csv file to somebody.
>
> How to remove it?
>
>>library(chron)
>>mydate <- c("2009-05-03","2009-06-07")
>>mytime <- c("10:30:00","10:20:00")
>>mydatetime <- chron(dates=mydate,times=mytime,format=c("y-m-d","h:m:s"))
>>write.csv(mydatetime)
>
> "","x"
> "1",(09-05-03 10:30:00)
> "2",(09-06-07 10:20:00)
>
> thanks!
> Jeff
>
>
>
> ? ? ? ?[[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



------------------------------

Message: 25
Date: Mon, 4 May 2009 11:03:56 -0400
From: Gabor Grothendieck <ggrothendieck at gmail.com>
Subject: Re: [R] can install.packages() copy utility files to the
	public_html directory ?
To: Uwe Ligges <ligges at statistik.tu-dortmund.de>
Cc: r-help at r-project.org, Markus Loecher <markus.loecher at gmail.com>
Message-ID:
	<971536df0905040803i128eb76t4dee09ed12e5d4ff at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

2009/5/4 Uwe Ligges <ligges at statistik.tu-dortmund.de>:
>
>
> Markus Loecher wrote:
>>
>> Dear fellow R-users,
>> I am about to publish an HTML utility package to CRAN that expands on the
>> R2HTML package and includes a few goodies such as sorted tables, easy
>> automation of framed HTML reporting, etc.
>> However, some of the resulting dynamic HTML pages need to access
>> JavaScript
>> code that should sit in a specific subdirectory of public_html.
>> My more general question is hence, (i) how do I include the directory
>> containing the JavaScript code in my R package and
>
> Yes, in directory ./inst/JavaScript for example that is copied to
> ./JavaScript during installation of the package.
>
>
>> (ii) is it possible to
>> copy this directory to the user's public_html path during installation ?
>
> Yes, if it is a source package (not for a binary package), BUT you should
> not write such code that copyies files to a directory different than the
> package's directory in the library that it is installed to. Things that
> install files to suprising locations are sometimes considered to be some
> kind of malware.
>

Also not all uses of R2HTML would be for use with a web
server at all.  Also you can't assume the directory is public_html
even if it is on a server.



------------------------------

Message: 26
Date: Mon, 4 May 2009 05:52:33 -0700 (PDT)
From: excalibur <servien.remi12 at yahoo.fr>
Subject: Re: [R] Support Vector Machines
To: r-help at r-project.org
Message-ID: <23366761.post at talk.nabble.com>
Content-Type: text/plain; charset=UTF-8


This question is still unanswered.

Someone can explain me how use the svm function to make density estimation ? 

Thanks ...



excalibur wrote:
> 
> Hi,
> i try to use function svm of package e1071 to estimate a density.
> 
> But if my data are X=(X1,...,Xn) and m<-svm(X) some values of m$SV are
> less than 0.
> I don't see how i can get the estimation of the density with this
> function.
> 
> Thanks for your help.
> 
> R?mi
> 

-- 
View this message in context: http://www.nabble.com/Support-Vector-Machines-tp19069442p23366761.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 27
Date: Mon, 04 May 2009 17:20:26 +0200

Subject: [R]  levelplot question
To: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch>

Content-Type: text/plain; charset=ISO-8859-15; format=flowed

@Dieter:

 > You implicitly expect round().

 > Your question implies that you may also susceptible to the problem of
 > R FAQ 7.31, "Why doesn't R think these numbers are equal?"

No, I guess, you misunderstood my question. These vectors (at and col.regions) 
are given to levelplot together with some data which should be visualized.
I don't know how exactly levelplot works (I was asking for help to understand 
it) but somehow it creates something like bins from "at" and uses "col.regions" 
to display all datavalues within the same bin with the according color.
I'd like to know, which color to expect from levelplot for a certain datavalue 
(3.5)

Did I explain it somehow clear now?

Antje



------------------------------

Message: 28
Date: Mon, 4 May 2009 11:37:53 -0400
From: David Winsemius <dwinsemius at comcast.net>
Subject: Re: [R] Support Vector Machines
To: excalibur <servien.remi12 at yahoo.fr>
Cc: r-help at r-project.org
Message-ID: <CE93DC70-ECD7-4C8F-B087-32828C060342 at comcast.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes


On May 4, 2009, at 8:52 AM, excalibur wrote:

>
> This question is still unanswered.

Unanswered questions are often those which do not comply with the  
guidelines in the Posting Guide. Many people have gotten tired of  
either making up examples or of writing  "Read the Posting Guide", so  
they just ignore them.


> Someone can explain me how use the svm function to make density  
> estimation ?

If you post an executable bit of code that shows how you are doing  
those operations, then I suspect someone will answer.

excalibur wrote:
>
>>
>> Hi,
>> i try to use function svm of package e1071 to estimate a density.
>>
>> But if my data are X=(X1,...,Xn) and m<-svm(X) some values of m$SV  
>> are
>> less than 0.
>> I don't see how i can get the estimation of the density with this
>> function.
>>
>> Thanks for your help.
>>
>> R?mi
>>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



------------------------------

Message: 29
Date: Mon, 4 May 2009 17:44:07 +0200
From: Karsten Weinert <k.weinert at gmx.net>
Subject: [R] mosaic plot with two factors and one continous variable
To: r-help at r-project.org
Message-ID:
	<d316b35e0905040844u347d5ab8r5002914754d83c88 at mail.gmail.com>
Content-Type: text/plain

Hello,
my dataset is already aggregated: I have two categorical variables, say
"continent" and "country" and one non-negative metric variable "population".
Now I would like to produce a mosaic plot which uses "population" to
determine how large each area of the plot is.

In other words, I fail to find out
- how to use the mosaic function of the vcd package without using table,
- or I do not know how to convert my dataset into a table (as.table fails)

As an example, here a simple dataset:

Continent; Country; Population
Europe; France; 65
Europe; Germany; 80
Africa; Algeria; 32
....

Can you help me to get started?

Kind regards,
Karsten.

	[[alternative HTML version deleted]]



------------------------------

Message: 30
Date: Mon, 4 May 2009 18:35:02 +0200
From: Patrizio Frederic <frederic.patrizio at gmail.com>
Subject: Re: [R] Reversing axis label order
To: Steve Murray <smurray444 at hotmail.com>
Cc: r-help at r-project.org
Message-ID:
	<a97051330905040935m6893fce2r7f0db6919584ab89 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Dear Steve,
I'm not sure I properly understood the question. Try

x<- aggregate_1986 # just a shortcut
n<- dim(x)[[1]]
matplot(x[n:1,1], x[n:1,2:3], type="l", col=2:3)

is that what you needed?

Patrizio

2009/5/4 Steve Murray <smurray444 at hotmail.com>:
>
> Dear R Users,
>
> I am executing the following command to produce a line graph:
>
> matplot(aggregate_1986[,1], aggregate_1986[,2:3], type="l", col=2:3)
>
> On the x-axis I have values of Latitude (in column 1) ranging from -60 to +80 (left to right on the x-axis). However, I wish to have these values shown in reverse on the x-axis, going from +80 to -60 (ie. North to South in terms of Latitude). I have tried doing this by altering the command as follows:
>
> matplot(-aggregate_1986[,1], aggregate_1986[,2:3], type="l", col=2:3)
>
> ...but this produces the inverse sign of the latitude values along the axis - ie. it goes from -80 to +60.
>
> How do I reverse the display of the axis labels correctly and of course, maintain the associated data values correctly?
>
> Many thanks,
>
> Steve
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
+-------------------------------------------------
| Patrizio Frederic, PhD
| Assistant Professor,
| Department of Economics,
| University of Modena and Reggio Emilia,
| Via Berengario 51,
| 41100 Modena, Italy
|
| tel:  +39 059 205 6727
| fax:  +39 059 205 6947
| mail: patrizio.frederic at unimore.it
+-------------------------------------------------



------------------------------

Message: 31
Date: Mon, 4 May 2009 18:37:51 +0200 (CEST)
From: Achim Zeileis <Achim.Zeileis at wu-wien.ac.at>
Subject: Re: [R] mosaic plot with two factors and one continous
	variable
To: Karsten Weinert <k.weinert at gmx.net>
Cc: r-help at r-project.org
Message-ID:
	<Pine.LNX.4.64.0905041835370.22379 at paninaro.stat-math.wu-wien.ac.at>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed



On Mon, 4 May 2009, Karsten Weinert wrote:

> Hello,
> my dataset is already aggregated: I have two categorical variables, say
> "continent" and "country" and one non-negative metric variable "population".
> Now I would like to produce a mosaic plot which uses "population" to
> determine how large each area of the plot is.
>
> In other words, I fail to find out
> - how to use the mosaic function of the vcd package without using table,
> - or I do not know how to convert my dataset into a table (as.table fails)
>
> As an example, here a simple dataset:
>
> Continent; Country; Population
> Europe; France; 65
> Europe; Germany; 80
> Africa; Algeria; 32
> ....
>
> Can you help me to get started?

You can create the tables by
   xtabs(Population ~ Continent, data = mydata)
etc. which can then be visualized using mosaic() in the usual way.

hth,
Z

> Kind regards,
> Karsten.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



------------------------------

Message: 32
Date: Mon, 04 May 2009 12:49:45 -0400
From: Jennifer Brea <brea at fas.harvard.edu>
Subject: [R] Zelig, oprobit error
To: r-help at r-project.org
Message-ID: <49FF1CA9.1070300 at fas.harvard.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

I'm getting an error message when I use the ordered probit model 
"oprobit" in the zelig function.  Using the same form as in the help 
file, we get an error message.  It produces coefficients, but no 
standard errors.  See results below.  Any hints?

Thanks!

 > 
 > o.probit <- zelig(as.factor(checks.change) ~ Oda + Oil + sh_neg + 
sh_pos + checks1, model="oprobit", data=data.all)
 > summary(o.probit)
Error in svd(X) : infinite or missing values in 'x'
 > o.probit$coefficients
       Oda        Oil     sh_neg     sh_pos    checks1 
 2.858e-02  1.978e-07 -1.961e-02  4.810e-02  8.492e-02 
 >



------------------------------

Message: 33
Date: Mon, 4 May 2009 10:27:24 -0700 (PDT)
From: Jason Rupert <jasonkrupert at yahoo.com>
Subject: [R] Handling Error Thrown After source(...), read.table(...),
	and readLines(...)
To: R-help at r-project.org
Message-ID: <612741.92948.qm at web56004.mail.re3.yahoo.com>
Content-Type: text/plain; charset=us-ascii


Finally, I'm getting to a point in working with R where I would like to start to add some smart and custom error handling.  

Specifically, I would like to add custom error handling to my code for source(...), read.table(...), and readLines(...)

For example, right now I have the following:
> postprocesspath<-c("C:/")
> postprocess_scriptname<-c("Bob.R")
> fullpostpocessingpath<-paste(postprocesspath, postprocess_scriptname, sep="")
> source(fullpostpocessingpath)
Error in file(file, "r", encoding = encoding) : 
  cannot open the connection
In addition: Warning message:
In file(file, "r", encoding = encoding) :
  cannot open file 'C:/Bob.R': No such file or directory


Instead of the error shown above, I would just like to simply have the last line "cannot open file 'C:/Bob.R': No such file or directory" Or, add my own statement to the above, e.g. 

##########################################################
##########################################################
[[elided Yahoo spam]]
##########################################################
##########################################################


I would like to do something similar for read.table(...) and readLines(...).


Is such a thing possible? 

Thanks again.



------------------------------

Message: 34
Date: Mon, 4 May 2009 11:32:15 -0600
From: Greg Snow <Greg.Snow at imail.org>
Subject: Re: [R] normality test for large a large dataset ?
To: Martial Sankar <martial100kar at hotmail.com>, rhelp
	<r-help at r-project.org>
Message-ID:
	<B37C0A15B8FB3C468B5BC7EBC7DA14CC61D19A1765 at LP-EXMBVS10.CO.IHC.COM>
Content-Type: text/plain; charset="iso-8859-1"

See: http://finzi.psych.upenn.edu/R/Rhelp08/archive/136160.html

But the issue really comes down to the fact that the questions: "exactly normal?", and "normal enough?" are 2 very different questions (with the difference becoming greater with increased sample size) and while the first is the easier to answer, the second is generally the more useful one.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Martial Sankar
> Sent: Monday, May 04, 2009 1:49 AM
> To: rhelp
> Subject: [R] normality test for large a large dataset ?
> 
> 
> 
> Hello,
> 
> Do you know a R implemented normality test like the shapiro test but
> more suitable for large data set ?
> 
> Thanks,
> 
> 
> 
> _________________________________________________________________
> D?couvrez toutes les possibilit?s de communication avec vos proches
> 
> 	[[alternative HTML version deleted]]



------------------------------

Message: 35
Date: Mon, 4 May 2009 10:58:05 -0700 (PDT)
From: Steve Jaffe <sjaffe at riskspan.com>
Subject: [R]  Cox Proportional Odds Model
To: r-help at r-project.org
Message-ID: <23373426.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Is there a function, like coxph for the proportional hazard model, for
fitting a discrete-time proportional odds model? 
-- 
View this message in context: http://www.nabble.com/Cox-Proportional-Odds-Model-tp23373426p23373426.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 36
Date: Mon, 4 May 2009 19:06:03 +0100
From: Paul Smith <phhs80 at gmail.com>
Subject: [R] Code of the max() function
To: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
	<6ade6f6c0905041106k7c0159afic809db7b1e437c4 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Dear All,

Where can one find the code of the max() function? Is that written in C?

Thanks in advance,

Paul



------------------------------

Message: 37
Date: Mon, 4 May 2009 17:31:20 +0100
From: barbara horta e costa <barbarahcosta at gmail.com>
Subject: [R] help_if command_new column
To: r-help at R-project.org
Message-ID:
	<c61c88fe0905040931w3815b8e6w7d608091a46a00a1 at mail.gmail.com>
Content-Type: text/plain

Hi everyone,

Do you know how to apply a If command to a vector in a data.frame, creating
a new column?

Example: If one species has "1" value in the Abundance column then it is
"Solitary". If the abundance is higher than 1, is "School".

I did:

aggregationFunction <-function(x){
         (if (x>1) a<- 'School'
            else a<- 'Solitary')
            return (a)
           }

 Then:

Aggregation <- lapply (df$Number, aggregationFunction )



Then:

 df <- data.frame (df, Aggregation)



And I got this error:
Error in data.frame(df, Aggregation) :
  arguments imply differing number of rows: 2576, 1



Can you help me doing this function to a vector? I�ve tried to find this
question and the answer online but I couldn't.



I tried also only with if but it is only for 1 length and the error was:

  the condition has length > 1 and only the first element will be used



This question seemed easy in the beginning but I was not successful.



Thanks a lot for helping me.

Barbara


-- 
B�rbara H. Costa
Marine Biologist Researcher
SCIAENA - Marine Sciences and Cooperation
www.sciaena.org

bcosta at ispa.pt
barbarahcosta at gmail.com

	[[alternative HTML version deleted]]



------------------------------

Message: 38
Date: Mon, 04 May 2009 19:24:33 +0200
From: "andrea.spano at quantide.com" <andrea.spano at quantide.com>
Subject: [R] Java-R
To: r-help at r-project.org
Message-ID: <49FF24D1.3030902 at quantide.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Dear R user
We would be interested to talk with someone, living in Milan (Italy) 
area, with good experience in Java-R based applications development.
We can provide good R skills but we are poor java programmers
Can anyone help?
Thanks in advance for any help


-- 
Andrea Spano'
Quantide s.r.l.

andrea.spano at quantide.com

Il messaggio trasmesso pu? contenere informazioni di carattere
confidenziale rivolte esclusivamente al destinatario. Ne ? vietato
l'uso, l diffusione, la distribuzione o la riproduzione da parte di
altre persone e/o entit? diverse da quelle specificate. Nel caso aveste
ricevuto questo messaggio per errore siete pregati di segnalarlo
immediatamente al mittente e cancellare quanto ricevuto.

This electronic mail transmission may contain confidential information
addressed only to the person (s) named. Any use, distribution, copyng or
disclosure by any other person and/or entities other than the intended
recipient is prohibited. If you received this transmission in error,
please inform the sender immediately and delete the material.



------------------------------

Message: 39
Date: Mon, 4 May 2009 11:31:36 -0700 (PDT)
From: jebyrnes <byrnes at msi.ucsb.edu>
Subject: Re: [R] Hierarchical Diagram of Networks in sna or otherwise?
To: r-help at r-project.org
Message-ID: <23374024.post at talk.nabble.com>
Content-Type: text/plain; charset=UTF-8


Nearly.  The algorithm turns up slightly different graphs each time (and
set.seed doesn't seem to make it consistent) and periodically chokes.  But
better than what I had.  Hrm.  I don't know much about the algorithm
graphviz uses for dot.  Do you have a reference on hand?  If it's simple,
I'd be willing to take a whack at it.


G?bor Cs?rdi-2 wrote:
> 
> Jarrett,
> 
> the 'igraph' package has a layout called layout.reingold.tilford that
> is designed for trees, there is a slight chance that it is good enough
> for you.
> 
> Best,
> Gabor
> 
> On Wed, Apr 29, 2009 at 10:11 PM, jebyrnes <byrnes at msi.ucsb.edu> wrote:
>>
>> I've been using sna to work with some networks, and am trying to
>> visualize
>> them easily. ?My networks are hierarchical (food webs). ?All of the
>> layout
>> engines I've tried with gplot don't seem to plot hierarchical networks,
>> as
>> one would using dot from graphviz. ?While I could do all of this by
>> outputting to dotfiles and running it through graphviz, the graphics I
>> get
>> from R are much cleaner, and more easily integrated into my analyses.
>>
>> Is there any good way to diagram a hierarchical network in R, either with
>> the sna library or otherwise? ?It strikes me that at least the Netindices
>> package can calculate trophic levels. ?Could this be used for node
>> placement?
>>
>>
>> -Jarrett
>> --
>> View this message in context:
>> http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23301819.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 
> 
> -- 
> Gabor Csardi <Gabor.Csardi at unil.ch>     UNIL DGM
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23374024.html
Sent from the R help mailing list archive at Nabble.com.



------------------------------

Message: 40
Date: Mon, 4 May 2009 14:41:40 -0400
From: David Winsemius <dwinsemius at comcast.net>
Subject: Re: [R] help_if command_new column
To: barbara horta e costa <barbarahcosta at gmail.com>
Cc: r-help at r-project.org
Message-ID: <A93E6C26-52CB-42B2-B4E2-D97FEE5B5D49 at comcast.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes

You should be looking at the ifelse function. Ihe if and else  
constructs are not appropriate for recoding because they do not return  
vectors.

Much easier than all that folderol would be:

df$Aggregation <- ifelse( df$Number>1, "School", "Solitary")


On May 4, 2009, at 12:31 PM, barbara horta e costa wrote:

> Hi everyone,
>
> Do you know how to apply a If command to a vector in a data.frame,  
> creating
> a new column?
>
> Example: If one species has "1" value in the Abundance column then  
> it is
> "Solitary". If the abundance is higher than 1, is "School".
>
> I did:
>
> aggregationFunction <-function(x){
>         (if (x>1) a<- 'School'
>            else a<- 'Solitary')
>            return (a)
>           }
>
> Then:
>
> Aggregation <- lapply (df$Number, aggregationFunction )
>
>
>
> Then:
>
> df <- data.frame (df, Aggregation)
>
>
>
> And I got this error:
> Error in data.frame(df, Aggregation) :
>  arguments imply differing number of rows: 2576, 1
>
>
>
> Can you help me doing this function to a vector? I?ve tried to find  
> this
> question and the answer online but I couldn't.
>
>
>
> I tried also only with if but it is only for 1 length and the error  
> was:
>
>  the condition has length > 1 and only the first element will be used
>
>
>
> This question seemed easy in the beginning but I was not successful.
>
>
>
> Thanks a lot for helping me.
>
> Barbara
>
>
> -- 
> B?rbara H. Costa
> Marine Biologist Researcher
> SCIAENA - Marine Sciences and Cooperation
> www.sciaena.org
>
> bcosta at ispa.pt
> barbarahcosta at gmail.com
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



------------------------------

Message: 41
Date: Mon, 04 May 2009 12:43:42 -0600
From: "Francisco J. Zagmutt" <gerifalte28 at hotmail.com>
Subject: Re: [R] Surface for R outside of R
To: r-help at stat.math.ethz.ch
Cc: r-help at r-project.org, koj <jens.koch at gmx.li>
Message-ID: <49FF375E.7020904 at hotmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Koj,

I just completed a Windows application using the batch approach and it 
works very well.  In our case, we used VBA for Excel to call different 
batch files that execute R code, but you can do the same from any 
platform.  Here is a simple step-by-step example on how to make the 
batch files work (in Windows):


1. Write your R code and save it the directory where you want your 
results.  Here is a very simple example using a file called "normal.r". 
This code takes 100 random samples from a standard normal and writes the 
results to a file called "data.txt"

write(rnorm(100),"data.txt")
q(save="no", runLast = F)


2. Make sure that the console finds the path to R without changing your 
path environment variable.  The easiest way to do this is to download 
the batchfiles that Gabor Grothendieck has kindly provided in this site 
http://code.google.com/p/batchfiles/ and put one or all of the files in 
the same directory where your batch and R files will reside.  The only 
file I have needed so far in different WinXP and Vista machines was 
"Rcmd.bat" but you may need to use others.


3. Open a text editor and create a file with a .bat or .cmd extension. 
Here is an example of a file called "TestBatch.CMD" that runs the code 
in "normal.r"

@ECHO OFF
title Random number generation
ECHO Taking 100 random samples from a N(0,1)
Rcmd BATCH --slave normal.r Log.txt
ECHO Analysis done. See the file data.txt for results
PING 1.1.1.1 -n 1 -w 1000 >NUL
@ECHO OFF

The main line here is "Rcmd BATCH --slave normal.r Log.txt" which tells 
the console to run your R code, and to write outputs printed in the 
console (i.e. errors) to the Log.txt file. The PING argument adds a 
short lag before the console closes, so the user can see what is echoed 
in the console. The other lines should be pretty self-explanatory.

4. Execute the "TestBatch.CMD" file (by hand or via your GUI) and watch 
the results.  You should now see two new files ("data.txt" and 
"Log.txt") in the same directory as the batch file.


I hope this helps. Let me know if you have any other questions.

Regards,

Francisco

Francisco J. Zagmutt
Vose Consulting
2891 20th Street
Boulder, CO, 80304
USA
www.voseconsulting.com


Hans-Peter Suter wrote:
>> want an analysis. The best case were a surface of e.g. 8 Buttons, each click
>> leads to start a specific R file. My outputs are JPEG or CSV, so I don`t
>> need the output inside of R. Could anyone can give me some recommendations,
>> what could be a solution (e. g. Java)? Is such a solution possible?
> 
>  What about batch scripts which would be called by your GUI? (maybe
> you could even skip the gui...)
> (see ?Rscript (unix alike) or Windows FAQ, 2.12)
> 
> --
> Regards,
> Hans-Peter
>



------------------------------

Message: 42
Date: Mon, 4 May 2009 18:46:02 +0000
From: Steve Murray <smurray444 at hotmail.com>
Subject: [R] Producing a legend successfullly
To: <r-help at r-project.org>
Message-ID: <BAY135-W52956038D9CADBC80794C888680 at phx.gbl>
Content-Type: text/plain; charset="Windows-1252"


Dear all,

I'm attempting to insert a legend into a line graph. I've sorted out the positioning, but I'm unable to display the sample line and associated colour to go within the legend box. Instead, under the variable names, the numbers 1, 2, 2, 3 are displayed in a column (with '2' repeated twice). This is the code I'm using:

legend(80,1150, c("Simulation", "Observation", lty=1:2, col=2:3)

How do I go about displaying a red solid line next to 'Simulation' and a green dashed line next to 'Observation' (and if necessary, remove the numbers that are currently displayed)?

Many thanks for any help offered,

Steve



------------------------------

Message: 43
Date: Mon, 4 May 2009 14:47:06 -0400
From: David Winsemius <dwinsemius at comcast.net>
Subject: Re: [R] Code of the max() function
To: Paul Smith <phhs80 at gmail.com>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID: <2E916F0B-EF3D-4792-9D7B-1F643E578E16 at comcast.net>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


On May 4, 2009, at 2:06 PM, Paul Smith wrote:

> Dear All,
>
> Where can one find the code of the max() function? Is that written  
> in C?

pages 43-54 of:

http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf

... is an article by Uwe Ligges on accesssing source code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



------------------------------

Message: 44
Date: Mon, 4 May 2009 13:45:00 -0500
From: Arne Henningsen <arne.henningsen at googlemail.com>
Subject: [R] [R-pkgs] frontier 0.99 is NOT backward compatible
To: r-packages at r-project.org
Message-ID: <200905042045.00741.arne.henningsen at googlemail.com>
Content-Type: text/plain; charset="us-ascii"

Dear current (and future) users of the "frontier" package,

We are approaching the first stable version (1.0) of the frontier package,
which provides tools for microeconomic Stochastic Frontier Analysis (SFA).
I have uploaded a kind of beta release (version 0.99) of this package to CRAN. 
The most important differences to version 0.9 affect the user interface. I
have modified the package so that it is (hopefully) simpler to use and the
functions are more similar to other R functions. Unfortunately, these changes 
make the new version NOT backward compatible. The most significant changes are 
reported below. A full ChangeLog is available in the log messages of the SVN 
repository on R-Forge [1]. Feedback about this package is highly appreciated. 
Please report any bugs, suggestions, feature requests, comments, and questions 
in the forums and trackers on R-Forge [1].

[1] http://r-forge.r-project.org/projects/frontier/

Best regards,
Arne


CHANGES IN VERSION 0.99-0

* corrected and considerably improved documentation of function "fontier"

* changed order of arguments of function "frontier"

* removed arguments "crossSectionName" and "timePeriodName" from function
"frontier": in case of cross-section data, these variables (information) are
not needed, and in case of panel data, the information on the panel structure
has to be added to the data set by the function "plm.data" of the "plm" 
package

* argument "modelType" of function "frontier" must be "ECF" or "EEF" now

* replaced argument "funtionType" of function "frontier"
by argument "ineffDecrease"

* renamed argument "eta" of function "frontier" as "timeEffect"

* split argument "mu" of function "frontier" into "truncNorm"
and "zIntercept"

* increased default value of argument "maxit" of function "frontier" to 1000

* renamed argument "step1" of function "frontier" as "searchStep"

* renamed argument "tol2" of function "frontier" as "searchTol"

* replaced argument "indic" of function "frontier" by "searchScale"

* renamed argument "gridno" of function "frontier" as "gridSize"

* renamed argument "igrid2" of function "frontier" as "gridDouble"

* renamed argument "iprint" of function "frontier" as "printIter"

* removed arguments "qxNames" and "quadHalf" from function "frontier",
because quadratic or translog frontiers can be estimated with function
"frontierQuad" now

* added "logLik" method for objects of class "frontier"

* added function "frontierQuad" for estimating quadratic and translog 
frontiers

* added function "frontierTranslogRay" for estimating stochastic ray
translog frontier functions

* added the generic function "efficiencies" and corresponding methods
for default objects and objects of class "frontier"

* added "elas" method for objects of class "frontierQuad"

* function frontier() and frontierQuad() return the (matched) call now

* the matrix of efficiency estimates returned by "frontier" has row names
(cross section units) and possibly column names (time period) now


-- 
Arne Henningsen
http://www.arne-henningsen.name/

_______________________________________________
R-packages mailing list
R-packages at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages



------------------------------

Message: 45
Date: Mon, 04 May 2009 12:43:42 -0600
From: "Francisco J. Zagmutt" <gerifalte28 at hotmail.com>
Subject: Re: [R] Surface for R outside of R
To: Hans-Peter Suter <gchappi at gmail.com>
Cc: r-help at r-project.org, koj <jens.koch at gmx.li>
Message-ID: <49FF375E.7020904 at hotmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi Koj,

I just completed a Windows application using the batch approach and it 
works very well.  In our case, we used VBA for Excel to call different 
batch files that execute R code, but you can do the same from any 
platform.  Here is a simple step-by-step example on how to make the 
batch files work (in Windows):


1. Write your R code and save it the directory where you want your 
results.  Here is a very simple example using a file called "normal.r". 
This code takes 100 random samples from a standard normal and writes the 
results to a file called "data.txt"

write(rnorm(100),"data.txt")
q(save="no", runLast = F)


2. Make sure that the console finds the path to R without changing your 
path environment variable.  The easiest way to do this is to download 
the batchfiles that Gabor Grothendieck has kindly provided in this site 
http://code.google.com/p/batchfiles/ and put one or all of the files in 
the same directory where your batch and R files will reside.  The only 
file I have needed so far in different WinXP and Vista machines was 
"Rcmd.bat" but you may need to use others.


3. Open a text editor and create a file with a .bat or .cmd extension. 
Here is an example of a file called "TestBatch.CMD" that runs the code 
in "normal.r"

@ECHO OFF
title Random number generation
ECHO Taking 100 random samples from a N(0,1)
Rcmd BATCH --slave normal.r Log.txt
ECHO Analysis done. See the file data.txt for results
PING 1.1.1.1 -n 1 -w 1000 >NUL
@ECHO OFF

The main line here is "Rcmd BATCH --slave normal.r Log.txt" which tells 
the console to run your R code, and to write outputs printed in the 
console (i.e. errors) to the Log.txt file. The PING argument adds a 
short lag before the console closes, so the user can see what is echoed 
in the console. The other lines should be pretty self-explanatory.

4. Execute the "TestBatch.CMD" file (by hand or via your GUI) and watch 
the results.  You should now see two new files ("data.txt" and 
"Log.txt") in the same directory as the batch file.


I hope this helps. Let me know if you have any other questions.

Regards,

Francisco

Francisco J. Zagmutt
Vose Consulting
2891 20th Street
Boulder, CO, 80304
USA
www.voseconsulting.com


Hans-Peter Suter wrote:
>> want an analysis. The best case were a surface of e.g. 8 Buttons, each click
>> leads to start a specific R file. My outputs are JPEG or CSV, so I don`t
>> need the output inside of R. Could anyone can give me some recommendations,
>> what could be a solution (e. g. Java)? Is such a solution possible?
> 
>  What about batch scripts which would be called by your GUI? (maybe
> you could even skip the gui...)
> (see ?Rscript (unix alike) or Windows FAQ, 2.12)
> 
> --
> Regards,
> Hans-Peter
>



------------------------------

Message: 46
Date: Mon, 4 May 2009 13:51:08 -0500
From: William Revelle <lists at revelle.net>
Subject: Re: [R] Hierarchical Diagram of Networks in sna or otherwise?
To: jebyrnes <byrnes at msi.ucsb.edu>, r-help at r-project.org
Message-ID: <p06240824c624e92abcc5@[192.168.1.5]>
Content-Type: text/plain; charset="iso-8859-1" ; format="flowed"

Jarrett,

At 11:31 AM -0700 5/4/09, jebyrnes wrote:
>Nearly.  The algorithm turns up slightly different graphs each time (and
>set.seed doesn't seem to make it consistent) and periodically chokes.  But
>better than what I had.  Hrm.  I don't know much about the algorithm
>graphviz uses for dot.  Do you have a reference on hand?  If it's simple,
>I'd be willing to take a whack at it.
>
>
>G?bor Cs?rdi-2 wrote:
>>
>>  Jarrett,
>>
>>  the 'igraph' package has a layout called layout.reingold.tilford that
>>  is designed for trees, there is a slight chance that it is good enough
>>  for you.
>>
>>  Best,
>>  Gabor
>>
>>  On Wed, Apr 29, 2009 at 10:11 PM, jebyrnes <byrnes at msi.ucsb.edu> wrote:
>>>
>>>  I've been using sna to work with some networks, and am trying to
>>>  visualize
>>>  them easily.  My networks are hierarchical (food webs).  All of the
>>>  layout
>>>  engines I've tried with gplot don't seem to plot hierarchical networks,
>>>  as
>>>  one would using dot from graphviz.  While I could do all of this by
>>>  outputting to dotfiles and running it through graphviz, the graphics I
>>>  get
>>>  from R are much cleaner, and more easily integrated into my analyses.
>>>
>>>  Is there any good way to diagram a hierarchical network in R, either with
>>>  the sna library or otherwise?  It strikes me that at least the Netindices
>>>  package can calculate trophic levels.  Could this be used for node
>>>  placement?
>>>
>>>
>  >> -Jarrett
>  >>


If you like the dot output from graphviz you can 
get that using Rgraphviz from bioconductor. 
Although somewhat difficult to install, once 
installed it works beautifully.

Bill



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



------------------------------

Message: 47
Date: Mon, 04 May 2009 15:55:11 -0300
From: tyler <tyler.smith at mail.mcgill.ca>
Subject: [R] ellipsis problem
To: r-help at stat.math.ethz.ch
Message-ID: <874ow0aeb4.fsf at blackbart.sedgenet>
Content-Type: text/plain; charset=us-ascii

Hi,

I'm confused about the use of ellipsis in function arguments. I'm trying
to write a wrapper for plot to automate the combination of plot() and
points() calls for a data.frame. Some arguments seem to get passed
through to the inner plot, while others cause an error:

 Error in eval(expr, envir, enclos) : 
  ..1 used in an incorrect context, no ... to look in

As a minimal example:

tmp <- data.frame(Y = sample(1:10, 40, replace = TRUE),
                  X = sample(1:10, 40, replace = TRUE))

myplot <- function(x, ...) {
  plot(Y ~ X, data = x, ...)
}

myplot(tmp) ## works fine
myplot(tmp, tcl = 1) ## works fine

myplot(tmp, tcl = -0.1)
Error in eval(expr, envir, enclos) : 
  ..1 used in an incorrect context, no ... to look in

myplot(tmp, mgp = c(3, 0.5, 0))
Error in eval(expr, envir, enclos) : 
  ..1 used in an incorrect context, no ... to look in

plot(Y ~ X, data = tmp, mgp = c(3, 0.5, 0)) ## works
plot(Y ~ X, data = tmp, tcl = -0.1) ## works

What am I doing wrong?

Thanks,

Tyler

R version 2.8.1 (2008-12-22)
Debian Testing

-- 
What is wanted is not the will to believe, but the will to find out,
which is the exact opposite.           --Bertrand Russell



------------------------------

Message: 48
Date: Mon, 4 May 2009 14:56:25 -0400
From: Gabor Grothendieck <ggrothendieck at gmail.com>
Subject: Re: [R] Surface for R outside of R
To: "Francisco J. Zagmutt" <gerifalte28 at hotmail.com>
Cc: r-help at r-project.org, r-help at stat.math.ethz.ch, koj
	<jens.koch at gmx.li>
Message-ID:
	<971536df0905041156p3e4c6ed8r1ef8f91b53c87ce6 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Also see Rscript.bat in the same batchfiles distribution.  It
automatically finds Rscript.exe by looking in the registry
in the same way that Rcmd.bat finds Rcmd.exe.

On Mon, May 4, 2009 at 2:43 PM, Francisco J. Zagmutt
<gerifalte28 at hotmail.com> wrote:
> Hi Koj,
>
> I just completed a Windows application using the batch approach and it works
> very well. ?In our case, we used VBA for Excel to call different batch files
> that execute R code, but you can do the same from any platform. ?Here is a
> simple step-by-step example on how to make the batch files work (in
> Windows):
>
>
> 1. Write your R code and save it the directory where you want your results.
> ?Here is a very simple example using a file called "normal.r". This code
> takes 100 random samples from a standard normal and writes the results to a
> file called "data.txt"
>
> write(rnorm(100),"data.txt")
> q(save="no", runLast = F)
>
>
> 2. Make sure that the console finds the path to R without changing your path
> environment variable. ?The easiest way to do this is to download the
> batchfiles that Gabor Grothendieck has kindly provided in this site
> http://code.google.com/p/batchfiles/ and put one or all of the files in the
> same directory where your batch and R files will reside. ?The only file I
> have needed so far in different WinXP and Vista machines was "Rcmd.bat" but
> you may need to use others.
>
>
> 3. Open a text editor and create a file with a .bat or .cmd extension. Here
> is an example of a file called "TestBatch.CMD" that runs the code in
> "normal.r"
>
> @ECHO OFF
> title Random number generation
> ECHO Taking 100 random samples from a N(0,1)
> Rcmd BATCH --slave normal.r Log.txt
> ECHO Analysis done. See the file data.txt for results
> PING 1.1.1.1 -n 1 -w 1000 >NUL
> @ECHO OFF
>
> The main line here is "Rcmd BATCH --slave normal.r Log.txt" which tells the
> console to run your R code, and to write outputs printed in the console
> (i.e. errors) to the Log.txt file. The PING argument adds a short lag before
> the console closes, so the user can see what is echoed in the console. The
> other lines should be pretty self-explanatory.
>
> 4. Execute the "TestBatch.CMD" file (by hand or via your GUI) and watch the
> results. ?You should now see two new files ("data.txt" and "Log.txt") in the
> same directory as the batch file.
>
>
> I hope this helps. Let me know if you have any other questions.
>
> Regards,
>
> Francisco
>
> Francisco J. Zagmutt
> Vose Consulting
> 2891 20th Street
> Boulder, CO, 80304
> USA
> www.voseconsulting.com
>
>
> Hans-Peter Suter wrote:
>>>
>>> want an analysis. The best case were a surface of e.g. 8 Buttons, each
>>> click
>>> leads to start a specific R file. My outputs are JPEG or CSV, so I don`t
>>> need the output inside of R. Could anyone can give me some
>>> recommendations,
>>> what could be a solution (e. g. Java)? Is such a solution possible?
>>
>> ?What about batch scripts which would be called by your GUI? (maybe
>> you could even skip the gui...)
>> (see ?Rscript (unix alike) or Windows FAQ, 2.12)
>>
>> --
>> Regards,
>> Hans-Peter
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 49
Date: Mon, 4 May 2009 14:56:25 -0400
From: Gabor Grothendieck <ggrothendieck at gmail.com>
Subject: Re: [R] Surface for R outside of R
To: "Francisco J. Zagmutt" <gerifalte28 at hotmail.com>
Cc: r-help at r-project.org, r-help at stat.math.ethz.ch, koj
	<jens.koch at gmx.li>
Message-ID:
	<971536df0905041156p3e4c6ed8r1ef8f91b53c87ce6 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Also see Rscript.bat in the same batchfiles distribution.  It
automatically finds Rscript.exe by looking in the registry
in the same way that Rcmd.bat finds Rcmd.exe.

On Mon, May 4, 2009 at 2:43 PM, Francisco J. Zagmutt
<gerifalte28 at hotmail.com> wrote:
> Hi Koj,
>
> I just completed a Windows application using the batch approach and it works
> very well. ?In our case, we used VBA for Excel to call different batch files
> that execute R code, but you can do the same from any platform. ?Here is a
> simple step-by-step example on how to make the batch files work (in
> Windows):
>
>
> 1. Write your R code and save it the directory where you want your results.
> ?Here is a very simple example using a file called "normal.r". This code
> takes 100 random samples from a standard normal and writes the results to a
> file called "data.txt"
>
> write(rnorm(100),"data.txt")
> q(save="no", runLast = F)
>
>
> 2. Make sure that the console finds the path to R without changing your path
> environment variable. ?The easiest way to do this is to download the
> batchfiles that Gabor Grothendieck has kindly provided in this site
> http://code.google.com/p/batchfiles/ and put one or all of the files in the
> same directory where your batch and R files will reside. ?The only file I
> have needed so far in different WinXP and Vista machines was "Rcmd.bat" but
> you may need to use others.
>
>
> 3. Open a text editor and create a file with a .bat or .cmd extension. Here
> is an example of a file called "TestBatch.CMD" that runs the code in
> "normal.r"
>
> @ECHO OFF
> title Random number generation
> ECHO Taking 100 random samples from a N(0,1)
> Rcmd BATCH --slave normal.r Log.txt
> ECHO Analysis done. See the file data.txt for results
> PING 1.1.1.1 -n 1 -w 1000 >NUL
> @ECHO OFF
>
> The main line here is "Rcmd BATCH --slave normal.r Log.txt" which tells the
> console to run your R code, and to write outputs printed in the console
> (i.e. errors) to the Log.txt file. The PING argument adds a short lag before
> the console closes, so the user can see what is echoed in the console. The
> other lines should be pretty self-explanatory.
>
> 4. Execute the "TestBatch.CMD" file (by hand or via your GUI) and watch the
> results. ?You should now see two new files ("data.txt" and "Log.txt") in the
> same directory as the batch file.
>
>
> I hope this helps. Let me know if you have any other questions.
>
> Regards,
>
> Francisco
>
> Francisco J. Zagmutt
> Vose Consulting
> 2891 20th Street
> Boulder, CO, 80304
> USA
> www.voseconsulting.com
>
>
> Hans-Peter Suter wrote:
>>>
>>> want an analysis. The best case were a surface of e.g. 8 Buttons, each
>>> click
>>> leads to start a specific R file. My outputs are JPEG or CSV, so I don`t
>>> need the output inside of R. Could anyone can give me some
>>> recommendations,
>>> what could be a solution (e. g. Java)? Is such a solution possible?
>>
>> ?What about batch scripts which would be called by your GUI? (maybe
>> you could even skip the gui...)
>> (see ?Rscript (unix alike) or Windows FAQ, 2.12)
>>
>> --
>> Regards,
>> Hans-Peter
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



------------------------------

Message: 50
Date: Mon, 4 May 2009 15:02:21 -0400 (EDT)
From: Peter Flom <peterflomconsulting at mindspring.com>
Subject: Re: [R] Producing a legend successfullly
To: Steve Murray <smurray444 at hotmail.com>, r-help at r-project.org
Message-ID:
	<6161763.1241463741791.JavaMail.root at mswamui-blood.atl.sa.earthlink.net>
	
Content-Type: text/plain; charset=UTF-8

Steve Murray <smurray444 at hotmail.com> wrote
>
>I'm attempting to insert a legend into a line graph. I've sorted out the positioning, but I'm unable to display the sample line and associated colour to go within the legend box. Instead, under the variable names, the numbers 1, 2, 2, 3 are displayed in a column (with '2' repeated twice). This is the code I'm using:
>
>legend(80,1150, c("Simulation", "Observation", lty=1:2, col=2:3)
>

You've got mismatched parentheses here, with two ( and only one ).

I suspect you added one at the end, making r look at lty= and col = as part of the legend text.

You want

legend(80,1150, c("Simulation", "Observation"), lty=1:2, col=2:3)

HTH

Peter

Peter L. Flom, PhD
Statistical Consultant
www DOT peterflomconsulting DOT com



------------------------------

Message: 51
Date: Mon, 4 May 2009 15:03:15 -0400
From: Sarah Goslee <sarah.goslee at gmail.com>
Subject: Re: [R] Producing a legend successfullly
To: Steve Murray <smurray444 at hotmail.com>
Cc: r-help at r-project.org
Message-ID:
	<efb536d50905041203i19359963r4cb50c5f58bc2bd8 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

This works for me:
> plot(1:10, 1:10)
> legend("topleft", c("Simulation", "Observation"), lty=1:2, col=2:3)

Try that; if it does work, then we need more information about
exactly what you're doing, because there's a problem not contained
in just that single line of code (which has a problem of its own!).

Sarah

On Mon, May 4, 2009 at 2:46 PM, Steve Murray <smurray444 at hotmail.com> wrote:
>
> Dear all,
>
> I'm attempting to insert a legend into a line graph. I've sorted out the positioning, but I'm unable to display the sample line and associated colour to go within the legend box. Instead, under the variable names, the numbers 1, 2, 2, 3 are displayed in a column (with '2' repeated twice). This is the code I'm using:
>
> legend(80,1150, c("Simulation", "Observation", lty=1:2, col=2:3)
>
> How do I go about displaying a red solid line next to 'Simulation' and a green dashed line next to 'Observation' (and if necessary, remove the numbers that are currently displayed)?
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



------------------------------

Message: 52
Date: Mon, 4 May 2009 15:03:32 -0400
From: Jorge Ivan Velez <jorgeivanvelez at gmail.com>
Subject: Re: [R] Producing a legend successfullly
To: Steve Murray <smurray444 at hotmail.com>
Cc: r-help at r-project.org
Message-ID:
	<317737de0905041203wc0d7c00if8217e88c960e3dd at mail.gmail.com>
Content-Type: text/plain

Dear Steve,
Try this:
x<-rnorm(100)
y<-rnorm(100) + 2*x
plot(x,y)
legend('topleft', c("Simulation", "Observation"), lty=1:2, col=2:3)
abline(x,y,col=3,lty=2)

(you forgot a ")" in your code :( )

HTH,

Jorge


On Mon, May 4, 2009 at 2:46 PM, Steve Murray <smurray444 at hotmail.com> wrote:

>
> Dear all,
>
> I'm attempting to insert a legend into a line graph. I've sorted out the
> positioning, but I'm unable to display the sample line and associated colour
> to go within the legend box. Instead, under the variable names, the numbers
> 1, 2, 2, 3 are displayed in a column (with '2' repeated twice). This is the
> code I'm using:
>
> legend(80,1150, c("Simulation", "Observation", lty=1:2, col=2:3)
>
> How do I go about displaying a red solid line next to 'Simulation' and a
> green dashed line next to 'Observation' (and if necessary, remove the
> numbers that are currently displayed)?
>
> Many thanks for any help offered,
>
> Steve
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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]]



------------------------------

Message: 53
Date: Mon, 4 May 2009 12:04:21 -0700
From: p

[Message truncated]




More information about the R-help mailing list