[R] For sending my R package as part of R-project

Lio, Yuhlong Yuhlong.Lio at usd.edu
Fri Sep 11 17:40:36 CEST 2009


To Whom It May Concern:

I have an R package and want to put this package be part of R-project and available to anyone who is interested in.

The R package is created for my paper, titled "Acceptance Sampling Plans from Truncated Life Tests Based on the Birnbaum-Saunders Distribution for Percentiles".  The paper has been accepted by Communications in Statistics: Simulation and Computation.

The reviewers and editor suggest the R package for the sampling plans of the paper be part of R-project.

Please let me know what I should do to make the R package available for R-project group.

Thanks,
Yuhlong Lio
Professor
Department of Mathematical Sciences
University of South Dakota
Vermillion, SD 57069
USA


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of r-help-request at r-project.org
Sent: Friday, September 11, 2009 5:00 AM
To: r-help at r-project.org
Subject: R-help Digest, Vol 79, Issue 11

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. Plot area reduction (rajesh j)
   2. Re: Joining Characters in R {issue with paste} (Michael Dewey)
   3. Re: Color index in image function (Bernardo Rangel Tura)
   4. Re: Help on percentage of random numbers for different
      classes (KABELI MEFANE)
   5. Re: Order of multiple plots (Henrique Dallazuanna)
   6. Re: Plot area reduction (Jim Lemon)
   7. Build a connectivity between .NET and R without using any
      interface (Amitava1 M)
   8. Order a vector and move to new vector (Conrad Addo)
   9. Re: lag a data.frame column? (Angel Spassov)
  10. Issue displaying DATES on a plot with two ordinates
      (clair.crossupton at googlemail.com)
  11. Insall package (wesley mathew)
  12. Re: Build a connectivity between .NET and R without using any
      interface (Duncan Murdoch)
  13. Re: Insall package (Duncan Murdoch)
  14. Re: Xyplot, multi line title via main, all lines left
      justified (Deepayan Sarkar)
  15. Re: Build a connectivity between .NET and R without using any
      interface (Gabor Grothendieck)
  16. executing rscript from VB (H Rao)
  17.  tranform a table? (bbimber)
  18. Listing all data instead of only k-elements when using
      combn-function (Sarah Moens)
  19. Negative AIC (Corrado)
  20. Intercept=0 in gam from  gam package (Corrado)
  21. Re: Order of multiple plots (S Ellison)
  22. [R-pkgs] new version of R-package mice (mgko at planet.nl)
  23. Re: Intercept=0 in gam from  gam package (Gavin Simpson)
  24. Running R in Windows server (srpd TCLTK)
  25. Re: executing rscript from VB (Duncan Murdoch)
  26. fit arima long period alternatives (Matteo Bertini)
  27. Re: lean text label below barplot table (Sunil Suchindran)
  28. Re: Running R in Windows server (Uwe Ligges)
  29. Re: Running R in Windows server (Barry Rowlingson)
  30. Re: Negative AIC (Ben Bolker)
  31. Re: tranform a table? (Don MacQueen)
  32. Re: Negative AIC (Corrado)
  33. Merge data frames but prefer values in one (JiHO)
  34. Re: Insall package (Cedrick Johnson)
  35. Re: Negative AIC (Ben Bolker)
  36. Re: Negative AIC (Murilo Doi)
  37. Re: How to do rotation for polygon? (William Dunlap)
  38. Re: Negative AIC (John C Frain)
  39. Re: tranform a table? (David Hajage)
  40. Re: Merge data frames but prefer values in one
      (Henrique Dallazuanna)
  41. Re: Negative AIC (Corrado)
  42. AIC and goodness of prediction - was: Re: goodness of
      "prediction" using a model (lm, glm, gam, brt,  (Corrado)
  43. Re: Order of multiple plots (Nandi)
  44.  index of min elements in matrix (annie Zhang)
  45. Re: index of min elements in matrix (Henrique Dallazuanna)
  46. Re: index of min elements in matrix (Marc Schwartz)
  47. Re: index of min elements in matrix (annie Zhang)
  48. Re: Order a vector and move to new vector (Nandi)
  49. function to solve equations (Yash Gandhi)
  50. Re: ggplot2: mixing colour and linetype in geom_line
      (Matthieu Dubois)
  51. Re: function to solve equations (Ravi Varadhan)
  52. R 2.9.2 memory max - object vector size (S. Few)
  53. Linux R version: best? (S. Few)
  54. Re: Linux R version: best? (Steve Lianoglou)
  55. Re: Linux R version: best? (Marc Schwartz)
  56. numerical integration (Roslina Zakaria)
  57. Re: numerical integration (Bert Gunter)
  58. Complex binning? (Mark Knecht)
  59. Re: "Read.csv" in R with dynamic file (1st) argument
      (Carl Witthoft)
  60.  sppolot: fill below minimum legend value (emorway)
  61. Re: Complex binning? (Bert Gunter)
  62. Re: R 2.9.2 memory max - object vector size (William Dunlap)
  63. Re: "Read.csv" in R with dynamic file (1st) argument (Steven Kang)
  64. Re: Complex binning? (Mark Knecht)
  65. memory limit problem (oleg portnoy)
  66. Re: memory limit problem (Steve Lianoglou)
  67.  Bootstrap simulation (MarcioRibeiro)
  68.  Exporting the formula for a LOESS fit (jrflanders)
  69. Re: Exporting the formula for a LOESS fit (Peter Alspach)
  70. Re: "Read.csv" in R with dynamic file (1st) argument
      (Don MacQueen)
  71. fitting stated preference econometric data using multinomial
      logit in R (Richard Anderson)
  72. Re: eps file with embedded font (Paul Murrell)
  73. Re: Best R text editors? (Johannes Huesing)
  74. Accumulating results from "for" loop in a list/array (Steven Kang)
  75. problem formula (newbe) (Robert U)
  76. Re: Merge data frames but prefer values in one (jo)
  77. Re: Accumulating results from "for" loop in a list/array
      (Schalk Heunis)
  78.  Is there any "month" object like "LETTERS" ? (megh)
  79. Re: Best R text editors? (Patrick Connolly)
  80. Constructing variables conditional on two indicators
      (Reynaerts, Jo)
  81. Re: Constructing variables conditional on two indicators
      (Dimitris Rizopoulos)
  82. Re: Linux R version: best? (Patrick Connolly)
  83. Re: executing rscript from VB (bartjoosen)
  84. how to do this? (Luca Braglia)
  85. Re: sppolot: fill below minimum legend value (Paul Hiemstra)
  86. ipred (MERAL YAY)
  87. call Fortran  from R (Giacomo Santini)
  88. (no subject) (MERAL YAY)
  89. How to compare the result of GLM and GAM (Dilli Prasad Rijal)
  90. R - box design-scatter plot f?r means/regression/lme?
      (Karrer  Stefanie)
  91. Re: call Fortran  from R (Duncan Murdoch)
  92. R:  how to do this? (Luca Braglia)
  93. Re: how to do this? (Linlin Yan)
  94. Re: call Fortran  from R (Giacomo Santini)
  95. Multilevel models with sampling weights at both levels
      (David Kaplan)
  96. R:  how to do this? (Luca Braglia)
  97. Re: Is there any "month" object like "LETTERS" ?
      (Barry Rowlingson)


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

Message: 1
Date: Thu, 10 Sep 2009 15:40:06 +0530
From: rajesh j <akshay.rajesh at gmail.com>
Subject: [R] Plot area reduction
To: r-help at r-project.org
Message-ID:
        <37b9f3470909100310u57e4c15cl8dbfb640bf95afa9 at mail.gmail.com>
Content-Type: text/plain

Hi,

I need my plot to occupy a thin strip-like area but the plot area in R is a
square so when I save it and reduce its height to a strip in my document the
font in the graph looks flattened. Is there someway i can do this in R
itself?..so that my plot is a strip but the font looks normal

--
Rajesh.J

        [[alternative HTML version deleted]]



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

Message: 2
Date: Thu, 10 Sep 2009 11:23:51 +0100
From: Michael Dewey <info at aghmed.fsnet.co.uk>
Subject: Re: [R] Joining Characters in R {issue with paste}
To: Abhishek Pratap <abhishek.vit at gmail.com>
Cc: r-help at r-project.org
Message-ID: <Zen-1Mlgov-0007sK-5f at smarthost02.mail.zen.net.uk>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 22:13 09/09/2009, Abhishek Pratap wrote:
>I did try ?paste and paste(a,b,separator=""). same result

Your second example pastes three strings together. "a" "b" and " ",
the third of which you have named separator which is not the same as sep.

>Thanks,
>-Abhi
>
>On Wed, Sep 9, 2009 at 5:11 PM, milton ruser <milton.ruser at gmail.com> wrote:
>
> > You not tryed ?paste  :-)
> >
> > paste(a,b,sep="")
> >
> > bests
> >
> > milton
> >
> > On Wed, Sep 9, 2009 at 5:08 PM, Abhishek Pratap
> <abhishek.vit at gmail.com>wrote:
> >
> >> Hi Guys
> >> I am want to join to strings in R. I am using paste but not getting
> >> desirable result.
> >>
> >> For the sake of clarity, a quick example:
> >>
> >> > a="Bio"
> >> > b="iology"
> >> > paste(a,b)
> >> [1] "Bio iology"
> >>
> >>
> >> *There is a SPACE in the word biology which is what I dont want *
> >>
> >>
> >> Thanks,
> >> -Abhi
> >>
> >>        [[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<http://www.r-project.org/posting-guide.html>
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
>
>         [[alternative HTML version deleted]]

Michael Dewey
http://www.aghmed.fsnet.co.uk



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

Message: 3
Date: Thu, 10 Sep 2009 07:47:32 -0300
From: Bernardo Rangel Tura <tura at centroin.com.br>
Subject: Re: [R] Color index in image function
To: FMH <kagba2006 at yahoo.com>, r-help <r-help at stat.math.ethz.ch>
Message-ID: <1252579652.20202.2.camel at R1-Thux>
Content-Type: text/plain

On Wed, 2009-09-09 at 02:33 -0700, FMH wrote:
> Thank you for the hints, but how could i add the grid lines which have numbers, representing the height of the volcano on the image.
>
> Thank you
>

So I think this script  is what you need


Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue"))
require(fileds)
image.plot(volcano, col = Brazilan.Pallete(50), axes = FALSE)
contour(volcano, levels = seq(90, 200, by = 5), add = TRUE)

--
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil


>
>
> ----- Original Message ----
> From: Bernardo Rangel Tura <tura at centroin.com.br>
> To: FMH <kagba2006 at yahoo.com>
> Sent: Tuesday, September 8, 2009 10:14:07 AM
> Subject: Re: [R] Color index in image function
>
> On Mon, 2009-09-07 at 07:59 -0700, FMH wrote:
> > Thank you for the tips. I have manage to run your script, but  was still never get the way to include the color index beside the image which could explain the intensity of the color from the lower index(green) to the higher index(blue). This color index might be represented by  an increasing of color index in another table beside the image, started from green followed by green-yellow, yellow, yellow-blue and blue?
> >
> > Could someone please advice on this matter?
> >
> > Cheers
> > Fir
> >
>
> Hi FHM,
>
> Well If you desire one color index in a imageplot  I don't know solve
> your problem.
>
> But in your scirptyou use image and
>
> image(x, y, volcano, col = terrain.colors(100), axes = FALSE)
> contour(x, y, volcano, levels = seq(90, 200, by = 5),
>         add = TRUE, col = "peru")
>
> In this case I suggest you use
>
> Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue"))
> filled.contour(volcano, color = Brazilan.Pallete)

--
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil



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

Message: 4
Date: Thu, 10 Sep 2009 11:29:58 +0000 (GMT)
From: KABELI MEFANE <kabelimefane at yahoo.co.uk>
Subject: Re: [R] Help on percentage of random numbers for different
        classes
To: Robert Baer <rbaer at atsu.edu>
Cc: R-help at r-project.org
Message-ID: <273246.86775.qm at web27803.mail.ukl.yahoo.com>
Content-Type: text/plain

Dear Robert
?
Thank you very much for all the help, now i am enjoying working with all of you as you make R look simple and interesting.

--- On Thu, 10/9/09, Robert Baer <rbaer at atsu.edu> wrote:


From: Robert Baer <rbaer at atsu.edu>
Subject: Re: [R] Help on percentage of random numbers for different classes

Date: Thursday, 10 September, 2009, 8:46 AM


> I am sorry for asking this stupid question, but i have been running in circles. I want to randomly generate a scaling point of between 1 and 10, for say hundred entries, where the first 10% percent is has rates between 2 and 7, the next 15% 3 and 7, 20% between 3 and 9, 20% between 3 and? 10, 35% between 5 and 10. The problem is that i can only generate the usual 100 using runif function

Something like this might work for you:
# set total sample size to greater than or equal to 100
# and mod 0 wrt 100 to preserve the percentages
# here say 200
ss=200

# Create a vector with the desired properties
vector=c(
sample(2:7,ss/10,replace=TRUE),
sample(3:7,ss/15,replace=TRUE),
sample(3:9,ss/20,replace=TRUE),
sample(3:10,ss/20,replace=TRUE),
sample(5:10,ss/10,replace=TRUE))

# print out the vector
vector



>
>? > y<-c(ceiling(10*runif(100)))
>> y
>???[1] 10? 8? 5? 2? 4? 1? 6? 7? 1? 6? 8? 8? 8? 9? 7? 7? 8? 8? 2? 7? 3 10? 1 7? 1
>? [26] 10? 4? 8? 8? 8? 9? 3? 7? 8? 4? 6? 7? 2? 3? 1? 9? 8? 2? 6? 7? 4? 8? 8 9? 7
>? [51]? 6? 5? 4? 1? 8? 7? 9? 8 10? 5? 3? 7? 5? 5? 4? 4? 7? 4 10? 4? 9? 1? 5 10 10
>? [76]? 5? 5 10? 7? 3? 4? 4? 9 10? 6? 2? 6? 6? 6? 3? 8? 2? 2? 4? 4 10? 6? 9 4? 3
>
> I just want to try to avoid small numbers as much as possible. I am open to suggestions, please please please.
>
> Kabeli
>
>
>
> [[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.
>




        [[alternative HTML version deleted]]



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

Message: 5
Date: Thu, 10 Sep 2009 08:33:51 -0300
From: Henrique Dallazuanna <wwwhsd at gmail.com>
Subject: Re: [R] Order of multiple plots
To: legen <legendy at gmail.com>
Cc: r-help at r-project.org
Message-ID:
        <da79af330909100433n54fb91abi21ad353117c02eed at mail.gmail.com>
Content-Type: text/plain

I think you can try this:

par(mfrow=c(1,2))
plot(1, type = 'n', axes = FALSE, xlab = '', ylab = '')
plot(1, type = 'n', axes = FALSE, xlab = '', ylab = '')
par(mfg = c(1, 2))
plot(rnorm(10))


On Thu, Sep 10, 2009 at 1:49 AM, legen <legendy at gmail.com> wrote:

>
> Hello all,
>
> I have a problem and need your help.
> I am going to draw two plots in one row and two columns by using
> ?par(mfrow=c(1,2))?, but I want to first draw the right plot and then draw
> the left plot. Does anybody can show me how to do it please? Thanks in
> advance.
>
> Legen
>
> --
> View this message in context:
> http://www.nabble.com/Order-of-multiple-plots-tp25377235p25377235.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.
>



--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O

        [[alternative HTML version deleted]]



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

Message: 6
Date: Thu, 10 Sep 2009 21:45:04 +1000
From: Jim Lemon <jim at bitwrit.com.au>
Subject: Re: [R] Plot area reduction
To: rajesh j <akshay.rajesh at gmail.com>
Cc: r-help at r-project.org
Message-ID: <4AA8E6C0.6080103 at bitwrit.com.au>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 09/10/2009 08:10 PM, rajesh j wrote:
> Hi,
>
> I need my plot to occupy a thin strip-like area but the plot area in R is a
> square so when I save it and reduce its height to a strip in my document the
> font in the graph looks flattened. Is there someway i can do this in R
> itself?..so that my plot is a strip but the font looks normal
>
>
Hi Rajesh,
Just start the device with the aspect you want:

x11(height=2)

OR

png(myplot.png",height=150)

Jim



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

Message: 7
Date: Thu, 10 Sep 2009 18:10:34 +0530
From: Amitava1 M <amitava1.m at tcs.com>
Subject: [R] Build a connectivity between .NET and R without using any
        interface
To: r-help at r-project.org
Message-ID:
        <OF6380071D.C0F5F2A4-ON6525762D.00444643-6525762D.00459E68 at tcs.com>
Content-Type: text/plain

Dear All

I like to develop an application using .NET and R. The front end would be
.NET and statistical analysis would be done in R in the back end. So I
want to integrate .NET(VB) with R without using any interface (e.g., R
(D)com) to control. Secondly, I like to use Rscript (by calling .R files)
from VB .NET environment for the analysis. Finally, I want to display the
R-outputs including graphs on .NET controls (UI).

Please help me out. Thank you in advance.

Regards
Amitava
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you



        [[alternative HTML version deleted]]



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

Message: 8
Date: Thu, 10 Sep 2009 10:06:58 +0100
From: Conrad Addo <conrad.addo at gmail.com>
Subject: [R] Order a vector and move to new vector
To: r-help at r-project.org
Message-ID:
        <1341305a0909100206x4aca06d9h18355c3afd8b8b19 at mail.gmail.com>
Content-Type: text/plain

I currently have a data frame with a Fund ID and NAV value.  Is it possible
to order the data frame and move to separate columns in a new data frame or
matrix in R without using a for loop?  I suppose I'd like to use a built in
function to make it faster because I will have around 60,000 entries to sort
and my current program takes too long to do this.  I know how to use order,
but is there a way to separate the result and place into new vectors of a
matrix or data frame?

Thanks

Conrad

Here are my vectors which I import from a csv file:

 ID UNAV  #1694 999.89  #1696 999.9  #1694 999.87  #1696 999.88  #1694
999.84  #1696 999.86  #1694 999.82  #1696 999.84  #1694 999.79  #1696 999.82
#1694 999.71  #1696 999.75  #1694 999.69  #1696 999.73  #1694 999.66  #1696
999.71  #1694 999.64  #1696 999.69  #1694 999.61  #1696 999.67  #1694 999.54
#1696 999.7  #1694 999.51  #1696 1002.24  #1694 999.48  #1696 1012.14  #1694
999.46  #1696 1003.38  #1694 999.43

        [[alternative HTML version deleted]]



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

Message: 9
Date: Thu, 10 Sep 2009 14:28:28 +0200
From: Angel Spassov <anspassov at googlemail.com>
Subject: Re: [R] lag a data.frame column?
To: r-help at r-project.org
Message-ID: <4aa8f0ec.02225e0a.329a.3235 at mx.google.com>
Content-Type: text/plain; charset=us-ascii

Mark Knecht wrote (09.Sep.2009 at 10:43 -0700):
> Sometimes it's the simple things...
>
> Why doesn't this lag X$x by 3 and place it in X$x1? (i.e. - Na's in
> the first 3 rows and then values showing up...)
>
> The help page does talk about time series. If lag doesn't work on
> data.frame columns then what would be the right function to use to lag
> by a variable amount?
>
> Thanks,
> Mark
>
>
> X=data.frame(x=seq(1:10))
> X$x1=lag(X$x, 3)
> X
>

I think the embed function might be helpful for you,

embed(1:10 , dimension = 3)

Best,
AS



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

Message: 10
Date: Thu, 10 Sep 2009 03:44:14 -0700 (PDT)
From: "clair.crossupton at googlemail.com"
        <clair.crossupton at googlemail.com>
Subject: [R] Issue displaying DATES on a plot with two ordinates
To: r-help at r-project.org
Message-ID:
        <0de4b585-cc41-4798-b724-09a2e7d6d2c3 at h13g2000yqk.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

Dear all,

I am having an issue with displaying the dates on a plot with two
ordinates (i.e. two differently scaled y-axes). Instead of dates
appearing on the x-axis I am instead seeing a string of numbers
(14460, 14465, 14470 and 14475).

example R code:

library(plotrix)
x.Left <- as.Date(c('2009-08-04', '2009-08-08', '2009-08-11',
'2009-08-15', '2009-08-18'), format="%Y-%m-%d")
x.Right <- as.Date(c('2009-08-05', '2009-08-09', '2009-08-12',
'2009-08-16', '2009-08-19'), format="%Y-%m-%d")
y.Left <- c(70.13, 75.1, 74.35, 78.9, 80.92)
y.Right <- c(35, 45, 50, 47, 53)
twoord.plot(x.Left, y.Left, x.Right, y.Right, xlab="Date", ylab="Trend
1", rylab="Trend 2", lwd=2, lcol='blue')


Thanks in advance for any help,
C.C.

P.S. I am aware of the criticisms of these sort of graphs, but they
are pretty. Also, they seem to be used a lot in meetings i've attended
recently.


Windows Vista
> sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32

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

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

other attached packages:
[1] plotrix_2.7



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

Message: 11
Date: Thu, 10 Sep 2009 11:44:27 +0100
From: wesley mathew <wesleycmathew at gmail.com>
Subject: [R] Insall package
To: r-help at r-project.org
Message-ID: <7d3fa2530909100344o608b7g8024651d7e753ec5 at mail.gmail.com>
Content-Type: text/plain

Dear Sir

Subject: - *Install " rscproxy_1.3-1.tar.gz "*

 I am working in Windows system.  I was try  to install *rscproxy* package
in  two way.
 *1.* install.packages ("rscproxy_1.3-1.tar.gz"),  It shows the Warning:
unable to access index for repository
http://cran.pt.r-project.org/bin/windows/contrib/2.9
 *2. * install.packages("C:/Program Files/R/rscproxy_1.3-1.tar.gz", repos =
NULL) It also show warning ( Error in gzfile(file, "r") : cannot open the
connection In addition: Warning   messages: 1: In unzip(zipname, exdir =
dest) : error 1 in extracting from zip file 2: In gzfile(file, "r") :
cannot open compressed file 'rscproxy_1.3-1.tar.gz/DESCRIPTION', probable
reason 'No such file or directory'  )

 Could you please suggest, how to solve this problem,








--
Wesley C Mathew

        [[alternative HTML version deleted]]



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

Message: 12
Date: Thu, 10 Sep 2009 08:49:12 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] Build a connectivity between .NET and R without using
        any interface
To: Amitava1 M <amitava1.m at tcs.com>
Cc: r-help at r-project.org
Message-ID: <4AA8F5C8.3090000 at stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 9/10/2009 8:40 AM, Amitava1 M wrote:
> Dear All
>
> I like to develop an application using .NET and R. The front end would be
> .NET and statistical analysis would be done in R in the back end. So I
> want to integrate .NET(VB) with R without using any interface (e.g., R
> (D)com) to control. Secondly, I like to use Rscript (by calling .R files)
> from VB .NET environment for the analysis. Finally, I want to display the
> R-outputs including graphs on .NET controls (UI).
>
> Please help me out. Thank you in advance.

Those seem to be mostly questions about .NET  -- you may be better off
asking Microsoft.  R's interface is described in the Writing R
Extensions manual, assuming that a front-end would be written in C or
some similar language.  If you want to avoid the DCOM interface, you're
going to have to work out how to make .NET act the way described in that
manual.

Duncan Murdoch



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

Message: 13
Date: Thu, 10 Sep 2009 08:57:41 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] Insall package
To: wesley mathew <wesleycmathew at gmail.com>
Cc: r-help at r-project.org
Message-ID: <4AA8F7C5.3050507 at stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 9/10/2009 6:44 AM, wesley mathew wrote:
> Dear Sir
>
> Subject: - *Install " rscproxy_1.3-1.tar.gz "*
>
>  I am working in Windows system.  I was try  to install *rscproxy* package
> in  two way.
>  *1.* install.packages ("rscproxy_1.3-1.tar.gz"),  It shows the Warning:
> unable to access index for repository
> http://cran.pt.r-project.org/bin/windows/contrib/2.9
>  *2. * install.packages("C:/Program Files/R/rscproxy_1.3-1.tar.gz", repos =
> NULL) It also show warning ( Error in gzfile(file, "r") : cannot open the
> connection In addition: Warning   messages: 1: In unzip(zipname, exdir =
> dest) : error 1 in extracting from zip file 2: In gzfile(file, "r") :
> cannot open compressed file 'rscproxy_1.3-1.tar.gz/DESCRIPTION', probable
> reason 'No such file or directory'  )
>
>  Could you please suggest, how to solve this problem,

rscproxy is available on CRAN, so you could just use

install.packages("rscproxy")

and it would download and install the right version for you.

If you really want to build from source, here are some instructions:

On Windows, install.packages() assumes you're installing a binary
package.  ".tar.gz" indicates a source package, so you need to add
type="source" to the args to install.packages(), as well as repos=NULL.

You don't mention installing the Rtools, so you may find even this
doesn't work:  installing a package needs a lot of tools that don't come
with Windows.  You can get them from www.murdoch-sutherland.com/Rtools.

BTW, installing packages from source is rarely needed in Windows:  you
can get Uwe Ligges' system to convert the source to a binary for you, if
it's straightforward.  See http://win-builder.r-project.org/.  (I have a
feeling that rscproxy isn't a straightforward package, but I've never
tried to build it.)

Duncan Murdoch



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

Message: 14
Date: Thu, 10 Sep 2009 06:08:50 -0700
From: Deepayan Sarkar <deepayan.sarkar at gmail.com>
Subject: Re: [R] Xyplot, multi line title via main, all lines left
        justified
To: "Afshartous, David" <DAfshartous at med.miami.edu>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
        <eb555e660909100608wd9d52e5yb1be05546a6d332b at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Wed, Sep 9, 2009 at 2:53 PM, Afshartous, David
<DAfshartous at med.miami.edu> wrote:
>
> All,
>
> Below is an xyplot plot with multiple panels and a title produced via main:
>
> library("lattic")
> data.ex = data.frame(y = rnorm(10), t = rep(1:5, 2), group = rep(c(0,1),
> each = 5))
>
> xyplot(y ~ t | as.factor(group), data = data.ex,
> ? ?main = list("Put figure caption here xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> ? ?want this line left justified" ))
>
> I must be mis-interpreting the help description for main under xyplot, and
> the descriptions of just, hjust, and vjust in textGrob, since manipulation
> of these arguments do not seem to produce the desired result of having the
> second line of text left-justified.

This seems to work. You need to choose a suitable value of 'x', as the
default will be to start at the center.

xyplot(y ~ t | as.factor(group), data = data.ex,
       main = textGrob("Put figure caption here
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
want this line left justified", x = 0, hjust = 0))

-Deepayan



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

Message: 15
Date: Thu, 10 Sep 2009 09:09:02 -0400
From: Gabor Grothendieck <ggrothendieck at gmail.com>
Subject: Re: [R] Build a connectivity between .NET and R without using
        any     interface
To: Amitava1 M <amitava1.m at tcs.com>
Cc: r-help at r-project.org
Message-ID:
        <971536df0909100609u25a09e9bnd712914ed7792e02 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

System.Diagnostics.Process in .Net can launch any program
such as Rscript.  If that is not enough of a pointer to get you
going you need to post to a .Net group since this really is
about .Net programming, not about R programming.

On Thu, Sep 10, 2009 at 8:40 AM, Amitava1 M <amitava1.m at tcs.com> wrote:
> Dear All
>
> I like to develop an application using .NET and R. The front end would be
> .NET and statistical analysis would be done in R in the back end. So I
> want to integrate .NET(VB) with R without using any interface (e.g., R
> (D)com) to control. Secondly, I like to use Rscript (by calling .R files)
> from VB .NET environment for the analysis. Finally, I want to display the
> R-outputs including graphs on .NET controls (UI).
>
> Please help me out. Thank you in advance.
>
> Regards
> Amitava
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
> ? ? ? ?[[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: 16
Date: Thu, 10 Sep 2009 09:25:52 -0400
From: H Rao <hydsdrao at gmail.com>
Subject: [R] executing rscript from VB
To: r-help at r-project.org
Message-ID:
        <19c4b18d0909100625u66419046m3f612a52cdf7073a at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi,
I am looking to execute an R script from VB as  below.
The script runs fine but the redirection doesnt seem to happen. The
redirection operator and the out file seem to be treated as arguments
to the R script. Is there a way to get the > operator working

thanks, R

System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "E:/R/bin/Rscript.exe";
proc.StartInfo.Arguments = "E:/R/bin/test.r > test.out";
proc.StartInfo.UseShellExecute = true;
proc.Start();



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

Message: 17
Date: Thu, 10 Sep 2009 06:10:59 -0700 (PDT)
From: bbimber <bimber at wisc.edu>
Subject: [R]  tranform a table?
To: r-help at r-project.org
Message-ID: <25382806.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


hello everyone,

i'm new to R, so i hope you dont mind a fairly basic R question.  we're
using R to manipulate the results of SQL queries and create an HTML output.
I'm starting with a table that looks essentially like this:

Name    Field1     Field2
John      value1     value2
Jane      value3     value4

My table is stored as a dataframe.  I'd like to efficiently produce an
output that iterates through each row, transposes it and outputs an HTML
table (one per row).  like this:

Name: John
Field1: value1
Field2: value2

Name: Jane
Field1: value3
Field2: value4

I can accomplish this by looping through each row, then outputting that
row's table.  This gets the job done, but it seems there must be a better
way.  I'm going to need to do this sort of conversion a lot,
so the simpler the better.  is there a better way to approach it than the
code below?  is there a more general term for the sort of transformation i'm
trying to make that might help guide my searching?

i realize i need to look into better methods of outputting HTML tables (like
r2html).

here's the basic idea.  'labkey.data' is the data frame produced by my SQL
query:

D<-labkey.data
H<-colnames(D)
T<-t(D)
L<-length(D$id)

output <- ""

for(i in 1:L) {
R<-my.row <- D[i, ]
R<-t(R)
Len<-length(R)

output <- paste(output, "<table border=0>")
for(j in 1:Len) {
output <- paste(output,"<tr><td>", H[j],":</td><td>", R[j], "</td>")
}

output <- paste(output, "</table><p>")

}

write(output, file="${htmlout:output}")

Thanks for any help.
--
View this message in context: http://www.nabble.com/tranform-a-table--tp25382806p25382806.html
Sent from the R help mailing list archive at Nabble.com.



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

Message: 18
Date: Thu, 10 Sep 2009 15:07:31 +0200
From: "Sarah Moens" <sarah_m at telenet.be>
Subject: [R] Listing all data instead of only k-elements when using
        combn-function
To: <r-help at r-project.org>
Message-ID: <000001ca3217$a80d9720$f828c560$@be>
Content-Type: text/plain

Hi dear reader,



I've been searching the help-archive and found many topics with regard to
the use of combinations, but I can't seem to make sense out of the advice
given. So I posted my question here, my apologies that this has come up for
many times before.





Example data-set:

Group                  Scores

A                            5

A                            10

A                            9

B                             2

B                             3



I have 5 subjects. Those subjects are each assigned to a particular group,
group A or group B. Each subject gets a score on a test (dependant
variable).



Now instead of just getting the mean of group A and group B of the sample
I've drawn, I want to list all possible combinations (in this case 10
combinations, to eventually be able to compute for each combination, the
mean of group A and group B.

That is:

Group                  [,1]                       [,2]         .
[,10]

A                            5                             5
9

A                            10                           10
2

A                            9                             2
3

B                             2                             9
5

B                             3                             3
10



combn does provide me with 10 possible combinations, but it only lists a
part of the data:

                [,1]         [,2]         [,3]         [,4]         [,5]
[,6]         [,7]         [,8]         [,9]         [,10]

[1,]         5             5             5             5             5
5             10           10           10           9

[2,]         10           10           10           9             9
2             9             9             2             2

[3,]         9             2             3             2             3
3             2             3             3             3







Thanks a lot!!



Sarah


        [[alternative HTML version deleted]]



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

Message: 19
Date: Thu, 10 Sep 2009 14:57:29 +0100
From: Corrado <ct529 at york.ac.uk>
Subject: [R] Negative AIC
To: r-help at r-project.org
Message-ID: <200909101457.29775.ct529 at york.ac.uk>
Content-Type: Text/Plain;  charset="utf-8"

Dear R list,

I just obtained a negative AIC for two models (-221.7E+4
 and -230.2E+4). Is that normal?

Regards
--
Corrado Topi

Global Climate Change & Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk



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

Message: 20
Date: Thu, 10 Sep 2009 14:58:41 +0100
From: Corrado <ct529 at york.ac.uk>
Subject: [R] Intercept=0 in gam from  gam package
To: r-help at r-project.org
Message-ID: <200909101458.41888.ct529 at york.ac.uk>
Content-Type: Text/Plain;  charset="utf-8"

Dear R list,

is it possible to force the intercept to assume the value of 0 (that is no
intercept) in gam from gam package?

Regards
--
Corrado Topi

Global Climate Change & Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk



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

Message: 21
Date: Thu, 10 Sep 2009 15:07:07 +0100
From: "S Ellison" <S.Ellison at lgc.co.uk>
Subject: Re: [R] Order of multiple plots
To: "legen" <legendy at gmail.com>, <r-help at r-project.org>
Message-ID: <saa91627.057 at tedmail.lgc.co.uk>
Content-Type: text/plain; charset=ISO-8859-1

Rather than use par(mfro...) you should probably take a look at the alternative "layout" approach. That allows you to give R a matrix (corresponding to panels in the plot) containing the number of the plot to be placed in each panel.
It also allows unequal panel sizes.

See ?layout for details.

Steve E
>>> legen <legendy at gmail.com> 10/09/2009 05:49:04 >>>

Hello all,

I have a problem and need your help.
I am going to draw two plots in one row and two columns by using
?par(mfrow=c(1,2))?, but I want to first draw the right plot and then draw
the left plot. Does anybody can show me how to do it please? Thanks in
adv

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



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

Message: 22
Date: Thu, 10 Sep 2009 13:56:52 +0200
From: <mgko at planet.nl>
Subject: [R] [R-pkgs] new version of R-package mice
To: <r-packages at r-project.org>
Message-ID:
        <6C53267C784DF74BAB366EE1FEED4DE101FA0709 at CPEXBE-EML20.kpnsp.local>
Content-Type: text/plain; charset="us-ascii"

Dear R-users,

Version V2.0 of the package mice is now available on CRAN for Windows, Linux and Apple users.

Multivariate Imputation by Chained Equations (MICE) is the name of software for imputing incomplete multivariate data by Fully Conditional Specifcation (FCS). MICE V1.0 appeared in the year 2000 as an S-PLUS library, and in 2001 as an R package. MICE V1.0 introduced predictor selection, passive imputation and automatic pooling.

MICE V2.0, which extends the functionality of MICE V1.0 in several ways. In MICE V2.0, the analysis of imputed data is made completely general, whereas the range of models under which pooling works is substantially extended. MICE V2.0 adds new functionality for imputing multilevel data, automatic predictor selection, data handling, post-processing imputed values, specialized pooling and model selection. Imputation of categorical data is improved in order to bypass problems caused by perfect prediction.Special attention to transformations, sum scores, indices and interactions using passive imputation, and to the proper setup of the predictor matrix.

We have written also a complete new manual for mice, which can be downloaded from http://www.stefvanbuuren.nl/publications/MICE%20in%20R%20-%20Draft.pdf <https://webmail.kpnplanet.nl/exchweb/bin/redir.asp?URL=http://www.stefvanbuuren.nl/publications/MICE%2520in%2520R%2520-%2520Draft.pdf>

This article/manual provides a hands-on, stepwise approach to using mice for solving incomplete data problems in real data.

Best Regards,

Karin Groothuis-Oudshoorn & Stef van Buuren





C.G.M. (Karin) Groothuis-Oudshoorn, Phd

Assistent Professor University of Twente / Biostatistician Roessingh Research and Development

c.g.m.oudshoorn at utwente.nl <mailto:c.g.m.oudshoorn at utwente.nl>  / k.groothuis at rrd.nl <mailto:k.groothuis at rrd.nl>


        [[alternative HTML version deleted]]

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



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

Message: 23
Date: Thu, 10 Sep 2009 15:25:02 +0100
From: Gavin Simpson <gavin.simpson at ucl.ac.uk>
Subject: Re: [R] Intercept=0 in gam from  gam package
To: Corrado <ct529 at york.ac.uk>
Cc: r-help at r-project.org
Message-ID: <1252592702.17713.13.camel at prometheus.geog.ucl.ac.uk>
Content-Type: text/plain

On Thu, 2009-09-10 at 14:58 +0100, Corrado wrote:
> Dear R list,
>
> is it possible to force the intercept to assume the value of 0 (that is no
> intercept) in gam from gam package?

Just like you would in lm or glm for example, by adding -1 to your
formula. ?gam suggests you look at ?lm to see about the formulas for
example.

data(airquality)
mod0 <- gam(Ozone^(1/3) ~ lo(Solar.R) + lo(Wind, Temp) - 1,
            data = airquality, na = na.gam.replace)
mod1 <- gam(Ozone^(1/3) ~ lo(Solar.R) + lo(Wind, Temp),
            data = airquality, na = na.gam.replace)

summary(mod0)
summary(mod1)

HTH

G

>
> Regards
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



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

Message: 24
Date: Thu, 10 Sep 2009 15:07:50 +0100
From: srpd TCLTK <srpd2009 at hotmail.com>
Subject: [R] Running R in Windows server
To: mailing list <r-help at r-project.org>, Mailing list R
        <r-packages-request at r-project.org>
Message-ID: <BLU130-W171BBFBD5A8DCD5298196BD1E80 at phx.gbl>
Content-Type: text/plain


Hi,



I'm trying to set up a server which allows different users to use R simultaneously. Is it possible in Windows?
I know that a LINUX Server is probably a better option, but I had already created a GUI with Tcl/tk in Windows. So some of the events don't work in LINUX.

Thanks in advance,

Srpd




_________________________________________________________________

m s? local.

rk-connector.aspx
        [[alternative HTML version deleted]]



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

Message: 25
Date: Thu, 10 Sep 2009 10:35:26 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] executing rscript from VB
To: H Rao <hydsdrao at gmail.com>
Cc: r-help at r-project.org
Message-ID: <4AA90EAE.8050206 at stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 9/10/2009 9:25 AM, H Rao wrote:
> Hi,
> I am looking to execute an R script from VB as  below.
> The script runs fine but the redirection doesnt seem to happen. The
> redirection operator and the out file seem to be treated as arguments
> to the R script. Is there a way to get the > operator working

That's a VB question.  You should ask Microsoft.

Duncan Murdoch

>
> thanks, R
>
> System.Diagnostics.Process proc = new System.Diagnostics.Process();
> proc.StartInfo.FileName = "E:/R/bin/Rscript.exe";
> proc.StartInfo.Arguments = "E:/R/bin/test.r > test.out";
> proc.StartInfo.UseShellExecute = true;
> proc.Start();
>
> ______________________________________________
> 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: 26
Date: Thu, 10 Sep 2009 16:38:33 +0200
From: Matteo Bertini <matteo at naufraghi.net>
Subject: [R] fit arima long period alternatives
To: r-help <r-help at r-project.org>
Message-ID:
        <1e2c38000909100738t421c0c1cx3cdbb4bac366a45d at mail.gmail.com>
Content-Type: text/plain

I'd like to fit a SARIMA model on a timeseries but the period I'd like to
use is too big (7 day in 15min samples = 672) for the algorithm used in R.

Some suggested alternatives?

Thanks,
Matteo Bertini

        [[alternative HTML version deleted]]



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

Message: 27
Date: Thu, 10 Sep 2009 10:41:18 -0400
From: Sunil Suchindran <sunilsuchindran at gmail.com>
Subject: Re: [R] lean text label below barplot table
To: Xiaogang Yang <gavinxyang at gmail.com>
Cc: r-help <r-help at r-project.org>
Message-ID:
        <f2faed070909100741k213bbc99q2c6fd4fd83c72dc2 at mail.gmail.com>
Content-Type: text/plain

#Example data

df <- data.frame(trt = factor(c("A long label", "Another long \n label")),
outcome = c(1,4))

#Install ggplot2 if needed

library(ggplot2)
p <- ggplot(df, aes(y=outcome, x=trt))
p <- p + geom_bar(position="dodge", stat="identity")
p <- p + opts(axis.text.x = theme_text(angle = 45, hjust=1))
p



On Mon, Sep 7, 2009 at 5:03 PM, Xiaogang Yang <gavinxyang at gmail.com> wrote:

> Hi, everyone:
> I am plotting an graph with bar plot, but the label after every bar is too
> long, I wanna if I can draw the label lean to an angle
> thanks
>
> --
> Xiaogang Yang
> Sensorweb Research Laboratory
> http://sensorweb.vancouver.wsu.edu/
> Washington State University Vancouver
>
>        [[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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]



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

Message: 28
Date: Thu, 10 Sep 2009 16:48:43 +0200
From: Uwe Ligges <ligges at statistik.tu-dortmund.de>
Subject: Re: [R] Running R in Windows server
To: srpd TCLTK <srpd2009 at hotmail.com>
Cc: mailing list <r-help at r-project.org>,        Mailing list R
        <r-packages-request at r-project.org>
Message-ID: <4AA911CB.7000509 at statistik.tu-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed



srpd TCLTK wrote:
> Hi,
>
>
>
> I'm trying to set up a server which allows different users to use R simultaneously. Is it possible in Windows?

Yes, I guess you want to use some Terminal Server. As for any other
software, each user can start own instances of R.

Uwe Ligges





> I know that a LINUX Server is probably a better option, but I had already created a GUI with Tcl/tk in Windows. So some of the events don't work in LINUX.
>
> Thanks in advance,
>
> Srpd
>
>
>
>
> _________________________________________________________________
>
> m s? local.
>
> rk-connector.aspx
>       [[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: 29
Date: Thu, 10 Sep 2009 15:50:34 +0100
From: Barry Rowlingson <b.rowlingson at lancaster.ac.uk>
Subject: Re: [R] Running R in Windows server
To: srpd TCLTK <srpd2009 at hotmail.com>
Cc: mailing list <r-help at r-project.org>,        Mailing list R
        <r-packages-request at r-project.org>
Message-ID:
        <d8ad40b50909100750ub4786adu567c6b5277c41c74 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Sep 10, 2009 at 3:07 PM, srpd TCLTK<srpd2009 at hotmail.com> wrote:
>
> Hi,
>
>
>
> I'm trying to set up a server which allows different users to use R simultaneously. Is it possible in Windows?
> I know that a LINUX Server is probably a better option, but I had already created a GUI with Tcl/tk in Windows. So some of the events don't work in LINUX.

  You need Windows Terminal Server 2008 (or 2003) plus the right
client access licenses (CALs) depending on how you expect the machine
to be used. A thousand dollars gets you a single server license plus 5
CALs. Then your 5 users connect to it from their Windows PCs using the
Windows Remote Desktop Connection program. So your users will need
Windows XP (or Vista, or 7) licenses as well, unless they have
linux/mac desktops in which case they can use rdesktop to connect.

  Is it a thousand dollars worth of hassle to make your Tcl/Tk program
OS-independent? Plus the time it takes to learn how to set up and
admin a Windows TS 2008 box...

Barry



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

Message: 30
Date: Thu, 10 Sep 2009 07:57:01 -0700 (PDT)
From: Ben Bolker <bolker at ufl.edu>
Subject: Re: [R] Negative AIC
To: r-help at r-project.org
Message-ID: <25384865.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii




Corrado-5 wrote:
>
> Dear R list,
>
> I just obtained a negative AIC for two models (-221.7E+4
>  and -230.2E+4). Is that normal?
>
>

It's not necessarily wrong.  See <http://emdbolker.wikidot.com/faq>
--
View this message in context: http://www.nabble.com/Negative-AIC-tp25383791p25384865.html
Sent from the R help mailing list archive at Nabble.com.



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

Message: 31
Date: Thu, 10 Sep 2009 08:01:38 -0700
From: Don MacQueen <macq at llnl.gov>
Subject: Re: [R] tranform a table?
To: bbimber <bimber at wisc.edu>, r-help at r-project.org
Message-ID: <p06240801c6cec157d376@[128.115.67.9]>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"

One could probably use one of the apply family of functions (apply,
lapply, sapply), but having looked into it a bit, I think it's
simpler to use an explicit loop. I doubt you'll encounter a need for
greater efficiency, in the cpu time sense, unless your tables are
huge.

But the looping can be written more simply:


require(xtable)

df <- data.frame(nm=letters[1:4], val1=1:4, val2=round(runif(4)))

for (i in seq(nrow(df))) {
   print( xtable( t(df[i,])) , type='html', include.colnames=FALSE)
   cat('<br>')
}


One of the other packages for writing html from R objects might have
a function that will automatically subset a dataframe in this
particular way, but it strikes me as somewhat unlikely.

-Don


At 6:10 AM -0700 9/10/09, bbimber wrote:
>hello everyone,
>
>i'm new to R, so i hope you dont mind a fairly basic R question.  we're
>using R to manipulate the results of SQL queries and create an HTML output.
>I'm starting with a table that looks essentially like this:
>
>Name    Field1     Field2
>John      value1     value2
>Jane      value3     value4
>
>My table is stored as a dataframe.  I'd like to efficiently produce an
>output that iterates through each row, transposes it and outputs an HTML
>table (one per row).  like this:
>
>Name: John
>Field1: value1
>Field2: value2
>
>Name: Jane
>Field1: value3
>Field2: value4
>
>I can accomplish this by looping through each row, then outputting that
>row's table.  This gets the job done, but it seems there must be a better
>way.  I'm going to need to do this sort of conversion a lot,
>so the simpler the better.  is there a better way to approach it than the
>code below?  is there a more general term for the sort of transformation i'm
>trying to make that might help guide my searching?
>
>i realize i need to look into better methods of outputting HTML tables (like
>r2html).
>
>here's the basic idea.  'labkey.data' is the data frame produced by my SQL
>query:
>
>D<-labkey.data
>H<-colnames(D)
>T<-t(D)
>L<-length(D$id)
>
>output <- ""
>
>for(i in 1:L) {
>R<-my.row <- D[i, ]
>R<-t(R)
>Len<-length(R)
>
>output <- paste(output, "<table border=0>")
>for(j in 1:Len) {
>output <- paste(output,"<tr><td>", H[j],":</td><td>", R[j], "</td>")
>}
>
>output <- paste(output, "</table><p>")
>
>}
>
>write(output, file="${htmlout:output}")
>
>Thanks for any help.
>--
>View this message in context:
>http://*www.*nabble.com/tranform-a-table--tp25382806p25382806.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.


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



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

Message: 32
Date: Thu, 10 Sep 2009 16:02:16 +0100
From: Corrado <ct529 at york.ac.uk>
Subject: Re: [R] Negative AIC
To: r-help at r-project.org, S Ellison <S.Ellison at lgc.co.uk>
Cc: Ben Bolker <bolker at ufl.edu>
Message-ID: <200909101602.16452.ct529 at york.ac.uk>
Content-Type: Text/Plain;  charset="iso-8859-1"

My worry is: can I compare negative AIC with positive AIC? does the comparison
still hold?

On Thursday 10 September 2009 15:57:01 Ben Bolker wrote:
> Corrado-5 wrote:
> > Dear R list,
> >
> > I just obtained a negative AIC for two models (-221.7E+4
> >  and -230.2E+4). Is that normal?
>
> It's not necessarily wrong.  See <http://emdbolker.wikidot.com/faq>



--
Corrado Topi

Global Climate Change & Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk



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

Message: 33
Date: Thu, 10 Sep 2009 17:21:12 +0200
From: JiHO <jo.lists at gmail.com>
Subject: [R] Merge data frames but prefer values in one
To: R Help <r-help at stat.math.ethz.ch>
Message-ID: <B777CC85-93AA-4ACE-8DCE-04DCEB0958E3 at gmail.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Hello everyone,

My problem is better explained with an example:

 > x=data.frame(a=1:4,b=1:4,c=rnorm(4))
 > x
  a b          c
1 1 1 -0.8821089
2 2 2 -0.7082583
3 3 3 -0.5948835
4 4 4 -1.8571443
 > y=data.frame(a=c(1,3),b=3,c=rnorm(2))
 > y
  a b            c
1 1 3 -0.273155973
2 3 3  0.009517862

Now I want to merge x and y by columns a and b, hence creating a
data.frame with all a:b combinations observed in x and y. That's
easily done with merge:

 > merge(x,y,by=c("a","b"),all=T)
  a b        c.x          c.y
1 1 1 -0.8821089           NA
2 1 3         NA -0.273155973
3 2 2 -0.7082583           NA
4 3 3 -0.5948835  0.009517862
5 4 4 -1.8571443           NA

But rather than two c columns I would want the merge to:
- keep the value in x if there is no corresponding value in y
- keep the value in y if there is no corresponding value in x
- prefer the value in y when the a:b combination exists in both x and y

So basically I want my result to look like:
  a b          c
1 1 1 -0.8821089
2 1 3 -0.2731559
3 2 2 -0.7082583
4 3 3  0.0095178
5 4 4 -1.8571443

I can't find a combinations of options for merge that does this. Is
there another fonction that would do that or do I have to resort to
some post-processing after merge? It seems that it might be something
like a "right merge" for data bases but I don't know this world at
all. I would be happy to look into sqldf if that allows to do things
like that.

Thanks in advance. Sincerely,

JiHO
---
http://maururu.net



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

Message: 34
Date: Thu, 10 Sep 2009 11:33:02 -0400
From: Cedrick Johnson <cedrick at cedrickjohnson.com>
Subject: Re: [R] Insall package
To: wesley mathew <wesleycmathew at gmail.com>
Cc: r-help at r-project.org
Message-ID: <4AA91C2E.9080003 at cedrickjohnson.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Try downloading the rscproxy-xxxx.ZIP file on windows. Extension tar.gz
is used (mostly) on linux

or

install.packages('rscproxy')

-c


wesley mathew wrote:
> Dear Sir
>
> Subject: - *Install " rscproxy_1.3-1.tar.gz "*
>
>  I am working in Windows system.  I was try  to install *rscproxy* package
> in  two way.
>  *1.* install.packages ("rscproxy_1.3-1.tar.gz"),  It shows the Warning:
> unable to access index for repository
> http://cran.pt.r-project.org/bin/windows/contrib/2.9
>  *2. * install.packages("C:/Program Files/R/rscproxy_1.3-1.tar.gz", repos =
> NULL) It also show warning ( Error in gzfile(file, "r") : cannot open the
> connection In addition: Warning   messages: 1: In unzip(zipname, exdir =
> dest) : error 1 in extracting from zip file 2: In gzfile(file, "r") :
> cannot open compressed file 'rscproxy_1.3-1.tar.gz/DESCRIPTION', probable
> reason 'No such file or directory'  )
>
>  Could you please suggest, how to solve this problem,
>
>
>
>
>
>
>
>
>



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

Message: 35
Date: Thu, 10 Sep 2009 11:39:32 -0400
From: Ben Bolker <bolker at ufl.edu>
Subject: Re: [R] Negative AIC
To: Corrado <ct529 at york.ac.uk>
Cc: "r-help at r-project.org" <r-help at r-project.org>,      S Ellison
        <S.Ellison at lgc.co.uk>
Message-ID: <4AA91DB4.8020902 at ufl.edu>
Content-Type: text/plain; charset="iso-8859-1"

  If all the models are fitted to the same data set, using the same
modeling tools (you have to be careful e.g. comparing lmer models to
glm models, because they use different additive constants), and
everything seems to make sense (!!!), then yes.  I would be a little
surprised, and think that something was wrong, if you have some AIC
values that are on the order of -20,000 (as below) and others that are
+20,000 ...

  Ben Bolker

Corrado wrote:
> My worry is: can I compare negative AIC with positive AIC? does the comparison
> still hold?
>
> On Thursday 10 September 2009 15:57:01 Ben Bolker wrote:
>> Corrado-5 wrote:
>>> Dear R list,
>>>
>>> I just obtained a negative AIC for two models (-221.7E+4
>>>  and -230.2E+4). Is that normal?
>> It's not necessarily wrong.  See <http://emdbolker.wikidot.com/faq>
>
>
>


--
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bolker at ufl.edu / www.zoology.ufl.edu/bolker
GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090910/dcce4f00/attachment-0001.bin>

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

Message: 36
Date: Thu, 10 Sep 2009 08:42:34 -0700 (PDT)
From: Murilo Doi <doi.murilo at gmail.com>
Subject: Re: [R] Negative AIC
To: r-help at r-project.org
Message-ID: <25385341.post at talk.nabble.com>
Content-Type: text/plain; charset=UTF-8


Hi,

yes the AIC can be negative. To choose the model we use the criteria of
lower AIC (-230.2E+4).

Murilo Doi


Corrado-5 wrote:
>
> Dear R list,
>
> I just obtained a negative AIC for two models (-221.7E+4
>  and -230.2E+4). Is that normal?
>
> Regards
> --
> Corrado Topi
>
> Global Climate Change & Biodiversity Indicators
> Area 18,Department of Biology
> University of York, York, YO10 5YW, UK
> Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk
>
> ______________________________________________
> 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.
>
>


-----

Murilo Eiji Doi
http://twitter.com/murilodoi
http://pt.beezzer.com/rproject (help do R-project em portugu?s)

--
View this message in context: http://www.nabble.com/Negative-AIC-tp25383791p25385341.html
Sent from the R help mailing list archive at Nabble.com.



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

Message: 37
Date: Thu, 10 Sep 2009 09:18:54 -0700
From: "William Dunlap" <wdunlap at tibco.com>
Subject: Re: [R] How to do rotation for polygon?
To: "Hemavathi Ramulu" <hema.ramulu at gmail.com>, "Greg Snow"
        <greg.snow at imail.org>
Cc: r-help at r-project.org
Message-ID:
        <77EB52C6DD32BA4D87471DCD70C8D70001C23BCB at NA-PA-VBE03.na.tibco.com>
Content-Type: text/plain;       charset="us-ascii"

Try representing the pentagon as a set of complex
numbers.  Translate them by adding a complex
number and multiply by exp(1i*angle) to rotate them
around the origin.  E.g. to rotate them around their
center of gravity, mean(p), do

> p<-complex(real=c(4,5,7,8,6), imag=c(5,3,3,5,7))
> plot(p, xlim=c(0,10), ylim=c(0,10), type="n")
> for(k in 0:10)polygon(border=k, lwd=k+1,
(p-mean(p))*exp(k*1i/10*pi)+mean(p))

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com

> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Hemavathi Ramulu
> Sent: Thursday, September 10, 2009 1:44 AM
> To: Greg Snow
> Cc: r-help at r-project.org
> Subject: Re: [R] How to do rotation for polygon?
>
> Hi everyone,
> I still couldn't get the diagram as I mentioned before. I try Grey and
> Milton suggestion but
> it confusing.
> I hope anyone helped me.
>
> Thanks in advance.
>
> Regards,
> Hema.
>
> On Thu, Sep 3, 2009 at 11:39 PM, Greg Snow
> <Greg.Snow at imail.org> wrote:
>
> > The my.symbols and ms.polygon functions in the
> TeachingDemos package may
> > help.
> >
> > --
> > 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 Hemavathi Ramulu
> > > Sent: Wednesday, September 02, 2009 11:05 PM
> > > To: r-help at r-project.org
> > > Subject: [R] How to do rotation for polygon?
> > >
> > > Hi everyone,
> > > I have coding for repeating pentagon as below:
> > >
> > > plot(0:11,type="n")
> > > for (i in 1:10 )polygon(rep(c(4,5,7,8,6)),
> i*c(.5,.3,.3,.5,.7), bor=2)
> > >
> > > which are increasing vertically.
> > >
> > > Now, I want to know how to rotate the pentagon, so that I will get
> > > pattern
> > > like flower.
> > > Basicly, repeating pentagon in circle.
> > >
> > > Thanks alot for helping me to solve this problem.
> > > --
> > > Hemavathi
> > >
> > >       [[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.
> >
>
>
>
> --
> Hemavathi Ramulu
>
>       [[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: 38
Date: Thu, 10 Sep 2009 18:15:29 +0100
From: John C Frain <frainj at gmail.com>
Subject: Re: [R] Negative AIC
To: Corrado <ct529 at york.ac.uk>
Cc: r-help at r-project.org, Ben Bolker <bolker at ufl.edu>,  S Ellison
        <S.Ellison at lgc.co.uk>
Message-ID:
        <fad888a10909101015k7d89050dr54f49adf5fc3c08e at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Enders (2004), Applied Econometric time series, Wiley,  Exercise 10,
page 102, sets out some of the variations of the AIC and SBC and
contains a good definition.  As these are all monotonic
transformations of one another they lead to the same maximum
(minimum).  I say maximum/minimum because I have seen some persons who
define the information criterion as the negative or other definitions.
  You may even find different definitions used in different functions
in the same software.  The only thing to do is to check the
documentaion to see what definition is being used by each function in
that software.

Best Regards

John Frain

2009/9/10 Corrado <ct529 at york.ac.uk>:
> My worry is: can I compare negative AIC with positive AIC? does the comparison
> still hold?
>
> On Thursday 10 September 2009 15:57:01 Ben Bolker wrote:
>> Corrado-5 wrote:
>> > Dear R list,
>> >
>> > I just obtained a negative AIC for two models (-221.7E+4
>> > ?and -230.2E+4). Is that normal?
>>
>> It's not necessarily wrong. ?See <http://emdbolker.wikidot.com/faq>
>
>
>
> --
> Corrado Topi
>
> Global Climate Change & Biodiversity Indicators
> Area 18,Department of Biology
> University of York, York, YO10 5YW, UK
> Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk
>
> ______________________________________________
> 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.
>



--
John C Frain
Economics Department
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:frainj at tcd.ie
mailto:frainj at gmail.com



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

Message: 39
Date: Thu, 10 Sep 2009 16:59:17 +0200
From: David Hajage <dhajage at gmail.com>
Subject: Re: [R] tranform a table?
To: bbimber <bimber at wisc.edu>
Cc: r-help at r-project.org
Message-ID:
        <a725cda30909100759h385157c7mda02674998277c8b at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I think you could use reshape and ascii package here.

Create a file ("code.Rnw") with this code :

John and Jane
=============

<<>>=
df <- data.frame(names = c("John", "Jane"), field1 = c("value1", "value2"),
field2 = c("value3", "value4"))
library(reshape)
cdf <- cast(melt(df, id = "names"), variable ~ . | names)
@

<<results=ascii>>=
library(ascii)
ascii(cdf$Jane)
ascii(cdf$John)
@

Then from R, run :
Sweave("code.Rnw", RweaveAsciidoc)

Finally, use asciidoc <http://www.methods.co.nz/asciidoc/> to convert the
new file "code.txt" into html :
asciidoc code.txt

David


On Thu, Sep 10, 2009 at 15:10, bbimber <bimber at wisc.edu> wrote:

>
> hello everyone,
>
> i'm new to R, so i hope you dont mind a fairly basic R question.  we're
> using R to manipulate the results of SQL queries and create an HTML output.
> I'm starting with a table that looks essentially like this:
>
> Name    Field1     Field2
> John      value1     value2
> Jane      value3     value4
>
> My table is stored as a dataframe.  I'd like to efficiently produce an
> output that iterates through each row, transposes it and outputs an HTML
> table (one per row).  like this:
>
> Name: John
> Field1: value1
> Field2: value2
>
> Name: Jane
> Field1: value3
> Field2: value4
>
> I can accomplish this by looping through each row, then outputting that
> row's table.  This gets the job done, but it seems there must be a better
> way.  I'm going to need to do this sort of conversion a lot,
> so the simpler the better.  is there a better way to approach it than the
> code below?  is there a more general term for the sort of transformation
> i'm
> trying to make that might help guide my searching?
>
> i realize i need to look into better methods of outputting HTML tables
> (like
> r2html).
>
> here's the basic idea.  'labkey.data' is the data frame produced by my SQL
> query:
>
> D<-labkey.data
> H<-colnames(D)
> T<-t(D)
> L<-length(D$id)
>
> output <- ""
>
> for(i in 1:L) {
> R<-my.row <- D[i, ]
> R<-t(R)
> Len<-length(R)
>
> output <- paste(output, "<table border=0>")
> for(j in 1:Len) {
> output <- paste(output,"<tr><td>", H[j],":</td><td>", R[j], "</td>")
> }
>
> output <- paste(output, "</table><p>")
>
> }
>
> write(output, file="${htmlout:output}")
>
> Thanks for any help.
> --
> View this message in context:
> http://www.nabble.com/tranform-a-table--tp25382806p25382806.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.
>

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

Message: 40
Date: Thu, 10 Sep 2009 14:20:21 -0300
From: Henrique Dallazuanna <wwwhsd at gmail.com>
Subject: Re: [R] Merge data frames but prefer values in one
To: JiHO <jo.lists at gmail.com>
Cc: R Help <r-help at stat.math.ethz.ch>
Message-ID:
        <da79af330909101020g1d029343rc57db82672f88b57 at mail.gmail.com>
Content-Type: text/plain

Try this:

xy <- merge(x, y, by = c("a","b"),all = TRUE)
xy$c <- ifelse(rowSums(!is.na(.x <- xy[, c('c.x', 'c.y')])) > 1, .x[,1],
rowSums(.x, na.rm = TRUE))
xy

On Thu, Sep 10, 2009 at 12:21 PM, JiHO <jo.lists at gmail.com> wrote:

> Hello everyone,
>
> My problem is better explained with an example:
>
> > x=data.frame(a=1:4,b=1:4,c=rnorm(4))
> > x
>  a b          c
> 1 1 1 -0.8821089
> 2 2 2 -0.7082583
> 3 3 3 -0.5948835
> 4 4 4 -1.8571443
> > y=data.frame(a=c(1,3),b=3,c=rnorm(2))
> > y
>  a b            c
> 1 1 3 -0.273155973
> 2 3 3  0.009517862
>
> Now I want to merge x and y by columns a and b, hence creating a data.frame
> with all a:b combinations observed in x and y. That's easily done with
> merge:
>
> > merge(x,y,by=c("a","b"),all=T)
>  a b        c.x          c.y
> 1 1 1 -0.8821089           NA
> 2 1 3         NA -0.273155973
> 3 2 2 -0.7082583           NA
> 4 3 3 -0.5948835  0.009517862
> 5 4 4 -1.8571443           NA
>
> But rather than two c columns I would want the merge to:
> - keep the value in x if there is no corresponding value in y
> - keep the value in y if there is no corresponding value in x
> - prefer the value in y when the a:b combination exists in both x and y
>
> So basically I want my result to look like:
>  a b          c
> 1 1 1 -0.8821089
> 2 1 3 -0.2731559
> 3 2 2 -0.7082583
> 4 3 3  0.0095178
> 5 4 4 -1.8571443
>
> I can't find a combinations of options for merge that does this. Is there
> another fonction that would do that or do I have to resort to some
> post-processing after merge? It seems that it might be something like a
> "right merge" for data bases but I don't know this world at all. I would be
> happy to look into sqldf if that allows to do things like that.
>
> Thanks in advance. Sincerely,
>
> JiHO
> ---
> http://maururu.net
>
> ______________________________________________
> 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.
>



--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O

        [[alternative HTML version deleted]]



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

Message: 41
Date: Thu, 10 Sep 2009 18:37:17 +0100
From: Corrado <ct529 at york.ac.uk>
Subject: Re: [R] Negative AIC
To: Ben Bolker <bolker at ufl.edu>
Cc: "r-help at r-project.org" <r-help at r-project.org>,      S Ellison
        <S.Ellison at lgc.co.uk>, Giovanni Petris <GPetris at uark.edu>
Message-ID: <200909101837.17826.ct529 at york.ac.uk>
Content-Type: Text/Plain;  charset="iso-8859-15"

I think the problem is trying to compare different models trained don the same
dataset.

1) If I compare for example gam (from gam package) with and without intercept,
is that a valid comparison?

For example: model with intercept has explained dev 24%, with AIC -2217146,
model without intercept has explained dev 85.5% with AIC 217488.1

The results sound incredibly strange, but there is actually no difference in
the model but the removal of the intercept .... :(. So which model is "better"
at fitting the data????

2) If I compare for example gam from gam package with let's say gam from mgcv
(using tpsp), then I get two completely analogous AIC, but are they
comparable?

gam from mgcv package: -2195000
gam from gam package: -2217000

3) I would like to compare those AIC to the AIC obtained by running BRT on the
same dataset. I was thinking of simply recalculating manually the AIC using
the formula:

AIC=2K+N*log(rss/N)

where K is the number of parameters of the regression (i.e. the coefficient that
are not zero, I would think) and N is the number of samples.

What do you think? Would that be reasonable?

Regards

On Thursday 10 September 2009 16:39:32 Ben Bolker wrote:
>   If all the models are fitted to the same data set, using the same
> modeling tools (you have to be careful e.g. comparing lmer models to
> glm models, because they use different additive constants), and
> everything seems to make sense (!!!), then yes.  I would be a little
> surprised, and think that something was wrong, if you have some AIC
> values that are on the order of -20,000 (as below) and others that are
> +20,000 ...
>
>   Ben Bolker
>
> Corrado wrote:
> > My worry is: can I compare negative AIC with positive AIC? does the
> > comparison still hold?
> >
> > On Thursday 10 September 2009 15:57:01 Ben Bolker wrote:
> >> Corrado-5 wrote:
> >>> Dear R list,
> >>>
> >>> I just obtained a negative AIC for two models (-221.7E+4
> >>>  and -230.2E+4). Is that normal?
> >>
> >> It's not necessarily wrong.  See <http://emdbolker.wikidot.com/faq>



--
Corrado Topi

Global Climate Change & Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk



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

Message: 42
Date: Thu, 10 Sep 2009 18:48:31 +0100
From: Corrado <ct529 at york.ac.uk>
Subject: [R] AIC and goodness of prediction - was: Re: goodness of
        "prediction" using a model (lm, glm, gam, brt,
To: Kingsford Jones <kingsfordjones at gmail.com>
Cc: r-help at r-project.org
Message-ID: <200909101848.31836.ct529 at york.ac.uk>
Content-Type: Text/Plain;  charset="iso-8859-1"

Dear Kingsford,

I apologise for breaking the thread, but I thought there were some more people
who would be interested.

What you propose is what I am using at the moment: the sum of the squares of
the residuals, plus  variance / stdev. I am not really satisfied. I have also
tried using R2, and it works well .... but some people go a bit wild eyed when
they see a negative R2 (which is perfectly reasonable when you use R2 as a
measure of goodness of fit on prediction on a dataset different from the
training set).

I was then wondering whether it would make sense to use AIC: the K in the
formula will still be the number of parameters of the trained model, the "sum
of square residuals" would be the (predicted - observed)^2, N would be the
number of samples in the test dataset. I think it should work well.

What do you / other R list members think?

Regards

On Thursday 03 September 2009 15:06:14 Kingsford Jones wrote:
> There are many ways to measure prediction quality, and what you choose
> depends on the data and your goals.  A common measure for a
> quantitative response is mean squared error (i.e. 1/n * sum((observed
> - predicted)^2)) which incorporates bias and variance.  Common terms
> for what you are looking for are "test error" and "generalization
> error".
>
>
> hth,
> Kingsford
>
> On Wed, Sep 2, 2009 at 11:56 PM, Corrado<ct529 at york.ac.uk> wrote:
> > Dear R-friends,
> >
> > How do you test the goodness of prediction of a model, when you predict
> > on a set of data DIFFERENT from the training set?
> >
> > I explain myself: you train your model M (e.g. glm,gam,regression tree,
> > brt) on a set of data A with a response variable Y. You then predict the
> > value of that same response variable Y on a different set of data B (e.g.
> > predict.glm, predict.gam and so on). Dataset A and dataset B are
> > different in the sense that they contain the same variable, for example
> > temperature, measured in different sites, or on a different interval
> > (e.g. B is a subinterval of A for interpolation, or a different interval
> > for extrapolation). If you have the measured values for Y on the new
> > interval, i.e. B, how do you measure how good is the prediction, that is
> > how well model fits the Y on B (that is, how well does it predict)?
> >
> > In other words:
> >
> > Y~T,data=A for training
> > Y~T,data=B for predicting
> >
> > I have devised a couple of method based around 1) standard deviation 2)
> > R^2, but I am unhappy with them.
> >
> > Regards
> > --
> > Corrado Topi
> >
> > Global Climate Change & Biodiversity Indicators
> > Area 18,Department of Biology
> > University of York, York, YO10 5YW, UK
> > Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk
> >
> > ______________________________________________
> > 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.



--
Corrado Topi

Global Climate Change & Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct529 at york.ac.uk



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

Message: 43
Date: Thu, 10 Sep 2009 10:54:09 -0700 (PDT)
From: Nandi <nands31 at gmail.com>
Subject: Re: [R] Order of multiple plots
To: r-help at r-project.org
Message-ID:
        <0de90e12-3f17-4e1b-96ed-1670c6820ad2 at 38g2000yqr.googlegroups.com>
Content-Type: text/plain; charset=windows-1252

'Layout' is the way to go. You can define a layout as:

LO <- layout(matrix(c(1, 2, 3, 4), ncol=2))

In your case, you would probably want to use:
layout(matrix(c(2, 1), ncol=2))
Then, the first plot will be drawn in space number 2, and then the
second plot will be drawn in space number 1.

Hope this helps.
-Nandi


On Sep 9, 11:49?pm, legen <lege... at gmail.com> wrote:
> Hello all,
>
> I have a problem and need your help.
> I am going to draw two plots in one row and two columns by using
> ?par(mfrow=c(1,2))?, but I want to first draw the right plot and then draw
> the left plot. Does anybody can show me how to do it please? Thanks in
> advance.
>
> Legen
>
> --
> View this message in context:http://www.nabble.com/Order-of-multiple-plots-tp25377235p25377235.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



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

Message: 44
Date: Thu, 10 Sep 2009 11:34:16 -0700
From: annie Zhang <annie.zhang2010 at gmail.com>
Subject: [R]  index of min elements in matrix
To: r-help at r-project.org
Message-ID:
        <7a5370c90909101134q175d79fbs7dcf1e367b9f22b1 at mail.gmail.com>
Content-Type: text/plain

Hi, All,

How can I get the indices of the minimum elements in a matrix without using
a loop?

For example, if the matrix is

4 5 2
2 8 9
5 2 3

Then I want to output (1,3), (2,1), (3,2).

Thanks,

Annie

        [[alternative HTML version deleted]]



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

Message: 45
Date: Thu, 10 Sep 2009 15:38:06 -0300
From: Henrique Dallazuanna <wwwhsd at gmail.com>
Subject: Re: [R] index of min elements in matrix
To: annie Zhang <annie.zhang2010 at gmail.com>
Cc: r-help at r-project.org
Message-ID:
        <da79af330909101138mc505083tddfd6783ae8a7fc at mail.gmail.com>
Content-Type: text/plain

Try this:

m <- rbind(c(4,5,2), c(2,8,9), c(5,2,3))
cbind(1:NROW(m), apply(m, 1, which.min))


On Thu, Sep 10, 2009 at 3:34 PM, annie Zhang <annie.zhang2010 at gmail.com>wrote:

> Hi, All,
>
> How can I get the indices of the minimum elements in a matrix without using
> a loop?
>
> For example, if the matrix is
>
> 4 5 2
> 2 8 9
> 5 2 3
>
> Then I want to output (1,3), (2,1), (3,2).
>
> Thanks,
>
> Annie
>
>        [[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.
>



--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O

        [[alternative HTML version deleted]]



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

Message: 46
Date: Thu, 10 Sep 2009 13:42:52 -0500
From: Marc Schwartz <marc_schwartz at me.com>
Subject: Re: [R] index of min elements in matrix
To: annie Zhang <annie.zhang2010 at gmail.com>
Cc: r-help at r-project.org
Message-ID: <DCD74772-6465-4883-B958-8BA38DD67346 at me.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

On Sep 10, 2009, at 1:34 PM, annie Zhang wrote:

> Hi, All,
>
> How can I get the indices of the minimum elements in a matrix
> without using
> a loop?
>
> For example, if the matrix is
>
> 4 5 2
> 2 8 9
> 5 2 3
>
> Then I want to output (1,3), (2,1), (3,2).
>
> Thanks,
>
> Annie


mat <- matrix(c(4, 2, 5, 5, 8, 2, 2, 9, 3), 3)

 > mat
      [,1] [,2] [,3]
[1,]    4    5    2
[2,]    2    8    9
[3,]    5    2    3


 > which(mat == min(mat), arr.ind = TRUE)
      row col
[1,]   2   1
[2,]   3   2
[3,]   1   3


See ?which and take note of the arr.ind argument.

HTH,

Marc Schwartz



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

Message: 47
Date: Thu, 10 Sep 2009 12:02:38 -0700
From: annie Zhang <annie.zhang2010 at gmail.com>
Subject: Re: [R] index of min elements in matrix
To: Marc Schwartz <marc_schwartz at me.com>
Cc: r-help at r-project.org
Message-ID:
        <7a5370c90909101202p39144797rf66bd9ea5f39f8f1 at mail.gmail.com>
Content-Type: text/plain

Thanks for all your help. Yes, it's very helpful.

Annie

On Thu, Sep 10, 2009 at 11:42 AM, Marc Schwartz <marc_schwartz at me.com>wrote:

>  On Sep 10, 2009, at 1:34 PM, annie Zhang wrote:
>
> Hi, All,
>>
>> How can I get the indices of the minimum elements in a matrix without
>> using
>> a loop?
>>
>> For example, if the matrix is
>>
>> 4 5 2
>> 2 8 9
>> 5 2 3
>>
>> Then I want to output (1,3), (2,1), (3,2).
>>
>> Thanks,
>>
>> Annie
>>
>
>
> mat <- matrix(c(4, 2, 5, 5, 8, 2, 2, 9, 3), 3)
>
> > mat
>     [,1] [,2] [,3]
> [1,]    4    5    2
> [2,]    2    8    9
> [3,]    5    2    3
>
>
> > which(mat == min(mat), arr.ind = TRUE)
>     row col
> [1,]   2   1
> [2,]   3   2
> [3,]   1   3
>
>
> See ?which and take note of the arr.ind argument.
>
> HTH,
>
> Marc Schwartz
>
>

        [[alternative HTML version deleted]]



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

Message: 48
Date: Thu, 10 Sep 2009 11:23:27 -0700 (PDT)
From: Nandi <nands31 at gmail.com>
Subject: Re: [R] Order a vector and move to new vector
To: r-help at r-project.org
Message-ID:
        <65b45e7f-f13f-4c6c-bd28-0ea43e6c05b3 at l9g2000yqi.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

Try the following:

Data <- read.table('Sample.txt', header=T)
> Data
     ID    UNAV
1  1694  999.89
2  1696  999.90
3  1694  999.87
4  1696  999.88
5  1694  999.84
6  1696  999.86
7  1694  999.82
8  1696  999.84
9  1694  999.79
10 1696  999.82
11 1694  999.71
12 1696  999.75
13 1694  999.69
14 1696  999.73
15 1694  999.66
16 1696  999.71
17 1694  999.64
18 1696  999.69
19 1694  999.61
20 1696  999.67
21 1694  999.54
22 1696  999.70
23 1694  999.51
24 1696 1002.24
25 1694  999.48
26 1696 1012.14
27 1694  999.46
28 1696 1003.38
29 1694  999.43

Then type:
Data_Ordered <- Data[order(Data$ID),]
> Data_Ordered
     ID    UNAV
1  1694  999.89
3  1694  999.87
5  1694  999.84
7  1694  999.82
9  1694  999.79
11 1694  999.71
13 1694  999.69
15 1694  999.66
17 1694  999.64
19 1694  999.61
21 1694  999.54
23 1694  999.51
25 1694  999.48
27 1694  999.46
29 1694  999.43
2  1696  999.90
4  1696  999.88
6  1696  999.86
8  1696  999.84
10 1696  999.82
12 1696  999.75
14 1696  999.73
16 1696  999.71
18 1696  999.69
20 1696  999.67
22 1696  999.70
24 1696 1002.24
26 1696 1012.14
28 1696 1003.38

Not sure if this is what you were looking for.

-Nandi



On Sep 10, 4:06?am, Conrad Addo <conrad.a... at gmail.com> wrote:
> I currently have a data frame with a Fund ID and NAV value. ?Is it possible
> to order the data frame and move to separate columns in a new data frame or
> matrix in R without using a for loop? ?I suppose I'd like to use a built in
> function to make it faster because I will have around 60,000 entries to sort
> and my current program takes too long to do this. ?I know how to use order,
> but is there a way to separate the result and place into new vectors of a
> matrix or data frame?
>
> Thanks
>
> Conrad
>
> Here are my vectors which I import from a csv file:
>
> ?ID UNAV ?#1694 999.89 ?#1696 999.9 ?#1694 999.87 ?#1696 999.88 ?#1694
> 999.84 ?#1696 999.86 ?#1694 999.82 ?#1696 999.84 ?#1694 999.79 ?#1696 999.82
> #1694 999.71 ?#1696 999.75 ?#1694 999.69 ?#1696 999.73 ?#1694 999.66 ?#1696
> 999.71 ?#1694 999.64 ?#1696 999.69 ?#1694 999.61 ?#1696 999.67 ?#1694 999.54
> #1696 999.7 ?#1694 999.51 ?#1696 1002.24 ?#1694 999.48 ?#1696 1012.14 ?#1694
> 999.46 ?#1696 1003.38 ?#1694 999.43
>
> ? ? ? ? [[alternative HTML version deleted]]
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



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

Message: 49
Date: Thu, 10 Sep 2009 12:35:19 -0700 (PDT)
From: Yash Gandhi <yashman84 at yahoo.com>
Subject: [R] function to solve equations
To: r-help at r-project.org
Message-ID: <583664.3171.qm at web55303.mail.re4.yahoo.com>
Content-Type: text/plain; charset=us-ascii

Hi,

I am trying to solve this equation prob = exp(-3.33 + 0.0102*x)/(1+exp(-3.33 + 0.0102*x)). I want to write a function where I call the function and enter the 'prob' value and the output should be the 'x'. Im not sure how to write this. I have a basic structure but im not sure if its correct.

calc <- function(prob){
prob <- exp(-3.33+0.0102*x)/(1+exp(-3.33 + 0.0102*x))
solve(prob)
x
}

Thanks

Yash Gandhi



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

Message: 50
Date: Thu, 10 Sep 2009 19:36:18 +0000 (UTC)
From: Matthieu Dubois <matthdub at gmail.com>
Subject: Re: [R] ggplot2: mixing colour and linetype in geom_line
To: r-help at stat.math.ethz.ch
Message-ID: <loom.20090910T213140-133 at post.gmane.org>
Content-Type: text/plain; charset=us-ascii

Hi Benoit,

I'm not a specialist of ggplot2, but I will try to help.
You may obtain more --interesting-- answers on the ggplot2
mailing list. This said, let's go.

To solve your problem, I would suggest to
1. change the form of the data frame (using the reshape library)
in order to have one variable for Temp, one for the different Xs,
and one for their y values.
2. add a new variable for the different molecules.
3. then plot


# change the format of the data frame
library(reshape)
mdat <- melt(THT_N2_ATGMS, id="Temp")

# add the molecule variable
mdat$mol <- 'other'
mdat$mol[mdat$variable %in% c('X22','X44')] <- 'CO2'
mdat$mol[mdat$variable %in% c('X43','X45')] <- 'AA'

#plot
library(ggplot2)
p <- ggplot(data=mdat, aes(x=Temp, y=value, colour=mol,
                linetype=variable)) +
geom_line()
p

that's it. HTH

Matthieu



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

Message: 51
Date: Thu, 10 Sep 2009 15:48:37 -0400
From: "Ravi Varadhan" <RVaradhan at jhmi.edu>
Subject: Re: [R] function to solve equations
To: "'Yash Gandhi'" <yashman84 at yahoo.com>, <r-help at r-project.org>
Message-ID: <003901ca324f$b00ba9c0$1022fd40$@edu>
Content-Type: text/plain;       charset="us-ascii"

You don't need an equation solver.  This is basic algebra.

The solution is:

X = (log(prob) - log(1 - prob) + 3.33) / 0.0102


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_personal_pages/Varadhan.h
tml



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


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Yash Gandhi
Sent: Thursday, September 10, 2009 3:35 PM
To: r-help at r-project.org
Subject: [R] function to solve equations

Hi,

I am trying to solve this equation prob = exp(-3.33 + 0.0102*x)/(1+exp(-3.33
+ 0.0102*x)). I want to write a function where I call the function and enter
the 'prob' value and the output should be the 'x'. Im not sure how to write
this. I have a basic structure but im not sure if its correct.

calc <- function(prob){
prob <- exp(-3.33+0.0102*x)/(1+exp(-3.33 + 0.0102*x))
solve(prob)
x
}

Thanks

Yash Gandhi

______________________________________________
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: 52
Date: Thu, 10 Sep 2009 16:45:55 -0400
From: "S. Few" <stevefew at gmail.com>
Subject: [R] R 2.9.2 memory max - object vector size
To: r-help at r-project.org
Message-ID:
        <6181d6960909101345u55997a6bna8d7341228ecb2ac at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Me:

Win XP
4 gig ram
R 2.9.2

library(foreign) # to read/write SPSS files
library(doBy) # for summaryBy
library(RODBC)
setwd("C:\\Documents and Settings\\............00909BR")
gc()
memory.limit(size=4000)

##  PROBLEM:

I have memory limit problems. R and otherwise. My dataframes for
merging or subsetting are about 300k to 900k records.
I've had errors such as vector size too large. gc() was done.....reset
workspace, etc.

This fails:

y$pickseq<-with(y,ave(as.numeric(as.Date(timestamp)),id,FUN=seq))

Any clues?

Is this 2.9.2?

Skipping forward, should I download version R 2.8 or less?

Thanks!
Steve



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

Message: 53
Date: Thu, 10 Sep 2009 16:47:04 -0400
From: "S. Few" <stevefew at gmail.com>
Subject: [R] Linux R version: best?
To: r-help at r-project.org
Message-ID:
        <6181d6960909101347s1b8fac15h76ffc10c197a7ff0 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

For my Redhat 5.2 Linux box, which version of R would be most stable?

I am doing forecasting, statistics, etc.


Thanks!

Steve



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

Message: 54
Date: Thu, 10 Sep 2009 17:33:30 -0400
From: Steve Lianoglou <mailinglist.honeypot at gmail.com>
Subject: Re: [R] Linux R version: best?
To: "S. Few" <stevefew at gmail.com>
Cc: r-help at r-project.org
Message-ID: <8C2B28E0-6F14-4A04-BAC8-815C2FC68E21 at gmail.com>
Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes

Hi,

On Sep 10, 2009, at 4:47 PM, S. Few wrote:

> For my Redhat 5.2 Linux box, which version of R would be most stable?
>
> I am doing forecasting, statistics, etc.

I believe the conventional wisdom is to always download the latest
version ... and also, typically, update your current version to the
latest version when it's released.

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



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

Message: 55
Date: Thu, 10 Sep 2009 16:54:50 -0500
From: Marc Schwartz <marc_schwartz at me.com>
Subject: Re: [R] Linux R version: best?
To: Steve Lianoglou <mailinglist.honeypot at gmail.com>
Cc: r-help at r-project.org, "S. Few" <stevefew at gmail.com>
Message-ID: <FB4CAB90-0F96-48F6-A6DA-615349FAF136 at me.com>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

On Sep 10, 2009, at 4:33 PM, Steve Lianoglou wrote:

> Hi,
>
> On Sep 10, 2009, at 4:47 PM, S. Few wrote:
>
>> For my Redhat 5.2 Linux box, which version of R would be most stable?
>>
>> I am doing forecasting, statistics, etc.
>
> I believe the conventional wisdom is to always download the latest
> version ... and also, typically, update your current version to the
> latest version when it's released.

I would just add that the current version available in a binary RPM
for RHEL 5.x on CRAN is 2.9.2 and the current binary RPM available via
the EPEL (https://fedoraproject.org/wiki/EPEL) is 2.9.1. I would
expect to see 2.9.2 on the EPEL soon.

Unlike server operating systems such as RHEL, which have a long multi-
year support window, most applications do not. R's life cycle is such
that support (bug fixes, patches, etc.) for released versions is
essentially limited to the current release. So there are strong
motivations, as Steve noted, to stay up to date as new R versions are
released.

HTH,

Marc Schwartz

P.S. to Steve L, I just noted your e-mail address...LOL



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

Message: 56
Date: Thu, 10 Sep 2009 15:36:25 -0700 (PDT)
From: Roslina Zakaria <zroslina at yahoo.com>
Subject: [R] numerical integration
To: r-help at r-project.org
Message-ID: <424514.8143.qm at web58704.mail.re1.yahoo.com>
Content-Type: text/plain

Hi r-users,
?
Can I do a numerical integration in R to solve for F(z)- integral_0^z {f(t) dt} = 0 where F(z) is the CDF and f(t) is the pdf?? What package can I use?
?
Thank you so much for any help given.





        [[alternative HTML version deleted]]



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

Message: 57
Date: Thu, 10 Sep 2009 15:42:47 -0700
From: Bert Gunter <gunter.berton at gene.com>
Subject: Re: [R] numerical integration
To: "'Roslina Zakaria'" <zroslina at yahoo.com>
Cc: R-help at r-project.org
Message-ID: <29583E07F0084DAE9B38335A2FC934CA at gne.windows.gene.com>
Content-Type: text/plain;       charset="us-ascii"

My goodness! Did you try ?integrate   ?

Bert Gunter
Genentech Nonclinical Biostatistics

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Roslina Zakaria
Sent: Thursday, September 10, 2009 3:36 PM
To: r-help at r-project.org
Subject: [R] numerical integration

Hi r-users,

Can I do a numerical integration in R to solve for F(z)- integral_0^z {f(t)
dt} = 0 where F(z) is the CDF and f(t) is the pdf?  What package can I use?

Thank you so much for any help given.





        [[alternative HTML version deleted]]



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

Message: 58
Date: Thu, 10 Sep 2009 15:55:20 -0700
From: Mark Knecht <markknecht at gmail.com>
Subject: [R] Complex binning?
To: r-help <r-help at r-project.org>
Message-ID:
        <5bdc1c8b0909101555h3154f9a3qf6a063783876119b at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Hi,
   I need to do some binning which to date I've done just writing
subset commands. I'm now wondering if there are any good packages that
have some good pre-designed functions for multi-variable binning using
say 4 or 5 variables, sometimes binning on 3 or more levels of each
variable, and then supporting some sort of reporting mechanism to tell
me how many data points fell into each bin?

   I'm getting sort of tired of writing and debugging long logic equations! :-)

Thanks,
Mark



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

Message: 59
Date: Thu, 10 Sep 2009 19:01:06 -0400
From: Carl Witthoft <carl at witthoft.com>
Subject: Re: [R] "Read.csv" in R with dynamic file (1st) argument
To: "r-help at r-project.org" <r-help at r-project.org>
Message-ID: <4AA98532.8060303 at witthoft.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

That will not work (or at least doesn't work for me.

This does work:

fnam<-'thefilename.csv'  #or build the name however you like
fpath <- 'macintoshhd/users/me/myfolder/  # or whatever you need

read.csv(eval(paste(fpath,fnam,sep=""))  #worked for me


Carl



-----------

Try this:

read.csv(sprintf("D://R//Data//%04d//%04d.csv", x, x), header = TRUE)

On Wed, Sep 9, 2009 at 9:32 PM, Steven Kang <stochastickang at gmail.com>wrote:

 > Dear R users,
 >
 >
 > I have numerous data sets (csv files) saved in the folder which has the
 > same
 > name as individual data.
 > (i.e data x1 saved in x1 folder, data x2 in x2 folder etc)
 >
 > I would like to read in the desired data set name using 'scan'
function and
 > assign this inputted value to an object so that it can be used in the
 > 'read.csv' function.
 >
 > For example,
 >
 > x <- scan()
 > 1: 0708
 > 2:
 > Read 1 item
 >
 > dat <- read.csv("D://R//Data//x//x.csv", head=TRUE, sep = ",")
 > Error in file(file, "r") : cannot open the connection
 > In addition: Warning message:
 > In file(file, "r") :
 >  cannot open file ('D://R//Data//x//x.csv': No such file or directory
 >


--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O



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

Message: 60
Date: Thu, 10 Sep 2009 16:06:27 -0700 (PDT)
From: emorway <emorway at engr.colostate.edu>
Subject: [R]  sppolot: fill below minimum legend value
To: r-help at r-project.org
Message-ID: <25392472.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


In the plot below, there are some grid cells that have values below 10, which
is the lowest "cut" value I have specified.  Is there a way, without
adjusting the number of cuts, to tell R to fill in those cells with the
lowest possible color (in this case greeen)?  There is a white "hole" in the
image about a quarter of the way in from the left side, this is what I would
like to correct.  Thanks...Eric

The code:
pts<-list("sp.points",K.dat,pch=3,col="black")
cuts<-c(10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900,1000)
spplot(lzm.krige.dir["var1.pred"],at=cuts,colorkey=list(at=log10(cuts),at=log10(cuts),labels=as.character(cuts)),scales=list(draw=TRUE),
xlab="Easting",ylab="Northing",key.space="right",cex=1.1,col.regions=terrain.colors(30),main="Hydraulic
Conductivity of Layer 2",sp.layout=list(pts))

The image:
http://www.nabble.com/file/p25392472/Image3.jpeg
--
View this message in context: http://www.nabble.com/sppolot%3A-fill-below-minimum-legend-value-tp25392472p25392472.html
Sent from the R help mailing list archive at Nabble.com.



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

Message: 61
Date: Thu, 10 Sep 2009 16:22:33 -0700
From: Bert Gunter <gunter.berton at gene.com>
Subject: Re: [R] Complex binning?
To: "'Mark Knecht'" <markknecht at gmail.com>, <R-help at r-project.org>
Message-ID: <39B3CF34AD564AC0905DC365242CEE49 at gne.windows.gene.com>
Content-Type: text/plain;       charset="us-ascii"

packages:

plyr
reshape  (the package, not the base R function)

There may well be others...

Bert Gunter
Genentech Nonclinical Biostatistics

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Mark Knecht
Sent: Thursday, September 10, 2009 3:55 PM
To: r-help
Subject: [R] Complex binning?

Hi,
   I need to do some binning which to date I've done just writing
subset commands. I'm now wondering if there are any good packages that
have some good pre-designed functions for multi-variable binning using
say 4 or 5 variables, sometimes binning on 3 or more levels of each
variable, and then supporting some sort of reporting mechanism to tell
me how many data points fell into each bin?

[[elided Yahoo spam]]
:-)

Thanks,
Mark

______________________________________________
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: 62
Date: Thu, 10 Sep 2009 16:23:32 -0700
From: "William Dunlap" <wdunlap at tibco.com>
Subject: Re: [R] R 2.9.2 memory max - object vector size
To: "S. Few" <stevefew at gmail.com>, <r-help at r-project.org>
Message-ID:
        <77EB52C6DD32BA4D87471DCD70C8D70001C23D60 at NA-PA-VBE03.na.tibco.com>
Content-Type: text/plain;       charset="us-ascii"


> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of S. Few
> Sent: Thursday, September 10, 2009 1:46 PM
> To: r-help at r-project.org
> Subject: [R] R 2.9.2 memory max - object vector size
>
> Me:
>
> Win XP
> 4 gig ram
> R 2.9.2
>
> library(foreign) # to read/write SPSS files
> library(doBy) # for summaryBy
> library(RODBC)
> setwd("C:\\Documents and Settings\\............00909BR")
> gc()
> memory.limit(size=4000)
>
> ##  PROBLEM:
>
> I have memory limit problems. R and otherwise. My dataframes for
> merging or subsetting are about 300k to 900k records.
> I've had errors such as vector size too large. gc() was done.....reset
> workspace, etc.
>
> This fails:
>
> y$pickseq<-with(y,ave(as.numeric(as.Date(timestamp)),id,FUN=seq))

If any values in id are singletons then the call to
seq(timestamp[id=="singleton"])
returns a vector whose length is timestamp[id=="singleton"] (not the
length
of that, the value of that).  as.numeric(as.Date("2009-09-10")) is 14497
so you
might have a lot of 14497-long vectors being created (and thrown away,
unused
except for their initial value).  Using seq_along instead of seq would
take
care of that potential problem.  E.g.,
   > d1<-data.frame(x=c(2,3,5e9,4,5),id=c("A","B","B","B","A"))
   > d2<-data.frame(x=c(2,3,5e9,4,5),id=c("A","B","C","B","A"))
   > # d1$id has no singletons, d2$id does where d2$x is huge
   > with(d1, ave(x,id,FUN=seq))
   [1] 1 1 2 3 2
   > with(d2, ave(x,id,FUN=seq))
   Error in 1L:from : result would be too long a vector
   > with(d2, ave(x,id,FUN=seq_along))
   [1] 1 1 1 2 2

If your intent is to create a vector of within-group sequence numbers
then there are more efficient ways to do it.  E.g., with the following
functions
   withinGroupSeq <- function(x){
      x <- as.factor(x)
      retval <- integer(length(x))
      retval[order(as.integer(x))] <- Sequence(table(x))
      retval
   }
   # Sequence is like base::sequence but should use less memory
   # by avoiding the list that sequence's lapply call makes.
   Sequence <- function(nvec) {
      seq_len(sum(nvec)) - rep(cumsum(c(0L,nvec[-length(nvec)])), nvec)
   }
you can get the same result as ave(FUN=seq_along) in less time and,
I suspect, less memory
   > withinGroupSeq(d1$id)
   [1] 1 1 2 3 2
   > withinGroupSeq(d2$id)
   [1] 1 1 1 2 2

Base R may have a function for that already.

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com


>
> Any clues?
>
> Is this 2.9.2?
>
> Skipping forward, should I download version R 2.8 or less?
>
> 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.
>



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

Message: 63
Date: Fri, 11 Sep 2009 09:30:28 +1000
From: Steven Kang <stochastickang at gmail.com>
Subject: Re: [R] "Read.csv" in R with dynamic file (1st) argument
To: Carl Witthoft <carl at witthoft.com>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
        <e3b544e90909101630k2ba35111x96c917c569187837 at mail.gmail.com>
Content-Type: text/plain

Oh strange, as it worked for me..

[[elided Yahoo spam]]

On Fri, Sep 11, 2009 at 9:01 AM, Carl Witthoft <carl at witthoft.com> wrote:

> That will not work (or at least doesn't work for me.
>
> This does work:
>
> fnam<-'thefilename.csv'  #or build the name however you like
> fpath <- 'macintoshhd/users/me/myfolder/  # or whatever you need
>
> read.csv(eval(paste(fpath,fnam,sep=""))  #worked for me
>
>
> Carl
>
>
>
> -----------
>
> Try this:
>
> read.csv(sprintf("D://R//Data//%04d//%04d.csv", x, x), header = TRUE)
>
> On Wed, Sep 9, 2009 at 9:32 PM, Steven Kang <stochastickang at gmail.com
> >wrote:
>
> > Dear R users,
> >
> >
> > I have numerous data sets (csv files) saved in the folder which has the
> > same
> > name as individual data.
> > (i.e data x1 saved in x1 folder, data x2 in x2 folder etc)
> >
> > I would like to read in the desired data set name using 'scan' function
> and
> > assign this inputted value to an object so that it can be used in the
> > 'read.csv' function.
> >
> > For example,
> >
> > x <- scan()
> > 1: 0708
> > 2:
> > Read 1 item
> >
> > dat <- read.csv("D://R//Data//x//x.csv", head=TRUE, sep = ",")
> > Error in file(file, "r") : cannot open the connection
> > In addition: Warning message:
> > In file(file, "r") :
> >  cannot open file ('D://R//Data//x//x.csv': No such file or directory
> >
>
>
>  --
> Henrique Dallazuanna
> Curitiba-Paran?-Brasil
> 25? 25' 40" S 49? 16' 22" O
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]



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

Message: 64
Date: Thu, 10 Sep 2009 17:16:58 -0700
From: Mark Knecht <markknecht at gmail.com>
Subject: Re: [R] Complex binning?
To: Bert Gunter <gunter.berton at gene.com>
Cc: R-help at r-project.org
Message-ID:
        <5bdc1c8b0909101716j213be8c6scf57ba5773df3efe at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Thanks Bert,
   I've used reshape a bit but hadn't considered it for this need.
plyr is new to me so I'll check it out.

   I think the hard part in my case is designing the bins. I have some
continuous signals for which I don't know how many bins I want to
break each into. I'd like to be able to sort of on the fly chose 4, 5,
6 or 7 different values and get bins between each consecutive value,
and also above and below. I'll look at the plyr docs to see if it can
do that.

Thanks again,
Mark

On Thu, Sep 10, 2009 at 4:22 PM, Bert Gunter <gunter.berton at gene.com> wrote:
> packages:
>
> plyr
> reshape ?(the package, not the base R function)
>
> There may well be others...
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of Mark Knecht
> Sent: Thursday, September 10, 2009 3:55 PM
> To: r-help
> Subject: [R] Complex binning?
>
> Hi,
> ? I need to do some binning which to date I've done just writing
> subset commands. I'm now wondering if there are any good packages that
> have some good pre-designed functions for multi-variable binning using
> say 4 or 5 variables, sometimes binning on 3 or more levels of each
> variable, and then supporting some sort of reporting mechanism to tell
> me how many data points fell into each bin?
>
> ? I'm getting sort of tired of writing and debugging long logic equations!
> :-)
>
> Thanks,
> Mark
>
> ______________________________________________
> 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: 65
Date: Fri, 11 Sep 2009 04:54:53 +0430
From: oleg portnoy <oleg.portnoy75 at gmail.com>
Subject: [R] memory limit problem
To: r-help at r-project.org
Message-ID:
        <279f1a570909101724q29d6e66u4bd11817994f231c at mail.gmail.com>
Content-Type: text/plain

Hi,
I have Win XP 32, 4 gig DDR2 and R 2.9.2.
I have memory limit problems.
> memory.limit(4090)
[1] 4090

> memory.limit()
[1] 4090
> a<-trans.matrix.f(7)  # made big matrix of integer 16384*16384
Error: cannot allocate vector of size 512.0 Mb
I not have other objects in R memory.
what I do?
trans.matrix.f <- function(x){
 tr.mat <- matrix(c(0,1,1,0),2)
 for(i in 2:(2*x))
  tr.mat <- rbind(cbind(tr.mat ,tr.mat+1),
  cbind(tr.mat+1,tr.mat ))
 return(tr.mat)
}

Thanks!
Oleg.

        [[alternative HTML version deleted]]



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

Message: 66
Date: Thu, 10 Sep 2009 22:02:08 -0400
From: Steve Lianoglou <mailinglist.honeypot at gmail.com>
Subject: Re: [R] memory limit problem
To: oleg portnoy <oleg.portnoy75 at gmail.com>
Cc: r-help at r-project.org
Message-ID:
        <bbdc7ed00909101902p1f1470ack151f73f70776f026 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi,

On Thu, Sep 10, 2009 at 8:24 PM, oleg portnoy<oleg.portnoy75 at gmail.com> wrote:
> Hi,
> I have Win XP 32, 4 gig DDR2 and R 2.9.2.
> I have memory limit problems.
>> memory.limit(4090)
> [1] 4090
>
>> memory.limit()
> [1] 4090
>> a<-trans.matrix.f(7)  # made big matrix of integer 16384*16384
> Error: cannot allocate vector of size 512.0 Mb
> I not have other objects in R memory.
> what I do?


http://thread.gmane.org/gmane.comp.lang.r.general/64637

Or maybe the bigmemory package can help?
http://cran.r-project.org/web/packages/bigmemory/

-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



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

Message: 67
Date: Thu, 10 Sep 2009 13:26:08 -0700 (PDT)
From: MarcioRibeiro <mestat at pop.com.br>
Subject: [R]  Bootstrap simulation
To: r-help at r-project.org
Message-ID: <25390390.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Hi listers,
I would like a suggestion. I am working on a bootstrap simulation which I am
calculation the confidence intervals to obtain the coverage probability. I
am applying 3 kind of confidence intervals and 3 coverage probabilities (2
sided, left 5% and left 95%).
I programmed a function for that, but my function is getting to long,
because I am calculating many statistics (mean, median, quantile...). So,
for each statistic I have 9 comands to obtain my results, so for 3
statistics I will get 27 comands... I am searching for a optimal way to
reduce the quantity of formulas... Is that clear... Any suggestions...
BThanks in advance,
Marcio

--
View this message in context: http://www.nabble.com/Bootstrap-simulation-tp25390390p25390390.html
Sent from the R help mailing list archive at Nabble.com.



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

Message: 68
Date: Thu, 10 Sep 2009 15:11:18 -0700 (PDT)
From: jrflanders <jrflanders at gmail.com>
Subject: [R]  Exporting the formula for a LOESS fit
To: r-help at r-project.org
Message-ID: <25391878.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


I'm at my wit's end, and have searched all of my sources. I need to generate
a relatively large number of individual LOESS fits each month of data (I
have about 16 months of data). Fitting the polynomial is not my problem,
figuring out what the formula that describes that polynomial is. apologies
in advance if this is so simple, but I need a hand here. Thanks.
--
View this message in context: http://www.nabble.com/Exporting-the-formula-for-a-LOESS-fit-tp25391878p25391878.html
Sent from the R help mailing list archive at Nabble.com.



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

Message: 69
Date: Fri, 11 Sep 2009 14:45:29 +1200
From: "Peter Alspach" <Peter.Alspach at plantandfood.co.nz>
Subject: Re: [R] Exporting the formula for a LOESS fit
To: "jrflanders" <jrflanders at gmail.com>, <r-help at r-project.org>
Message-ID:
        <EC0F8FF776F3F74E9C63CE16641C962803EFB68F at AKLEXB02.hort.net.nz>
Content-Type: text/plain;       charset="US-ASCII"

Tena koe

Loess uses local fitting: "Fitting is done locally.  That is, for the
fit at point x, the fit is made using points in a neighbourhood of x,
weighted by their distance from x" (from the help).  That is, there is
no single formula to describe the fit.

HTH ....

Peter Alspach

> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of jrflanders
> Sent: Friday, 11 September 2009 10:11 a.m.
> To: r-help at r-project.org
> Subject: [R] Exporting the formula for a LOESS fit
>
>
> I'm at my wit's end, and have searched all of my sources. I
> need to generate a relatively large number of individual
> LOESS fits each month of data (I have about 16 months of
> data). Fitting the polynomial is not my problem, figuring out
> what the formula that describes that polynomial is. apologies
> in advance if this is so simple, but I need a hand here. Thanks.
> --
> View this message in context:
> http://www.nabble.com/Exporting-the-formula-for-a-LOESS-fit-tp
> 25391878p25391878.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.
>



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

Message: 70
Date: Thu, 10 Sep 2009 19:58:26 -0700
From: Don MacQueen <macq at llnl.gov>
Subject: Re: [R] "Read.csv" in R with dynamic file (1st) argument
To: Carl Witthoft <carl at witthoft.com>,  "r-help at r-project.org"
        <r-help at r-project.org>
Message-ID: <p06240801c6cf6a121d7b@[75.208.138.28]>
Content-Type: text/plain; charset="iso-8859-1" ; format="flowed"

Alternatives to sprintf() include formatC() or
prettyNum(), which would have to be used in
combination with paste().

In Carl's solution, the file.path() function
should be considered, since it automatically uses
the correct path separators for the OS.
Furthermore,  eval() is not necessary.

So, for example,

>  x <- formatC(scan(),width=4,flag='0')
1: 23
2:
Read 1 item
>  x
[1] "0023"

root.dir <- 'D:\R\Data'

read.csv(
file.path(root.dir,x,paste(x,'.csv',sep='')))  ##
those are all single quotes

This isn't necessarily better than the sprintf()
version, just different, and shows some
additional useful functions(). This way of using
formatC() requires that the user input only
numbers:

>  x <- formatC(scan(),width=4,flag='0')
1: jk
1:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
   scan() expected 'a real', got 'jk'

I don't know what sprintf() would do with such input.

-Don

At 7:01 PM -0400 9/10/09, Carl Witthoft wrote:
>That will not work (or at least doesn't work for me.
>
>This does work:
>
>fnam<-'thefilename.csv'  #or build the name however you like
>fpath <- 'macintoshhd/users/me/myfolder/  # or whatever you need
>
>read.csv(eval(paste(fpath,fnam,sep=""))  #worked for me
>
>
>Carl
>
>
>
>-----------
>
>Try this:
>
>read.csv(sprintf("D://R//Data//%04d//%04d.csv", x, x), header = TRUE)
>
>On Wed, Sep 9, 2009 at 9:32 PM, Steven Kang <stochastickang at gmail.com>wrote:
>
>>  Dear R users,
>>
>>
>>  I have numerous data sets (csv files) saved in the folder which has the
>>  same
>>  name as individual data.
>>  (i.e data x1 saved in x1 folder, data x2 in x2 folder etc)
>>
>>  I would like to read in the desired data set name using 'scan' function and
>>  assign this inputted value to an object so that it can be used in the
>>  'read.csv' function.
>>
>>  For example,
>>
>>  x <- scan()
>>  1: 0708
>>  2:
>>  Read 1 item
>>
>>  dat <- read.csv("D://R//Data//x//x.csv", head=TRUE, sep = ",")
>>  Error in file(file, "r") : cannot open the connection
>>  In addition: Warning message:
>>  In file(file, "r") :
>>   cannot open file ('D://R//Data//x//x.csv': No such file or directory
>>
>
>
>--
>Henrique Dallazuanna
>Curitiba-Paran?-Brasil
>25? 25' 40" S 49? 16' 22" O
>
>______________________________________________
>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.


--
---------------------------------
Don MacQueen
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
macq at llnl.gov



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

Message: 71
Date: Thu, 10 Sep 2009 23:40:44 -0400
From: Richard Anderson <Richard.Anderson at duke.edu>
Subject: [R] fitting stated preference econometric data using
        multinomial logit in R
To: r-help at R-project.org
Message-ID: <4AA9C6BC.1050701 at duke.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

Does anyone know anything about using R to fit stated preference
econometric data using multinomial logit?  I am not sure that standard
VGLM/VGAM can handle this, or if it does, how.  This data is different
than more typical revealed preference data in that it is recorded as in
the following excerpt, for a 3 attribute problem with 3 levels in which
the respondent chooses (CHOICE) 1 of 4 alternatives:

ID CHOICE DEAD10 DEAD5 LIVE153 LIVE459  TAX
15      0      0     0       0       1   60
15      0      0     0       0       0  400
15      1      0     1       0       0 1600
15      0      1     0       0       1   60
29      0      0     0       1       0 1600
29      0      0     0       1       0   80
29      0      0     0       1       0  120
29      1      1     0       0       1   80
etc.

thanks in advance...

richard anderson

--


Richard M. Anderson, Assistant Professor
Duke University, Nicholas School of the Environment
A321 LSRC
Box 90328
Durham, NC 27708
919.613.8130 (v), 919.684.8741 (f)
Richard.Anderson at duke.edu



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

Message: 72
Date: Fri, 11 Sep 2009 16:09:25 +1200
From: Paul Murrell <p.murrell at auckland.ac.nz>
Subject: Re: [R] eps file with embedded font
To: "ted.harding at manchester.ac.uk" <ted.harding at manchester.ac.uk>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID: <4AA9CD75.1000408 at auckland.ac.nz>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi

My suggested code had dropped the ...

  format="epswrite"

... and if you put that back, then the /setpagesize command is removed.

Does that improve things in your test cases?

Paul


Ted Harding wrote:
> Thanks, Paul.
> In fact I had been hoping to lure you to the surface, from the
> 12740-km ocean depths which you inhabit, during our hours of
> darkness!
>
> Your suggested modification of the "options" in the embedFonts
> command indeed produces an EPS file which displays without clipping.
>
> However, when these files are imported into a PS document using
> 'groff', the "blanking" problem described at the end of my included
> orifginal posting (below) persisted.
>
> So I posted a summary of the problem to the 'groff' mailing-list.
> This can be found in the thread
>   [Groff] EPS importing problem, Ted Harding, 2009/09/09
> at
>   http://lists.gnu.org/archive/html/groff/2009-09/threads.html
>
> There is a reply by Tadziu Hoffmann:
>
>   > Attached are two EPS files:
>   >
>   >   test1.eps
>   >   test1-EMB2.eps
>   >
>   [snip]
>
>   File "test1-EMB2.eps"[*] contains a call to "setpagedevice"
>   (through "setpagesize"), which is a bin no-no for EPS files.
>   Does the problem still occur If you delete the line that says
>   "720 360 /letter setpagesize"?
>
> [*] which was generated by your modified "embedFonts()"
>
> and, as my reply confirms, commenting-out that line resolved the
> problem (though there a minor issue that the BoundingBox is not
> what is really wanted, but that can be resolved by editing the
> EPS file). I'm not sure where the insertion of the call to
> "setpagedevice" arose from, but I think it is down to 'gs'.
>
> There was a much longer private reply from a Robert Herrmann,
> which I shall send you privately since it may be of interest,
> along with the PS filoe I got after implementing Tadziu Hoffmann.
>
> Meanwhile, those who are interested by the issues arising in this
> thread, raised by Simone Gabbriellini, may find the above useful.
>
> Ted.
>
> On 08-Sep-09 23:51:27, Paul Murrell wrote:
>> Hi
>> Thanks for the further analysis on this Ted.  I think the problem is
>> that, with such a "wide" plot, you are running into the default paper
>> size.  If you look at the EPS produced by ghostscript, you will see a
>> line like this ...
>>
>> 612 792 /letter setpagesize
>>
>> ... and notice that the value 612 corresponds to the unexpected right
>> hand clipping margin.  So a possible solution is to specify a paper
>> size
>> or, more generally, a device size, that is larger (especially wider)
>> than the original plot.  Here's an example for this particular case ...
>>
>> embedFonts(file="test1.eps",
>>             outfile="test1-EMB.eps",
>>             options="-dDEVICEWIDTHPOINTS=720 -dDEVICEHEIGHTPOINTS=360")
>>
>> Now, rather than clipping the output to the default paper size, the
>> result is clipped to the edges of the plot.
>>
>> Hope that helps.
>>
>> Paul
>>
>> p.s.  Another useful tip that helps in these situations is to get
>> ghostscript to just calculate a bounding box for your plot.  For
>> example ...
>>
>>  > gs -dNOPAUSE -dBATCH -q -sDEVICE=bbox test1.eps
>> %%BoundingBox: 4 18 691 336
>> %%HiResBoundingBox: 4.968000 18.719999 690.134885 335.214341
>>
>> ... which shows that ghostscript can produce the right bounding box, if
>> it ignores the default paper size for output.
>>
>>
>> Ted Harding wrote:
>>> I am going back to Simone's original query (though this will
>>> split the thread) because subsequent replies did not include
>>> his original. Some comments interspersed below; the main
>>> response at the end.
>>>
>>> I have had some private correspondence with Simone, who sent me
>>> two of his files that exhibit the problem, and this has enabled
>>> me to form an idea of where the trouble may lie. It would seem
>>> that either there is something seriously wrong with the function
>>> embedFonts(), or with ghostscript when executing the command
>>> generated by embedFonts(), or with both. I shal descibe the results
>>> of my esperminets, in the hope that some expert in embedFonts(),
>>> or in ghostscript, or in both, can make a useful suggestion.
>>>
>>> On 04-Sep-09 14:01:44, Simone Gabbriellini wrote:
>>>> Dear list,
>>>> I am trying to make eps file with embedded font.
>>>> I use:
>>>>
>>>> postscript("ranking-exp-all.eps", horizontal=TRUE, onefile=FALSE,
>>>>            paper="special", height=8, width=12, family="Helvetica")
>>>> # plot stuff
>>>> dev.off()
>>>>
>>>> since R does not embed font, I then use:
>>>>
>>>> embedFonts(file="indegdistr.eps", outfile="indegdistrEMB.eps",
>>>>            fontpaths="System/Library/Fonts")
>>> I think Simone intended to use a different filename here, probably
>>>
>>>   embedFonts(file="ranking-exp-all.eps",
>>>              outfile="ranking-exp-all-EMB.eps",
>>>              fontpaths="System/Library/Fonts")
>>>
>>> in line with his previous command above. This is not important here.
>>>
>>>> the problem is that the second file, with font embedded, is cutted
>>>> near the end, and the very last part of the plots and the border are
>>>> off the page...
>>> In fact the bottom of the graphic is slightly clipped when viewed
>>> in ghostview, and the righthand side is severely clipped.
>>>
>>>> I use R 2.8.1 on a Mac OSX
>>>> any help more than welcome,
>>>> regards,
>>>> Simone
>>> Ths problem Simone encountered can be reproduced in a simple way
>>> as follows.
>>>
>>>   postscript(file="test1.eps",family="Times",horizontal=FALSE,
>>>              paper="special",width=10,height=5)
>>>   plot(c(0,1,2),c(0,1,4),main="Test Plot",xlab="X",ylab="Y")
>>>   dev.off()
>>>
>>> If I view this file "test1.eps" in ghostsript (using 'gv', on Linux),
>>> I see it fine. There is a nice clearance all round (about 24 points
>>> above the "Test Plot" title, about 6 points to the left of the
>>> "Y" y-axis label, about 30 points below the "X" x-axis label,
>>> and about 30 points to the right of the plot frame.
>>>
>>> The BoundingBox line in test1.eps is
>>>   %%BoundingBox: 0 0 720 360
>>> so it is indeed 10 inches wide and 5 inches high, as requested.
>>> So far, so good.
>>>
>>> Now I do the equivalent of Simone's embedFonts() command:
>>>
>>>   embedFonts(file="test1.eps",format="pswrite",
>>>              outfile="test1-EMB.eps")
>>>
>>> and view the result of this in 'gv'. The left, top and bottom of
>>> the plot just fit in (there is a miniscule space left around them),
>>> but the right-hand side of the plot is severely cropped. Instead
>>> of seeing the x-axis out to 2.0, with the right-hand side of the
>>> frame, and a little bit of space, it is truncated around x = 1.75
>>>
>>> The BoundingBox in "test1-EMB.eps" is specified in the lines:
>>>   %%BoundingBox: 4 18 595 336
>>>   %%HiResBoundingBox: 4.600000 18.700000 595.000000 335.300000
>>> so the BBox 0 0 720 360 from test1.eps has been slightly trimmed
>>> on the left, substantially (18 points) from below and (14 points)
>>> from above, and hugely (125 points = 1.74 inches) from the right.
>>>
>>> The lesser trimmings on the left, bottom and top can be put down,
>>> perhaps, to ghostscript putting the BoundingBox just outside the
>>> marks on the page; but *not* the bad cropping of the right-hand
>>> side, since marks which ought to be included are way outside it.
>>>
>>> Next I tried editing a copy test1B-EMB.eps of test1-EMB.eps, to
>>> change the BoundingBox to what it ought to be (0 0 720,360).
>>> The ghostscript window now encloises the full BoundingBox, but
>>> the righthand part is blank (only what can be seen in test1-EMB.eps
>>> is shown, i.e. up to x = 1.75 approx, with what should be seen
>>> beyond this being totally blank).
>>>
>>> It follows that, despite the BoundingBox now being the correct
>>> one (and of course the BBox is a clipping-path for display in gv),
>>> there is additional clipping being done in the PostScript generate
>>> by ghostscript as a result of embedFonts().
>>>
>>> Looking into the PostScript in test1-EMB.eps (or test1B-EMB.eps),
>>> there are several occurrenfces of "clip" therein. However, the
>>> additional PostScript generated by ghostscript is very obscure,
>>> and I cannot decipher what is going on.
>>>
>>> It next occurred to me that one may be able to add ghostsctript
>>> options to the call to embedFonts(), to try to ensure that it
>>> would respect the original BoundingBox. The command generated by
>>>   embedFonts(file="test1.eps",format="pswrite",
>>>              outfile="test1-EMB.eps")
>>> is:
>>>
>>>   gs -dNOPAUSE -dBATCH -q -dAutoRotatePages=/None -sDEVICE=pswrite \
>>>   -sOutputFile=/tmp/RtmplPWs8l/Rembed24b931bd -sFONTPATH=  test1.eps
>>>
>>> A quick study of the ghostscript documentation revealed the existence
>>> of some "EPS Parameters", of which the only one that seemed relevant
>>> was:
>>>
>>>   -dEPSCrop
>>>       Crop an EPS file to the bounding box. This is useful when
>>>       converting an EPS file to a bitmap.
>>>
>>> Bitmap or no, "cropping to the bounding box" looks like just the
>>> thing to do, provided the "bounding box" in question is the one
>>> which was in the roiginal EPS file. So I now tried
>>>
>>>   embedFonts(file="test1.eps",format="pswrite",options="-dEPSCrop",
>>>              outfile="test1C-EMB.eps")
>>>
>>> When viewed in gv, this now show exactly the same as with
>>> test1-EMB.eps:
>>> the visible window is cropped on the right at x = 1.75 approx, as
>>> before.
>>> And the BoundingBox in test1C-EMB.eps is
>>>
>>>   %%BoundingBox: 4 18 595 336
>>>   %%HiResBoundingBox: 4.600000 18.700000 595.000000 335.300000
>>>
>>> exactly as before. So the "-dEPSCrop" option has changed nothing.
>>> The "gs" command generated by the above EmbedFonts() command was
>>>
>>>   gs -dNOPAUSE -dBATCH -q -dAutoRotatePages=/None -sDEVICE=pswrite \
>>>   -sOutputFile=/tmp/RtmplPWs8l/Rembed48a664b0 -sFONTPATH= -dEPSCrop \
>>>   test1.eps
>>>
>>> so the option was indeed there. Hence I deduce that the "bounding
>>> box" to which "-dEPSCrop" crops the result is not the original
>>> BoundingBox, but the spurious one generate by 'gs' itself when
>>> run under the control of embedFonts().
>>>
>>> Finally -- and this strikes me as really bizarre -- I was wondering
>>> if using ghostview to view the result was causing the viewing
>>> problem even when (with the file test1B-EMB.eps) the BoundingBox
>>> had been edited so as to be the correct one.
>>>
>>> So I decided to try printing to paper on a printer with built-in
>>> PostScript capability (HP LaserJet 1300).
>>>
>>> First, I imported the original test1,eps (pre-embedFonts) into a
>>> PostScript document "testembed.ps" created by groff, with source file
>>> containing
>>>
>>> .PSPIC test1.eps 4i
>>>
>>> which should produce a rendering of the graphic, centred, and 4 inches
>>> wide. Indeed it does, both when viewed using 'gv', and when printed
>>> to paper.
>>>
>>> Next, I additionally the included the result test1-EMB.eps of the very
>>> first invocation of embedFonts(), exactly as output and with no
>>> messing
>>> about, so that the groff source file was now:
>>>
>>> .PSPIC test1.eps 4i
>>> .sp 2
>>> .PSPIC test1-EMB.eps 4i
>>>
>>> which should produce a rendering of test1.eps, centred and 4 inches
>>> wide as before, followed by a double line space, followed by a
>>> similar rendering of test1-EMB.eps 4i centred and four inches wide.
>>>
>>> When viewed in 'gv', there is a brief glimpse of test1.eps
>>> followd by an even briefer glimpse of test1-EMB.eps (while the
>>> first is still showing -- you have to be very quick to see these),
>>> and then the whole 'gv' window goes blank.
>>>
>>> The glimpse of test1-EMB.eps is on a much larger scale (not 4 inches
>>> wide as it should be) than the glimpse of test1.eps (while it lasts).
>>> And it appears much further down the page than it should.
>>>
>>> Finally, printing the resulting PS file to paper produces a blank
>>> sheet -- no marks on it at all.
>>>
>>> So something really weird is going on.
>>>
>>> As a final comment: comparing the PostScript in test1.eps and
>>> test1-EMB.eps, I see that the entire Prologue (66 lines of PostScript
>>> code between "%%BeginProlog" and "%%EndProlog") present in test1.eps
>>> has been replaced by 47 lines created by ghostscript which bear no
>>> visible resemblance to the original. So I wonder what has happened
>>> to all the PS definitions planted by R in test1.eps, for use when
>>> it gets down to rendering the graphic.
>>>
>>> I've gone into this at length (and sorry for the length), hoping
>>> to evoke comment or analysis (of the results of my R commands above)
>>> from people who know their way round this stuff. I have to confess
>>> that, when it came to trying to work out what was going on in the
>>> "embedded" file test1-EMB.eps, I found myself totally out of my
>>> depth!
>>>
>>> With thanks,
>>> Ted.
>>> (And also on behalf of Simone Gabriellini)
>>>
>>> --------------------------------------------------------------------
>>> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
>>> Fax-to-email: +44 (0)870 094 0861
>>> Date: 06-Sep-09                                       Time: 20:45:18
>>> ------------------------------ XFMail ------------------------------
>>>
>>> ______________________________________________
>>> 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.
>> --
>> Dr Paul Murrell
>> Department of Statistics
>> The University of Auckland
>> Private Bag 92019
>> Auckland
>> New Zealand
>> 64 9 3737599 x85392
>> paul at stat.auckland.ac.nz
>> http://www.stat.auckland.ac.nz/~paul/
>>
>> ______________________________________________
>> 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.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 09-Sep-09                                       Time: 19:40:47
> ------------------------------ XFMail ------------------------------

--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



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

Message: 73
Date: Fri, 11 Sep 2009 06:12:49 +0200
From: Johannes Huesing <johannes at huesing.name>
Subject: Re: [R] Best R text editors?
To: r-help at r-project.org
Message-ID: <20090911041249.GA6520 at huesing.name>
Content-Type: text/plain; charset=utf-8

Martin Maechler <maechler at stat.math.ethz.ch> [Wed, Sep 02, 2009 at 09:17:42AM CEST]:
> >>>>> "PaCo" == p connolly <p_connolly at slingshot.co.nz>
> >>>>>     on Wed, 02 Sep 2009 12:19:31 +1200 writes:
>
>     PaCo> On Mon, 31-Aug-2009 at 08:25PM +1000, Jim Lemon wrote:
>     PaCo> [...]
[...]
>     PaCo> |> Emacs still
>     PaCo> |> has that annoying trait of being determinedly incompatible with anything
>     PaCo> |> else, even if the conventions are quite sensible.

A lot of the keystrokes are the same as when you are using the bash.

[...]
>
> well, actually, since Emacs 23, in its 'Options' Menu there's
> now a check-box entry
>
>     " C-x/C-c/C-v Cut and Paste (CUA) "
>
> ((which still is "off" by default ;-))

and in previous versions, you could always do M-x cua-mode for
the same effect. Talk about a well-hidden function mostly directed
at beginners ...


--
Johannes H?sing               There is something fascinating about science.
                              One gets such wholesale returns of conjecture
mailto:johannes at huesing.name  from such a trifling investment of fact.
http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")



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

Message: 74
Date: Fri, 11 Sep 2009 15:52:27 +1000
From: Steven Kang <stochastickang at gmail.com>
Subject: [R] Accumulating results from "for" loop in a list/array
To: r-help at r-project.org
Message-ID:
        <e3b544e90909102252u36b19b40vb18a47b58c89d234 at mail.gmail.com>
Content-Type: text/plain

Dear R users,


I would like to accumulate objects generated from 'for' loop to a list or
array.

To illustrate the problem, arbitrary data set and script is shown below,


x <- data.frame(a = c(rep("n",3),rep("y",2),rep("n",3),rep("y",2)), b =
c(rep("y",2),rep("n",4),rep("y",3),"n"), c = c(rep("n",7),rep("y",3)), d =
c("y", rep("n",4), rep("y",2), rep("n",3)))

for (i in 1:(dim(x)[2]))  {
         assign(paste("ind", i, sep = ""), which(x[ , i] == "y"))
          accum <- c(ind1, ind2, ind3, ind4)
}

> ind1
[1]  4  5  9 10
> ind2
[1] 1 2 7 8 9
> ind3
[1]  8  9 10
> ind4
[1] 1 6 7
> accum
 [1]  4  5  9 10  1  2  7  8  9  8  9 10  1  6  7

Are there any alternative method where the highlighted statement above can
be represented without typing individual objects manually? (as it can be
very tedious with large number of objects; i.e ind1, ind2, ....., ind100)

Also, is there any way to extract individual objects ('ind1' etc) from
'accum'?

> accum[1:length(ind1)]
[1]  4  5  9 10
gives 'ind1', but this may become messy for other objects (like 'ind10')


Highly appreciate for sharing your expertise in solving this problem.

        [[alternative HTML version deleted]]



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

Message: 75
Date: Fri, 11 Sep 2009 06:12:40 +0000 (GMT)
From: Robert U <tacsunday at yahoo.fr>
Subject: [R] problem formula (newbe)
To: r-help at r-project.org
Message-ID: <892994.73852.qm at web28511.mail.ukl.yahoo.com>
Content-Type: text/plain





Dear R-users,

??

I am trying to run a function of the package ???adabag??? (e.g. boosting.cv)
in order to determine a proper number of cluster that I would specify later on
my KMeans clustering.

(I had this idea from: http://www.statsoft.com/TEXTBOOK/stcluan.html)


??

However, I do have a problem with the ???formula??? parameter of
e.g. boosting.cv : I am not familiar with these formulas and my research in the
R user guide did not really helped me:

??

I have 2 columns in my dataset corresponding to 2 ???response???
variables (x = coordinates along PCA axis 1 and y = coordinates along PCA axis
2 of my raw dataset) and that???s on these variables that I would like to run the
boosting.cv, therefore I tried to define a formula with 2 response variables
and no terms but it???s not really explained this way in the R-guide and I???m not
even sure it???s possible.

??

I also tried by making my KMeans clustering before, applying
the cluster number to each row and using this number (recoded ??as.character) as a term, but it does not work
either.

??

A quick overview of code / error message if needed :

??

> form <- as.formula (COORDI_PCA1n2$Dim.1 +
COORDI_PCA1n2$Dim.2 ~KMeans)

> boosting.cv(form, COORDI_PCA1n2)

Error in `[.data.frame`(data, , as.character(formula[[2]]))
:

?? undefined columns
selected

> boosting.cv(form, COORDI_PCA1n2[, 1:2])

Error in `[.data.frame`(data, , as.character(formula[[2]]))
:

?? undefined columns
selected ??

??

If anyone has the time to indicate me where I???m being wrong???

??

With regards





        [[alternative HTML version deleted]]



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

Message: 76
Date: Fri, 11 Sep 2009 08:45:14 +0200
From: jo <jo.lists at gmail.com>
Subject: Re: [R] Merge data frames but prefer values in one
To: Henrique Dallazuanna <wwwhsd at gmail.com>
Cc: R Help <r-help at stat.math.ethz.ch>
Message-ID:
        <b01b1c9d0909102345p7b33d3adr9118d85b254875c6 at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Thanks for the post-processing ideas. But is there any way to do that
in one step?

On Thu, Sep 10, 2009 at 7:20 PM, Henrique Dallazuanna <wwwhsd at gmail.com> wrote:
>
> Try this:
>
> xy <- merge(x, y, by = c("a","b"),all = TRUE)
> xy$c <- ifelse(rowSums(!is.na(.x <- xy[, c('c.x', 'c.y')])) > 1, .x[,1], rowSums(.x, na.rm = TRUE))
> xy
>
> On Thu, Sep 10, 2009 at 12:21 PM, JiHO <jo.lists at gmail.com> wrote:

JiHO
---
http://maururu.net



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

Message: 77
Date: Fri, 11 Sep 2009 08:49:28 +0200
From: Schalk Heunis <schalk.heunis at enerweb.co.za>
Subject: Re: [R] Accumulating results from "for" loop in a list/array
To: Steven Kang <stochastickang at gmail.com>
Cc: r-help at r-project.org
Message-ID:
        <39226c970909102349s58550d34k22cac2987742e182 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Steven

I think list() can help you

##########################################
indlist = list()
 for (i in 1:(dim(x)[2]))  {
         indlist[[paste("ind", i, sep = "")]] <-  which(x[ , i] == "y")
 }
accum = unlist(indlist)
print(indlist$ind1)
###########################################

Schalk Heunis



On Fri, Sep 11, 2009 at 7:52 AM, Steven Kang <stochastickang at gmail.com> wrote:
> Dear R users,
>
>
> I would like to accumulate objects generated from 'for' loop to a list or
> array.
>
> To illustrate the problem, arbitrary data set and script is shown below,
>
>
> x <- data.frame(a = c(rep("n",3),rep("y",2),rep("n",3),rep("y",2)), b =
> c(rep("y",2),rep("n",4),rep("y",3),"n"), c = c(rep("n",7),rep("y",3)), d =
> c("y", rep("n",4), rep("y",2), rep("n",3)))
>
> for (i in 1:(dim(x)[2])) ?{
> ? ? ? ? assign(paste("ind", i, sep = ""), which(x[ , i] == "y"))
> ? ? ? ? ?accum <- c(ind1, ind2, ind3, ind4)
> }
>
>> ind1
> [1] ?4 ?5 ?9 10
>> ind2
> [1] 1 2 7 8 9
>> ind3
> [1] ?8 ?9 10
>> ind4
> [1] 1 6 7
>> accum
> ?[1] ?4 ?5 ?9 10 ?1 ?2 ?7 ?8 ?9 ?8 ?9 10 ?1 ?6 ?7
>
> Are there any alternative method where the highlighted statement above can
> be represented without typing individual objects manually? (as it can be
> very tedious with large number of objects; i.e ind1, ind2, ....., ind100)
>
> Also, is there any way to extract individual objects ('ind1' etc) from
> 'accum'?
>
>> accum[1:length(ind1)]
> [1] ?4 ?5 ?9 10
> gives 'ind1', but this may become messy for other objects (like 'ind10')
>
>
> Highly appreciate for sharing your expertise in solving this problem.
>
> ? ? ? ?[[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: 78
Date: Fri, 11 Sep 2009 00:13:00 -0700 (PDT)
From: megh <megh700004 at yahoo.com>
Subject: [R]  Is there any "month" object like "LETTERS" ?
To: r-help at r-project.org
Message-ID: <25396125.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


There is an object "LETTERS" which displays all letters from "a" to "z". Is
there any similar object whicg displays the "months" as well in
chronological order? like "jan", "feb",...........,"dec"

Thanks,
--
View this message in context: http://www.nabble.com/Is-there-any-%22month%22-object-like-%22LETTERS%22---tp25396125p25396125.html
Sent from the R help mailing list archive at Nabble.com.



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

Message: 79
Date: Fri, 11 Sep 2009 19:15:55 +1200
From: Patrick Connolly <p_connolly at slingshot.co.nz>
Subject: Re: [R] Best R text editors?
To: Johannes Huesing <johannes at huesing.name>
Cc: r-help at r-project.org
Message-ID: <20090911071555.GA4207 at slingshot.co.nz>
Content-Type: text/plain; charset=us-ascii

On Fri, 11-Sep-2009 at 06:12AM +0200, Johannes Huesing wrote:

|> Martin Maechler <maechler at stat.math.ethz.ch> [Wed, Sep 02, 2009 at 09:17:42AM CEST]:
|> > >>>>> "PaCo" == p connolly <p_connolly at slingshot.co.nz>
|> > >>>>>     on Wed, 02 Sep 2009 12:19:31 +1200 writes:
|> >
|> >     PaCo> On Mon, 31-Aug-2009 at 08:25PM +1000, Jim Lemon wrote:
|> >     PaCo> [...]
|> [...]
|> >     PaCo> |> Emacs still
|> >     PaCo> |> has that annoying trait of being determinedly incompatible with anything
|> >     PaCo> |> else, even if the conventions are quite sensible.
|>
|> A lot of the keystrokes are the same as when you are using the bash.
|>
|> [...]
|> >
|> > well, actually, since Emacs 23, in its 'Options' Menu there's
|> > now a check-box entry
|> >
|> >     " C-x/C-c/C-v Cut and Paste (CUA) "
|> >
|> > ((which still is "off" by default ;-))
|>
|> and in previous versions, you could always do M-x cua-mode for
|> the same effect. Talk about a well-hidden function mostly directed
|> at beginners ...

Perhaps the thinking was that by the time they find it, they'll
already have noticed that they can cut/copy and paste using only the
mouse buttons and won't be bothered with such inefficient methods.

Though this be madness, yet there is a method in't. :-)


--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
   ___    Patrick Connolly
 {~._.~}                   Great minds discuss ideas
 _( Y )_                 Average minds discuss events
(:_~*~_:)                  Small minds discuss people
 (_)-(_)                              ..... Eleanor Roosevelt

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



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

Message: 80
Date: Fri, 11 Sep 2009 09:23:13 +0200
From: "Reynaerts, Jo" <Jo.Reynaerts at econ.kuleuven.be>
Subject: [R] Constructing variables conditional on two indicators
To: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
        <603D249CBE0B304490D0F774142B8E0F0174808D8E35 at ECONSRVEX6.econ.kuleuven.ac.be>

Content-Type: text/plain

Dear R users

I have a data frame that looks like this:

m         j           X1         X2

1          1
1          2
1          ...
1          J
2          1
2          2
2          ...
2          J
.
.
.
M         1
M         2
M         ...
M         J

The data frame essentially looks like a panel: m and j are indicators where m is 1:M and j is 1:J (and M > J); X1 and X2 are variables.  I would like to construct and add new variables to the data frame that are m- and j- specific, e.g., compute X3 where X3 is the sum of X1 of all j in m, and this for each m.  The new variable X3 is then added to the data frame (and is the same for all rows with the same m indicator).

How can I program this efficiently without running loops?

Thanks in advance

Jo Reynaerts

Ph.D. student
LICOS Centre for Institutions and Economic Performance
Katholieke Universiteit Leuven
Deb?riotstraat 34/3511
B-3000 Leuven
Belgium
Jo.Reynaerts at econ.kuleuven.be<mailto:Jo.Reynaerts at econ.kuleuven.be>




        [[alternative HTML version deleted]]



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

Message: 81
Date: Fri, 11 Sep 2009 09:28:52 +0200
From: Dimitris Rizopoulos <d.rizopoulos at erasmusmc.nl>
Subject: Re: [R] Constructing variables conditional on two indicators
To: "Reynaerts, Jo" <Jo.Reynaerts at econ.kuleuven.be>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID: <4AA9FC34.9090909 at erasmusmc.nl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

have a look at ave() and/or tapply().

I hope it helps.

Best,
Dimitris


Reynaerts, Jo wrote:
> Dear R users
>
> I have a data frame that looks like this:
>
> m         j           X1         X2
>
> 1          1
> 1          2
> 1          ...
> 1          J
> 2          1
> 2          2
> 2          ...
> 2          J
> .
> .
> .
> M         1
> M         2
> M         ...
> M         J
>
> The data frame essentially looks like a panel: m and j are indicators where m is 1:M and j is 1:J (and M > J); X1 and X2 are variables.  I would like to construct and add new variables to the data frame that are m- and j- specific, e.g., compute X3 where X3 is the sum of X1 of all j in m, and this for each m.  The new variable X3 is then added to the data frame (and is the same for all rows with the same m indicator).
>
> How can I program this efficiently without running loops?
>
> Thanks in advance
>
> Jo Reynaerts
>
> Ph.D. student
> LICOS Centre for Institutions and Economic Performance
> Katholieke Universiteit Leuven
> Deb?riotstraat 34/3511
> B-3000 Leuven
> Belgium
> Jo.Reynaerts at econ.kuleuven.be<mailto:Jo.Reynaerts at econ.kuleuven.be>
>
>
>
>
>       [[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.

--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014



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

Message: 82
Date: Fri, 11 Sep 2009 19:30:14 +1200
From: Patrick Connolly <p_connolly at slingshot.co.nz>
Subject: Re: [R] Linux R version: best?
To: "S. Few" <stevefew at gmail.com>
Cc: r-help at r-project.org
Message-ID: <20090911073014.GB4207 at slingshot.co.nz>
Content-Type: text/plain; charset=us-ascii

On Thu, 10-Sep-2009 at 04:47PM -0400, S. Few wrote:

|> For my Redhat 5.2 Linux box, which version of R would be most stable?

Redhat 5.2 is *very* old.  That was around about the time of
Windows98, IIRC.  Or do you mean RHEL 5.2?


|>
|> I am doing forecasting, statistics, etc.
|>
|>
|> 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.

--
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
   ___    Patrick Connolly
 {~._.~}                   Great minds discuss ideas
 _( Y )_                 Average minds discuss events
(:_~*~_:)                  Small minds discuss people
 (_)-(_)                              ..... Eleanor Roosevelt

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



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

Message: 83
Date: Fri, 11 Sep 2009 00:34:56 -0700 (PDT)
From: bartjoosen <bartjoosen at hotmail.com>
Subject: Re: [R] executing rscript from VB
To: r-help at r-project.org
Message-ID: <25396386.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Maybe I'm missing something, but how about using the shell function?

Bart



Duncan Murdoch-2 wrote:
>
> On 9/10/2009 9:25 AM, H Rao wrote:
>> Hi,
>> I am looking to execute an R script from VB as  below.
>> The script runs fine but the redirection doesnt seem to happen. The
>> redirection operator and the out file seem to be treated as arguments
>> to the R script. Is there a way to get the > operator working
>
> That's a VB question.  You should ask Microsoft.
>
> Duncan Murdoch
>
>>
>> thanks, R
>>
>> System.Diagnostics.Process proc = new System.Diagnostics.Process();
>> proc.StartInfo.FileName = "E:/R/bin/Rscript.exe";
>> proc.StartInfo.Arguments = "E:/R/bin/test.r > test.out";
>> proc.StartInfo.UseShellExecute = true;
>> proc.Start();
>>
>> ______________________________________________
>> 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.
>
> ______________________________________________
> 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/executing-rscript-from-VB-tp25383342p25396386.html
Sent from the R help mailing list archive at Nabble.com.



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

Message: 84
Date: Fri, 11 Sep 2009 10:17:12 +0200
From: "Luca Braglia" <braglia at poleis.eu>
Subject: [R] how to do this?
To: <r-help at r-project.org>
Message-ID: <003001ca32b8$44172820$cc457860$@eu>
Content-Type: text/plain;       charset="utf-8"

Hello R-users

I have a situation like this

x=c(1,3,2)

y=data.frame("a"=1:3, "b"=4:6, "c"=7:9)*2

So we have

> t(t(x))
     [,1]
[1,]    1
[2,]    3
[3,]    2

And

> y
  a  b  c
1 2  8 14
2 4 10 16
3 6 12 18

I would like to obtain a vector with number taken from the data.frame: x is needed as row index

With c(1,3,2), in this case the ouput should be

2
16
12

I've tried a little bit with apply, but unsuccessfully.

Thank you



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

Message: 85
Date: Fri, 11 Sep 2009 10:23:57 +0200
From: Paul Hiemstra <p.hiemstra at geo.uu.nl>
Subject: Re: [R] sppolot: fill below minimum legend value
To: emorway <emorway at engr.colostate.edu>
Cc: r-help at r-project.org
Message-ID: <4AAA091D.7090305 at geo.uu.nl>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

emorway wrote:
> In the plot below, there are some grid cells that have values below 10, which
> is the lowest "cut" value I have specified.  Is there a way, without
> adjusting the number of cuts, to tell R to fill in those cells with the
> lowest possible color (in this case greeen)?  There is a white "hole" in the
> image about a quarter of the way in from the left side, this is what I would
> like to correct.  Thanks...Eric
>
> The code:
> pts<-list("sp.points",K.dat,pch=3,col="black")
> cuts<-c(10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800,900,1000)
> spplot(lzm.krige.dir["var1.pred"],at=cuts,colorkey=list(at=log10(cuts),at=log10(cuts),labels=as.character(cuts)),scales=list(draw=TRUE),
> xlab="Easting",ylab="Northing",key.space="right",cex=1.1,col.regions=terrain.colors(30),main="Hydraulic
> Conductivity of Layer 2",sp.layout=list(pts))
>
> The image:
> http://www.nabble.com/file/p25392472/Image3.jpeg
>
Hi Eric,

As far as I know you need to set the lower value of cuts to the minimum
of the dataset to prevent this white space from occuring. If you don't
want to see this in the colorbar, you need to adjust it using the
colorkey argument.

And a non-technical note, you e-mail doesn't give a lot of background
regarding your problem. spplot is a function that is only used by people
working with geographic data, which is probably a small subset of the
total community. See the posting guide for some hints about what kind of
information is necessary in an e-mail to r-help, for example a
reproducible example. In addition, there is a mailing list specifically
meant for geographic data, r-sig-geo, where you are more likely to get
the answers you are looking for.

cheers and good luck,
Paul

--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul



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

Message: 86
Date: Fri, 11 Sep 2009 13:05:19 +0430
From: MERAL YAY <meral.yay at gmail.com>
Subject: [R] ipred
To: r-help at r-project.org
Message-ID:
        <c0fbb8790909110135i285157cei19a0607791fef91a at mail.gmail.com>
Content-Type: text/plain

Hello,

I have a question about "ipred" package. I am working on a data set which
contains 1000 individual swho came from 588 regions.

I calculated misclassification error rate with cross validation and its
smooted version "bootstrap 632" for different sample sizes in LDF. I am
doubting whether error rate and low variance are enough to explain my data.

Thanks

Meral

        [[alternative HTML version deleted]]



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

Message: 87
Date: Fri, 11 Sep 2009 10:39:35 +0200
From: Giacomo Santini <giacomo.santini at unifi.it>
Subject: [R] call Fortran  from R
To: r-help at r-project.org
Message-ID: <4AAA0CC7.4080309 at unifi.it>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Dear R users,


I have to call fortran program from within R (R 2.8.1 on ubuntu 8.10
machine).
Suppose I have a fortran code like this (this is only a toy model, my
working model is far more complex, but input/output is similar)


      DOUBLE PRECISION FUNCTION model(times, alfa, beta)
      DOUBLE PRECISION alfa, beta, times
      model=beta*sin(times)+alfa*cos(times)
      END FUNCTION

which is saved as model.f.

I wrote a wapper like this (saved as wrapper.f)

       SUBROUTINE model_wrapper(times, alfa, beta, answer)
       DOUBLE PRECISION times, alfa, beta, answer
       EXTERNAL model
       answer = model(times, alfa, beta)
       END SUBROUTINE

Then I compiled all this stuff

g77 -fno-second-underscore -c -fPIC model.f
g77 -fno-second-underscore -c -fPIC wrapper.f
g77 -fno-second-underscore -shared -o model.so model.o wrapper.o


 From within R

dyn.load('model.so')
model <- function(times, alfa, beta) {
      returned_data = .Fortran('model_wrapper', times=as.double(times),
alfa=as.double(alfa),
      beta=as.double(beta), result=double(1))
      return(returned_data) }

# example run
test_1<-model(1.0,0.2,0.3)

which gives

test_1$times
[1] 1.0
$alfa
[1] 0.2
$beta
[1] 0.3
$result
[1] 147456887

where $result is clearly wrong.

I suppose I made some mistake with the handling of  data types, but I am
not able to figure out  where.

Can someboby help me?


Giacomo

--
-------------------------------------------------------
Giacomo Santini PhD
Dipartimento di Biologia Evoluzionistica "Leo Pardi"
Universita' degli Studi di Firenze
Via Romana 17
I-50125 Firenze
Italy

Tel: +39 055 2288288 (DBE) - +39 0574 447727 (CESPRO)
Fax: +39 055 2288289
www.dbe.unifi.it/santini



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

Message: 88
Date: Fri, 11 Sep 2009 12:55:01 +0430
From: MERAL YAY <meral.yay at gmail.com>
Subject: [R] (no subject)
To: r-help at r-project.org
Message-ID:
        <c0fbb8790909110125lfc6421cs9b729f8dda4de809 at mail.gmail.com>
Content-Type: text/plain

Hello,

I have a question about "ipred" package. I am working on a data set which
contains 1000 individual swho came from 588 regions.

I calculated misclassification error rate with cross validation and its
smooted version "bootstrap 632" for different sample sizes in LDF. I am
doubting whether error rate and low variance are enough to explain my data.

Thanks

Meral

        [[alternative HTML version deleted]]



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

Message: 89
Date: Fri, 11 Sep 2009 10:19:13 +0200
From: Dilli Prasad Rijal <dprijal at gmail.com>
Subject: [R] How to compare the result of GLM and GAM
To: R-help at stat.math.ethz.ch
Message-ID:
        <101b3ee30909110119g79eef167q2634e1f81ba4a23e at mail.gmail.com>
Content-Type: text/plain

Dear R users

I have basic knowledge of R and unaware of many more.

I am confused about how can I compare the result of two different models?
Have count data of plant species and want to correlate with altitude, rri,
pH, moisture, temperature etc. I have made some models using GLM of
different orders and I found 2nd order GLM significant than others. Now, I
wanted to check whether GAM is more robust than GLM.

Is it possible to test this in R? If yes, What are the parameters to be
focused for the comparison?

Thanks in advance

Dilli Rijal
Central Department of Botany
Biodiversity and environmental Management
Kathmandu, Nepal

        [[alternative HTML version deleted]]



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

Message: 90
Date: Fri, 11 Sep 2009 09:54:38 +0200
From: "Karrer  Stefanie" <karrers at student.ethz.ch>
Subject: [R] R - box design-scatter plot f?r means/regression/lme?
To: <r-help at r-project.org>
Message-ID: <10E817C4B5763D4A97F90ABF567725D502252E11 at EX2.d.ethz.ch>
Content-Type: text/plain; charset="iso-8859-1"


Dear All!

It's now weeks that I'm going crazy with R, and as I'm a new user I now ask for help (also because I still have only a few days to finish..)...
So shortly I describe you my Experiment in which I was looking for the decomposition of herbivore dung under different treatments:
I made a box design experiment which is structured in the following way:
I collected dung from 2  species (Wildebeest and Giraffe) and put for each species 8 pellets in different pots. I used 2 water treatments for the pots: wet (by adding water) and dry and two shadow treatments: shadow and sun.
So the design for 1 box was looking as follow:
1 Box (Sun or Shadow):
1 giraffe dung - wet
1 giraffe dung - dry
1 wildebeest dung - wet
1 wildebeest dung - dry
 --> total 10 Boxen (5 shadow, 5 sun)

Now, for each treatment I took out 2 pellets which I then measured fr different variables. I did this at 3 time point: 0, 6 and 12 days after set up.

So I have now following Data:
Giraffe dung: wet/ dry treatment under shadow/sun condition, 3 collection times, always 5 Replikate
Same for the Wildebeest dung.
For the pellets I measured following variables:
DW.P = dry weight pro pellet
WL= water loss
Ctot= total carbon
Ntot=total nitrogen

Now, for my statistics I used:
lme(Y ~ Day*water.T*shadow.T*dung.T, random=~Day|Box/Pot)

but apperently I have to fit a linear correlation for Day, so that Day is not seen as a Factor.. How have I to do that?
Something Day <- corr(Day*Y)?

Then I also have to calculate the regressions for Ctot and Ntot to get the slopes. I tried with:

slope <- function(x) {-summary(lm(log(x)~c(1,6,12)))$coefficients[2,1]}
Reg.Slopes <- aggregate(DW.P, list(shadow.T=shadow.T, water.T=water.T,Species=Species,Pot=ID),slope)

...but it doesn't work...

And finally to my plots. I need scatter plots of the means of the different measured variables with the sd bar. I found out there is a code "plotmeans" but I don't know how to use it with my data... And also how to put the Titles and Subtitles in the right way, as the x and y axes...

[[elided Yahoo spam]]
Thank you very very very much,
Stefanie





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

Message: 91
Date: Fri, 11 Sep 2009 05:01:14 -0400
From: Duncan Murdoch <murdoch at stats.uwo.ca>
Subject: Re: [R] call Fortran  from R
To: Giacomo Santini <giacomo.santini at unifi.it>
Cc: r-help at r-project.org
Message-ID: <4AAA11DA.8070908 at stats.uwo.ca>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 11/09/2009 4:39 AM, Giacomo Santini wrote:
> Dear R users,
>
>
> I have to call fortran program from within R (R 2.8.1 on ubuntu 8.10
> machine).
> Suppose I have a fortran code like this (this is only a toy model, my
> working model is far more complex, but input/output is similar)
>
>
>       DOUBLE PRECISION FUNCTION model(times, alfa, beta)
>       DOUBLE PRECISION alfa, beta, times
>       model=beta*sin(times)+alfa*cos(times)
>       END FUNCTION
>
> which is saved as model.f.
>
> I wrote a wapper like this (saved as wrapper.f)
>
>        SUBROUTINE model_wrapper(times, alfa, beta, answer)
>        DOUBLE PRECISION times, alfa, beta, answer
>        EXTERNAL model
>        answer = model(times, alfa, beta)
>        END SUBROUTINE

It's been a long time since I worked in Fortran, but don't you need to
declare that model returns a double precision value in the wrapper?  By
default in ancient Fortran model would be an integer value.  Since you
compile the two functions separately, the wrapper code won't see the
declaration in model.f.

>
> Then I compiled all this stuff
>
> g77 -fno-second-underscore -c -fPIC model.f
> g77 -fno-second-underscore -c -fPIC wrapper.f
> g77 -fno-second-underscore -shared -o model.so model.o wrapper.o

I would use R CMD SHLIB model.f wrapper.f

to be sure the options match what R is expecting.

Duncan Murdoch

>
>
>  From within R
>
> dyn.load('model.so')
> model <- function(times, alfa, beta) {
>       returned_data = .Fortran('model_wrapper', times=as.double(times),
> alfa=as.double(alfa),
>       beta=as.double(beta), result=double(1))
>       return(returned_data) }
>
> # example run
> test_1<-model(1.0,0.2,0.3)
>
> which gives
>
> test_1$times
> [1] 1.0
> $alfa
> [1] 0.2
> $beta
> [1] 0.3
> $result
> [1] 147456887
>
> where $result is clearly wrong.
>
> I suppose I made some mistake with the handling of  data types, but I am
> not able to figure out  where.
>
> Can someboby help me?
>
>
> Giacomo
>



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

Message: 92
Date: Fri, 11 Sep 2009 11:12:11 +0200
From: "Luca Braglia" <braglia at poleis.eu>
Subject: [R] R:  how to do this?
To: "'Luca Braglia'" <braglia at poleis.eu>, <r-help at r-project.org>
Message-ID: <003201ca32bf$f2471ed0$d6d55c70$@eu>
Content-Type: text/plain;       charset="utf-8"

> Da: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> Per conto di Luca Braglia
> Inviato: venerd? 11 settembre 2009 10.17
> A: r-help at r-project.org
> Oggetto: [R] how to do this?


> in this case the ouput should be
>
> 2
> 16
> 12
>


Obviously this ....


id.match = rep(0, nrow(y))
for (indice in 1:nrow(y)) {
        id.match[indice] <- y[indice, x[indice]] } id.match


... works, but it's not that good solution (especially for big data.frame)

Thank you



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

Message: 93
Date: Fri, 11 Sep 2009 17:19:20 +0800
From: Linlin Yan <yanlinlin82 at gmail.com>
Subject: Re: [R] how to do this?
To: Luca Braglia <braglia at poleis.eu>
Cc: r-help at r-project.org
Message-ID:
        <8d4c23b10909110219j20baf199r50f8ad90b667425d at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Try this:
> y[matrix(c(seq_along(x), x), ncol = 2)]
[1]  2 16 12

On Fri, Sep 11, 2009 at 4:17 PM, Luca Braglia <braglia at poleis.eu> wrote:
> Hello R-users
>
> I have a situation like this
>
> x=c(1,3,2)
>
> y=data.frame("a"=1:3, "b"=4:6, "c"=7:9)*2
>
> So we have
>
>> t(t(x))
> ? ? [,1]
> [1,] ? ?1
> [2,] ? ?3
> [3,] ? ?2
>
> And
>
>> y
> ?a ?b ?c
> 1 2 ?8 14
> 2 4 10 16
> 3 6 12 18
>
> I would like to obtain a vector with number taken from the data.frame: x is needed as row index
>
> With c(1,3,2), in this case the ouput should be
>
> 2
> 16
> 12
>
> I've tried a little bit with apply, but unsuccessfully.
>
> Thank you
>
> ______________________________________________
> 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: 94
Date: Fri, 11 Sep 2009 11:19:35 +0200
From: Giacomo Santini <giacomo.santini at unifi.it>
Subject: Re: [R] call Fortran  from R
To: Duncan Murdoch <murdoch at stats.uwo.ca>
Cc: r-help at r-project.org
Message-ID: <4AAA1627.1070302 at unifi.it>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

[[elided Yahoo spam]]

Giacomo


Duncan Murdoch wrote:
> On 11/09/2009 4:39 AM, Giacomo Santini wrote:
>> Dear R users,
>>
>>
>> I have to call fortran program from within R (R 2.8.1 on ubuntu 8.10
>> machine).
>> Suppose I have a fortran code like this (this is only a toy model, my
>> working model is far more complex, but input/output is similar)
>>
>>
>>       DOUBLE PRECISION FUNCTION model(times, alfa, beta)
>>       DOUBLE PRECISION alfa, beta, times
>>       model=beta*sin(times)+alfa*cos(times)
>>       END FUNCTION
>>
>> which is saved as model.f.
>>
>> I wrote a wapper like this (saved as wrapper.f)
>>
>>        SUBROUTINE model_wrapper(times, alfa, beta, answer)
>>        DOUBLE PRECISION times, alfa, beta, answer
>>        EXTERNAL model
>>        answer = model(times, alfa, beta)
>>        END SUBROUTINE
>
> It's been a long time since I worked in Fortran, but don't you need to
> declare that model returns a double precision value in the wrapper?
> By default in ancient Fortran model would be an integer value.  Since
> you compile the two functions separately, the wrapper code won't see
> the declaration in model.f.
>
>>
>> Then I compiled all this stuff
>>
>> g77 -fno-second-underscore -c -fPIC model.f
>> g77 -fno-second-underscore -c -fPIC wrapper.f
>> g77 -fno-second-underscore -shared -o model.so model.o wrapper.o
>
> I would use R CMD SHLIB model.f wrapper.f
>
> to be sure the options match what R is expecting.
>
> Duncan Murdoch
>
>>
>>
>>  From within R
>>
>> dyn.load('model.so')
>> model <- function(times, alfa, beta) {
>>       returned_data = .Fortran('model_wrapper',
>> times=as.double(times), alfa=as.double(alfa),
>>       beta=as.double(beta), result=double(1))
>>       return(returned_data) }
>>
>> # example run
>> test_1<-model(1.0,0.2,0.3)
>>
>> which gives
>>
>> test_1$times
>> [1] 1.0
>> $alfa
>> [1] 0.2
>> $beta
>> [1] 0.3
>> $result
>> [1] 147456887
>>
>> where $result is clearly wrong.
>>
>> I suppose I made some mistake with the handling of  data types, but I
>> am not able to figure out  where.
>>
>> Can someboby help me?
>>
>>
>> Giacomo
>>
>
>

--
-------------------------------------------------------
Giacomo Santini PhD
Dipartimento di Biologia Evoluzionistica "Leo Pardi"
Universita' degli Studi di Firenze
Via Romana 17
I-50125 Firenze
Italy

Tel: +39 055 2288288 (DBE) - +39 0574 447727 (CESPRO)
Fax: +39 055 2288289
www.dbe.unifi.it/santini



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

Message: 95
Date: Fri, 11 Sep 2009 04:35:56 -0500
From: David Kaplan <dkaplan at education.wisc.edu>
Subject: [R] Multilevel models with sampling weights at both levels
To: r-help at stat.math.ethz.ch
Message-ID: <4AAA19FC.4020705 at education.wisc.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Greetings,

Is there a package in R that will run multilevel models (e.g. students
nested in schools) where sampling weights can be employed at both levels?

Thanks in advance.

David

--
===============================================================
David Kaplan, Ph.D.
Professor
Department of Educational Psychology
University of Wisconsin - Madison
Educational Sciences, Room, 1061
1025 W. Johnson Street
Madison, WI 53706

email: dkaplan at education dot wisc dot edu
homepage:
http://www.education.wisc.edu/edpsych/facstaff/kaplan/kaplan.htm
Phone: 608-262-0836



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

Message: 96
Date: Fri, 11 Sep 2009 11:42:35 +0200
From: "Luca Braglia" <braglia at poleis.eu>
Subject: [R] R:  how to do this?
To: "'Linlin Yan'" <yanlinlin82 at gmail.com>
Cc: r-help at r-project.org
Message-ID: <003f01ca32c4$315c6cc0$94154640$@eu>
Content-Type: text/plain;       charset="utf-8"

> Da: Linlin Yan [mailto:yanlinlin82 at gmail.com]
> Inviato: venerd? 11 settembre 2009 11.19
> A: Luca Braglia
> Cc: r-help at r-project.org
> Oggetto: Re: [R] how to do this?
>
> Try this:
> > y[matrix(c(seq_along(x), x), ncol = 2)]
> [1]  2 16 12


Very interesting!

So I can give as index to a data.frame a matrix (of index) too
(not only vectors separated by commas).

Thank you



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

Message: 97
Date: Fri, 11 Sep 2009 10:47:05 +0100
From: Barry Rowlingson <b.rowlingson at lancaster.ac.uk>
Subject: Re: [R] Is there any "month" object like "LETTERS" ?
To: megh <megh700004 at yahoo.com>
Cc: r-help at r-project.org
Message-ID:
        <d8ad40b50909110247g7b9003f7nc2b3f20180e63feb at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Fri, Sep 11, 2009 at 8:13 AM, megh <megh700004 at yahoo.com> wrote:
>
> There is an object "LETTERS" which displays all letters from "a" to "z". Is
> there any similar object whicg displays the "months" as well in
> chronological order? like "jan", "feb",...........,"dec"

 You could construct a vector of the first of the month for some year
and then use months() or format() on it:

 > months(ISOdatetime(1960,1:12,1,0,0,0))
  [1] "January"   "February"  "March"     "April"     "May"       "June"
  [7] "July"      "August"    "September" "October"   "November"  "December"

 > format(ISOdatetime(1960,1:12,1,0,0,0),"%b")
  [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"

 Note these are locale-dependent, so les Francais will see something
else. Probably "Jan","Fev","Mar","Avr" and so on...

Barry



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

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

End of R-help Digest, Vol 79, Issue 11




More information about the R-help mailing list