[R] Please Help how to execute R via php script

2015-08-18 Thread Joseph Mbowe
Dear R members, I want to call my R script thorough php but no I am not
getting output
When I call my r script by bat file works fines also when run by Rstudio it
works fines
but when i cant call via php
here is the php code:
?php
exec('C:/Program Files/R/R-3.2.0/bin/i386/Rscript.exe
C:/xampp/htdocs/postam/DrawGraph.R')

echo 'img src=C:/xampp/htdocs/postam/radargplot100.png?t='.time().'
style=height:600px;width:auto; /' ;

?

here is R script
args=(commandArgs(TRUE))
  library(ggplot2)
  library(readxl)
  #library(RMySQL)
  #library(readxl,lib.loc =C:\Program Files\R\R-3.2.0\bin\i386)
  library(RMySQL,lib.loc =C:/Users/Mbowe/Documents/R/win-library/3.2)
  library(arulesViz, quietly=TRUE)
  drv_postam = dbDriver(MySQL)
  con = dbConnect(drv_postam, user=root,
dbname=evtlogr,host=localhost)
  tbl_data2-dbGetQuery(con,select * from `tblsevtlogs` where datetime
BETWEEN '5/20/2015' AND '5/28/2015';)
  closeAllConnections()
  head( tbl_data2)
  tail( tbl_data2)

  #summary(data)
  w1 =
table(tbl_data2$evtcategory,tbl_data2$evttype,tbl_data2$evt_usr_source)
  t1 = as.data.frame(w1)
  t1
  LogonType-t1$Var1
  LogonTypeCount-t1$Freq
  Yaxis-paste(paste(Frequency Count))
  user_obj-paste(User: ,tbl_data2$evt_usr_source)

  myplot - ggplot(t1, aes(y = LogonTypeCount, x = reorder(t1$Var2,
t1$Freq),
 group = LogonType, colour =   LogonType)) + coord_polar()
+ geom_point(size=3) + geom_path(size=1) +
labs(x = paste(Data Mined From (,user_obj,), Event Logs),y=Yaxis)
ggsave(file=C:/xampp/htdocs/postam/radargplot100.png)
  dev.off()

[[alternative HTML version deleted]]

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


Re: [R] [FORGED] date format in xyplot

2015-08-18 Thread Rolf Turner


See inline below.

On 18/08/15 16:15, Christine Lee via R-help wrote:

To whom it may concern,

I have tried to plot some numbers against time with the time on the X-axis
shown as Jan, Feb, etc.

I used the following commands:
Raw-structure(list(Date = structure(c(6L, 7L, 2L, 4L, 12L, 9L, 7L,
2L, 4L, 12L), .Label = c(1/10, 1/11, 11/11, 12/11, 13/10,
19/9, 2/10, 2/11, 20/9, 26/11, 29/10, 29/11, 30/11,
31/10, 4/10, 6/10), class = factor), Year = c(2002L,
2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L
), Station = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
2L), .Label = c(E, F, H, I), class = factor), Abun = c(3.42,
1.33, 3.67, 3.67, 3.92, 2.17, 2.5, 1.67, 6.33, 0.67), Date1 = structure(c(16697,
16710, 16740, 16751, 16768, 16698, 16710, 16740, 16751, 16768
), class = Date)), .Names = c(Date, Year, Station, Abun,
Date1), row.names = c(NA, 10L), class = data.frame)

Raw$Date1-as.Date(Raw$Date,%d/%m)


What does this accomplish?  As far as I can tell Raw$Date1 is the same 
after doing this replacement as it was before.



xyplot(Abun~Date1|as.factor(Year),Raw,type=p,xlab=list(Month,cex=1.5),
lab=list(Abundance,cex=1.5),cex=2,pch=c(16,16,21),col=c(Black,Grey,Black),
strip=strip.custom(bg='white'),format=%B-%d)

The date format shown on X-axis was just 10-1, 10-15


Not what I get.


I should be grateful if any one could help indicating what has gone wrong?


No idea.  When I try your code, the x-axis labels that I get are
Oct 01, Oct 15, ..., Dec 01, which looks pretty much as it should.

General advice --- when you are getting unexpected results, try the 
example in a stripped down keep it simple form --- i.e. eliminate most 
of the bells and whistles in your very complicated call to xyplot(). 
That might give you a better chance at discerning what is causing things 
to go wrong for you.


cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] 回覆︰ [FORGED] date format in xyplot

2015-08-18 Thread Christine Lee via R-help
Thanks Mr. Turner, This puzzles me.  Why do we come out with different axis 
labels with the same command?  Is this because of my R version or my computer? 
Regards,Christine 


 Rolf Turner r.tur...@auckland.ac.nz 於 2015年08月18日 (週二) 2:02 PM 寫道﹕
   

 
See inline below.

On 18/08/15 16:15, Christine Lee via R-help wrote:
 To whom it may concern,

 I have tried to plot some numbers against time with the time on the X-axis
 shown as Jan, Feb, etc.

 I used the following commands:
 Raw-structure(list(Date = structure(c(6L, 7L, 2L, 4L, 12L, 9L, 7L,
 2L, 4L, 12L), .Label = c(1/10, 1/11, 11/11, 12/11, 13/10,
 19/9, 2/10, 2/11, 20/9, 26/11, 29/10, 29/11, 30/11,
 31/10, 4/10, 6/10), class = factor), Year = c(2002L,
 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L
 ), Station = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
 2L), .Label = c(E, F, H, I), class = factor), Abun = c(3.42,
 1.33, 3.67, 3.67, 3.92, 2.17, 2.5, 1.67, 6.33, 0.67), Date1 = 
 structure(c(16697,
 16710, 16740, 16751, 16768, 16698, 16710, 16740, 16751, 16768
 ), class = Date)), .Names = c(Date, Year, Station, Abun,
 Date1), row.names = c(NA, 10L), class = data.frame)

 Raw$Date1-as.Date(Raw$Date,%d/%m)

What does this accomplish?  As far as I can tell Raw$Date1 is the same 
after doing this replacement as it was before.

 xyplot(Abun~Date1|as.factor(Year),Raw,type=p,xlab=list(Month,cex=1.5),
 lab=list(Abundance,cex=1.5),cex=2,pch=c(16,16,21),col=c(Black,Grey,Black),
 strip=strip.custom(bg='white'),format=%B-%d)

 The date format shown on X-axis was just 10-1, 10-15

Not what I get.

 I should be grateful if any one could help indicating what has gone wrong?

No idea.  When I try your code, the x-axis labels that I get are
Oct 01, Oct 15, ..., Dec 01, which looks pretty much as it should.

General advice --- when you are getting unexpected results, try the 
example in a stripped down keep it simple form --- i.e. eliminate most 
of the bells and whistles in your very complicated call to xyplot(). 
That might give you a better chance at discerning what is causing things 
to go wrong for you.

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276


  
[[alternative HTML version deleted]]

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

Re: [R] date format in xyplot

2015-08-18 Thread Duncan Mackay
Hi Christine

If somethings go wrong:
1 first check your data

str(Raw)
'data.frame':   10 obs. of  5 variables:
 $ Date   : Factor w/ 16 levels 1/10,1/11,..: 6 7 2 4 12 9 7 2 4 12
 $ Year   : int  2002 2002 2002 2002 2002 2002 2002 2002 2002 2002
 $ Station: Factor w/ 4 levels E,F,H,I: 1 1 1 1 1 2 2 2 2 2
 $ Abun   : num  3.42 1.33 3.67 3.67 3.92 2.17 2.5 1.67 6.33 0.67
 $ Date1  : Date, format: 2015-09-19 2015-10-02 2015-11-01
2015-11-12 ...

Raw$Date2 - as.character(Raw$Date1)
Raw$Date2
[1] 2015-09-19 2015-10-02 2015-11-01 2015-11-12 2015-11-29
2015-09-20 2015-10-02 2015-11-01 2015-11-12 2015-11-29
Raw$Date2 - as.Date(Raw$Date2, %Y-%m-%d)

2 read the help guide again if not done recently ?lattice::xyplot or ?xyplot
3 start with a minimum number of arguments

xyplot(Abun~Date2|as.factor(Year), Raw)
or 
xyplot(Abun~Date2, Raw)
if you are still having problems

Dates are hard work in any language as they are not consistent so:
a.  use  default
b.  use your own 

This works

xyplot(Abun~Date2|as.factor(Year), Raw,
   par.settings = list(stripbackground = transparent), # background
colour controlled here
   type=p,
   scales = list(x = list(at = sort(c(seq(as.Date(Raw$Date2[1]-4), by =
months, length = 4),
   seq(as.Date(Raw$Date2[1]+12), by
= months, length = 3))),
   labels =
format(sort(c(seq(as.Date(Raw$Date2[1]-4), by = months, length = 4),
 
seq(as.Date(Raw$Date2[1]+12), by = months, length = 3))), %m-%d) ) ),
   xlab=list(Month,cex=1.5),
   ylab=list(Abundance,cex=1.5),
   cex=2,
   pch=c(16,16,21),
   col=c(Black,Grey,Black)
)

par.settings is confining the parameters set by trellis.par.set()  to the
function
to get them

names(trellis.par.get() )
and going further
trellis.par.get()$superpose.symbol
will give you the values for superpose.symbol

Beware: Do not make the labels etc so big that the axis labels are hard to
read. Think of final size

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Christine
Lee via R-help
Sent: Tuesday, 18 August 2015 14:16
To: r-help@r-project.org
Subject: [R] date format in xyplot

To whom it may concern,

I have tried to plot some numbers against time with the time on the X-axis
shown as Jan, Feb, etc.

I used the following commands:
Raw-structure(list(Date = structure(c(6L, 7L, 2L, 4L, 12L, 9L, 7L, 
2L, 4L, 12L), .Label = c(1/10, 1/11, 11/11, 12/11, 13/10, 
19/9, 2/10, 2/11, 20/9, 26/11, 29/10, 29/11, 30/11, 
31/10, 4/10, 6/10), class = factor), Year = c(2002L, 
2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L
), Station = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
2L), .Label = c(E, F, H, I), class = factor), Abun = c(3.42, 
1.33, 3.67, 3.67, 3.92, 2.17, 2.5, 1.67, 6.33, 0.67), Date1 =
structure(c(16697, 
16710, 16740, 16751, 16768, 16698, 16710, 16740, 16751, 16768
), class = Date)), .Names = c(Date, Year, Station, Abun, 
Date1), row.names = c(NA, 10L), class = data.frame)

Raw$Date1-as.Date(Raw$Date,%d/%m)
xyplot(Abun~Date1|as.factor(Year),Raw,type=p,xlab=list(Month,cex=1.5),yl
ab=list(Abundance,cex=1.5),cex=2,pch=c(16,16,21),col=c(Black,Grey,Bla
ck),strip=strip.custom(bg='white'),format=%B-%d)

The date format shown on X-axis was just 10-1, 10-15

I should be grateful if any one could help indicating what has gone wrong?

Regards,
Christine

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

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


[R] How are packages installed with install_github() updated in RStudio?

2015-08-18 Thread Michal Kvasnička
Hallo.

I use RStudio. Because of a bug in the latest CRAN version of dplyr, I
installed the GitHub version with install_github(). Now I wonder what
happens when there is a new version. Does RStudio update the packages
installed from GitHub? If so, does it replace it with the new CRAN version,
or a new GitHub version?

Many thanks for you answer,
Michal Kvasnicka

[[alternative HTML version deleted]]

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


Re: [R] 回覆︰ [FORGED] date format in xyplot

2015-08-18 Thread Rolf Turner


On 18/08/15 18:15, Christine Lee wrote:


Thanks Mr. Turner,


Please!!! Either Rolf or (if you insist on formality)
*Dr.* Turner. :-)


This puzzles me.  Why do we come out with different axis labels with the
same command?  Is this because of my R version or my computer?


SNIP

It is most likely a *version* issue; in your version the default format 
is %m-%e whereas in mine it's %b %d.  Or something like that.


Or it just might be a Windoze thing.  (If Micro$oft can find a way to 
mess things up, they will.)  I run *Linux*, as do all right-thinking people.


Be that as it may, I have now looked at the help for xyplot() a little 
more carefully (when in doubt try reading TFM!!!) and saw that format 
must be supplied as part of the *scales* argument, which is a *list*.


So try:

xyplot(Abun ~ Date1 | ... etc. etc ..., scales=list(format=%B=%d))

and I think you'll get what you want.

cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

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


Re: [R] Please Help how to execute R via php script

2015-08-18 Thread Loris Bennett
Joseph Mbowe mbo...@nm-aist.ac.tz writes:

 Dear R members, I want to call my R script thorough php but no I am not
 getting output
 When I call my r script by bat file works fines also when run by Rstudio it
 works fines
 but when i cant call via php
 here is the php code:
 ?php
 exec('C:/Program Files/R/R-3.2.0/bin/i386/Rscript.exe
 C:/xampp/htdocs/postam/DrawGraph.R')

 echo 'img src=C:/xampp/htdocs/postam/radargplot100.png?t='.time().'
 style=height:600px;width:auto; /' ;

 ?

I know nothing about PHP, but you seem to have a missing double quote in
your call to 'exec'.

Cheers,

Loris

 here is R script
 args=(commandArgs(TRUE))
   library(ggplot2)
   library(readxl)
   #library(RMySQL)
   #library(readxl,lib.loc =C:\Program Files\R\R-3.2.0\bin\i386)
   library(RMySQL,lib.loc =C:/Users/Mbowe/Documents/R/win-library/3.2)
   library(arulesViz, quietly=TRUE)
   drv_postam = dbDriver(MySQL)
   con = dbConnect(drv_postam, user=root,
 dbname=evtlogr,host=localhost)
   tbl_data2-dbGetQuery(con,select * from `tblsevtlogs` where datetime
 BETWEEN '5/20/2015' AND '5/28/2015';)
   closeAllConnections()
   head( tbl_data2)
   tail( tbl_data2)

   #summary(data)
   w1 =
 table(tbl_data2$evtcategory,tbl_data2$evttype,tbl_data2$evt_usr_source)
   t1 = as.data.frame(w1)
   t1
   LogonType-t1$Var1
   LogonTypeCount-t1$Freq
   Yaxis-paste(paste(Frequency Count))
   user_obj-paste(User: ,tbl_data2$evt_usr_source)

   myplot - ggplot(t1, aes(y = LogonTypeCount, x = reorder(t1$Var2,
 t1$Freq),
  group = LogonType, colour =   LogonType)) + coord_polar()
 + geom_point(size=3) + geom_path(size=1) +
 labs(x = paste(Data Mined From (,user_obj,), Event Logs),y=Yaxis)
 ggsave(file=C:/xampp/htdocs/postam/radargplot100.png)
   dev.off()

   [[alternative HTML version deleted]]


-- 
This signature is currently under construction.

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


Re: [R] date format in xyplot

2015-08-18 Thread John Kane
Sorry, quick follow-up: is there any chance you used Date rather than Date1 in 
the original plot?

John Kane
Kingston ON Canada


 -Original Message-
 From: r-help@r-project.org
 Sent: Mon, 17 Aug 2015 21:15:39 -0700
 To: r-help@r-project.org
 Subject: [R] date format in xyplot
 
 To whom it may concern,
 
 I have tried to plot some numbers against time with the time on the
 X-axis shown as Jan, Feb, etc.
 
 I used the following commands:
 Raw-structure(list(Date = structure(c(6L, 7L, 2L, 4L, 12L, 9L, 7L,
 2L, 4L, 12L), .Label = c(1/10, 1/11, 11/11, 12/11, 13/10,
 19/9, 2/10, 2/11, 20/9, 26/11, 29/10, 29/11, 30/11,
 31/10, 4/10, 6/10), class = factor), Year = c(2002L,
 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L
 ), Station = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
 2L), .Label = c(E, F, H, I), class = factor), Abun = c(3.42,
 1.33, 3.67, 3.67, 3.92, 2.17, 2.5, 1.67, 6.33, 0.67), Date1 =
 structure(c(16697,
 16710, 16740, 16751, 16768, 16698, 16710, 16740, 16751, 16768
 ), class = Date)), .Names = c(Date, Year, Station, Abun,
 Date1), row.names = c(NA, 10L), class = data.frame)
 
 Raw$Date1-as.Date(Raw$Date,%d/%m)
 xyplot(Abun~Date1|as.factor(Year),Raw,type=p,xlab=list(Month,cex=1.5),ylab=list(Abundance,cex=1.5),cex=2,pch=c(16,16,21),col=c(Black,Grey,Black),strip=strip.custom(bg='white'),format=%B-%d)
 
 The date format shown on X-axis was just 10-1, 10-15
 
 I should be grateful if any one could help indicating what has gone
 wrong?
 
 Regards,
 Christine
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

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


Re: [R] How are packages installed with install_github() updated in RStudio?

2015-08-18 Thread John Kane
Hi Michal,

Because RStudio seems to use its own method of updating you might be better off 
asking in their forum. 

John Kane
Kingston ON Canada


 -Original Message-
 From: prgo...@gmail.com
 Sent: Tue, 18 Aug 2015 10:43:20 +0200
 To: r-help@r-project.org
 Subject: [R] How are packages installed with install_github() updated in
 RStudio?
 
 Hallo.
 
 I use RStudio. Because of a bug in the latest CRAN version of dplyr, I
 installed the GitHub version with install_github(). Now I wonder what
 happens when there is a new version. Does RStudio update the packages
 installed from GitHub? If so, does it replace it with the new CRAN
 version,
 or a new GitHub version?
 
 Many thanks for you answer,
 Michal Kvasnicka
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords  protects your account.

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


Re: [R] date format in xyplot

2015-08-18 Thread John Kane
Hi Christine,
I am afraid I cannot help as it 'appears' fine here 

I get an x-axis witih 
Oct 01 Oct 15 Nov 15 Dec 01

I don't normally use lattice but the dates seem reasonable to me

Do a str(Raw) and check if Date1 is actually a date in your orginal data. It is 
one here but who knows with R :)
John Kane
Kingston ON Canada


 -Original Message-
 From: r-help@r-project.org
 Sent: Mon, 17 Aug 2015 21:15:39 -0700
 To: r-help@r-project.org
 Subject: [R] date format in xyplot
 
 To whom it may concern,
 
 I have tried to plot some numbers against time with the time on the
 X-axis shown as Jan, Feb, etc.
 
 I used the following commands:
 Raw-structure(list(Date = structure(c(6L, 7L, 2L, 4L, 12L, 9L, 7L,
 2L, 4L, 12L), .Label = c(1/10, 1/11, 11/11, 12/11, 13/10,
 19/9, 2/10, 2/11, 20/9, 26/11, 29/10, 29/11, 30/11,
 31/10, 4/10, 6/10), class = factor), Year = c(2002L,
 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L
 ), Station = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
 2L), .Label = c(E, F, H, I), class = factor), Abun = c(3.42,
 1.33, 3.67, 3.67, 3.92, 2.17, 2.5, 1.67, 6.33, 0.67), Date1 =
 structure(c(16697,
 16710, 16740, 16751, 16768, 16698, 16710, 16740, 16751, 16768
 ), class = Date)), .Names = c(Date, Year, Station, Abun,
 Date1), row.names = c(NA, 10L), class = data.frame)
 
 Raw$Date1-as.Date(Raw$Date,%d/%m)
 xyplot(Abun~Date1|as.factor(Year),Raw,type=p,xlab=list(Month,cex=1.5),ylab=list(Abundance,cex=1.5),cex=2,pch=c(16,16,21),col=c(Black,Grey,Black),strip=strip.custom(bg='white'),format=%B-%d)
 
 The date format shown on X-axis was just 10-1, 10-15
 
 I should be grateful if any one could help indicating what has gone
 wrong?
 
 Regards,
 Christine
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

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


Re: [R] How are packages installed with install_github() updated in RStudio?

2015-08-18 Thread Duncan Murdoch
On 18/08/2015 10:01 AM, Hadley Wickham wrote:
 RStudio just calls the same underlying R functions, so it doesn't make
 any difference that you're using RStudio.  Currently, there's no
 automatic way to update packages installed from github.

And to clarify a bit more:  this means if you install a patched version
of something from github that is newer than what is on CRAN, then call
update.packages(), you'll keep the new one as long as the version number
is higher than the one on CRAN.

On the other hand, if you run install.packages(foo), then you'll
install the CRAN version of foo even if you already have a newer one
from github.

Duncan Murdoch

 
 Hadley
 
 On Tue, Aug 18, 2015 at 8:14 AM, John Kane jrkrid...@inbox.com wrote:
 Hi Michal,

 Because RStudio seems to use its own method of updating you might be better 
 off asking in their forum.

 John Kane
 Kingston ON Canada


 -Original Message-
 From: prgo...@gmail.com
 Sent: Tue, 18 Aug 2015 10:43:20 +0200
 To: r-help@r-project.org
 Subject: [R] How are packages installed with install_github() updated in
 RStudio?

 Hallo.

 I use RStudio. Because of a bug in the latest CRAN version of dplyr, I
 installed the GitHub version with install_github(). Now I wonder what
 happens when there is a new version. Does RStudio update the packages
 installed from GitHub? If so, does it replace it with the new CRAN
 version,
 or a new GitHub version?

 Many thanks for you answer,
 Michal Kvasnicka

   [[alternative HTML version deleted]]

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

 
 Can't remember your password? Do you need a strong and secure password?
 Use Password manager! It stores your passwords  protects your account.

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


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] data frame formatting

2015-08-18 Thread Jon BR
Hello all,
I would like to take a data frame such as the following one:

 df -
data.frame(id=c(A,A,B,B),first=c(BX,NA,NA,LF),second=c(NA,TD,BZ,NA),third=c(NA,NA,RB,BT),fourth=c(LG,QR,NA,NA))
 df
  id first second third fourth
1  ABX   NA  NA LG
2  A  NA TD  NA QR
3  B  NA BZRB   NA
4  BLF   NABT   NA

and merge rows based on the id, such that the value in the column will be
one of four possibilities: if both values in the original df are NA, the
new value should also be NA.  If there are two non-NA values, then the
new value should read clash.  Otherwise, the new value should be
whichever value was not NA.

An example output from the command would read in df and read out:


  id first second third fourth
1  ABX   TD  NA clash
2  BLF   BZclash   NA


I'd be grateful if someone could point me in the right direction.

Thanks,
Jonathan

[[alternative HTML version deleted]]

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


Re: [R] data frame formatting

2015-08-18 Thread boB Rudis
Here's one way in base R:

df - data.frame(id=c(A,A,B,B),
 first=c(BX,NA,NA,LF),
 second=c(NA,TD,BZ,NA),
 third=c(NA,NA,RB,BT),
 fourth=c(LG,QR,NA,NA))


new_df - data.frame(do.call(rbind, by(df, df$id, function(x) {
  sapply(x[,-1], function(y) {
if (all(is.na(y))) return(NA)
if (all(!is.na(y))) return(clash)
return(as.character(y[which(!is.na(y))]))
  })
})))

new_df$id - rownames(new_df)
rownames(new_df) - NULL

new_df

##   first second third fourth id
## 1BX TD  NA  clash  A
## 2LF BZ clash   NA  B


On Tue, Aug 18, 2015 at 3:06 PM, Jon BR jonsle...@gmail.com wrote:
 df -
 data.frame(id=c(A,A,B,B),first=c(BX,NA,NA,LF),second=c(NA,TD,BZ,NA),third=c(NA,NA,RB,BT),fourth=c(LG,QR,NA,NA))
 df

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


Re: [R] How are packages installed with install_github() updated in RStudio?

2015-08-18 Thread John Kane

Thanks Hadley

I had some vague impression that RStudio was maintaining a slightly diffferent 
repository thought I am not sure why I thought that.
John Kane
Kingston ON Canada


 -Original Message-
 From: h.wick...@gmail.com
 Sent: Tue, 18 Aug 2015 09:01:09 -0500
 To: jrkrid...@inbox.com
 Subject: Re: [R] How are packages installed with install_github() updated
 in RStudio?
 
 RStudio just calls the same underlying R functions, so it doesn't make
 any difference that you're using RStudio.  Currently, there's no
 automatic way to update packages installed from github.
 
 Hadley
 
 On Tue, Aug 18, 2015 at 8:14 AM, John Kane jrkrid...@inbox.com wrote:
 Hi Michal,
 
 Because RStudio seems to use its own method of updating you might be
 better off asking in their forum.
 
 John Kane
 Kingston ON Canada
 
 
 -Original Message-
 From: prgo...@gmail.com
 Sent: Tue, 18 Aug 2015 10:43:20 +0200
 To: r-help@r-project.org
 Subject: [R] How are packages installed with install_github() updated
 in
 RStudio?
 
 Hallo.
 
 I use RStudio. Because of a bug in the latest CRAN version of dplyr, I
 installed the GitHub version with install_github(). Now I wonder what
 happens when there is a new version. Does RStudio update the packages
 installed from GitHub? If so, does it replace it with the new CRAN
 version,
 or a new GitHub version?
 
 Many thanks for you answer,
 Michal Kvasnicka
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 Can't remember your password? Do you need a strong and secure password?
 Use Password manager! It stores your passwords  protects your account.
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 
 --
 http://had.co.nz/


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks  orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Unable to get the 64-bit version of R (3.2.1 Terminal or GUI) to start on a Windows 7 machine

2015-08-18 Thread brian
I am unable to get the 64-bit version of R (3.2.1 Terminal or GUI) to
start on a Windows 7 machine.  I can get the 32-bit to start, just not
the 64-bit.

I am receiving a dialog box box that points me to four files but nothing
seems usable when examining them.

Installed to C:\Dev\R\R-3.2.1.  I have set my R_HOME environment
variable to C:\Dev\R\R-3.2.1 and added C:\Dev\R\R-3.2.1\bin\x64 to
my Windows PATH environment variable.

I have also checked the Windows Registry to make sure everything is
pointing to the x64 directory and one example is given below:

Registry Key: “HKEY_CLASSES_ROOT\RWorkspace\shell\open\command”
Registry Key Value:C:\Dev\R\R-3.2.1\bin\x64\RGui.exe %1

I have searched and have tried for some time to resolve this based on
what I have found but am not having any success.  Any help you can
provide would be greatly appreciated.

I have embedded three of the four troubleshooting files as text below in
the hope that it might be helpful.  

The WER8836.tmp.wmi.txt file looks like Windows is using a 32-Bit
processor but it is a 64-bit install of the OS.  I have embedded below:
instance of Win32_Processor
{
Family = 198;
};

instance of Win32_OperatingSystem
{
BuildNumber = 7601;
OSLanguage = 1033;
ProductType = 1;
ServicePackMajorVersion = 1;
ServicePackMinorVersion = 0;
SuiteMask = 272;
Version = 6.1.7601;
};

instance of Win32_ComputerSystem
{
Domain = chkenergy.net;
Manufacturer = Dell Inc.;
Model = Latitude E6420;
Name = CHK4WL6DS1;
PartOfDomain = TRUE;
UserName = CHKENERGY\\bmorris2;
};

The WER8798.tmp.apcompat.txt is another file given for troubleshooting
in the error message.  I have embedded it below as well:
?xml version=1.0 encoding=UTF-16?
DATABASE
EXE NAME=Rgui.exe FILTER=CMI_FILTER_PRIVACY
MATCHING_FILE NAME=open.exe SIZE=16384 CHECKSUM=0xB287F521
MODULE_TYPE=WIN32 PE_CHECKSUM=0x6F3E LINKER_VERSION=0x0
LINK_DATE=06/18/2015 17:20:02 UPTO_LINK_DATE=06/18/2015 17:20:02
EXE_WRAPPER=0x0 /
MATCHING_FILE NAME=R.dll SIZE=25820672 CHECKSUM=0x6850795A
BIN_FILE_VERSION=3.21.2995.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows DLL FILE_VERSION=3.2.1  (2015-06-18)
LEGAL_COPYRIGHT=R Core Team 1995-2015 VERDATEHI=0x0 VERDATELO=0x0
VERFILEOS=0x4 VERFILETYPE=0x2 MODULE_TYPE=WIN32
PE_CHECKSUM=0x18A30E0 LINKER_VERSION=0x0
UPTO_BIN_FILE_VERSION=3.21.2995.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=06/18/2015 17:19:42 UPTO_LINK_DATE=06/18/2015 17:19:42
EXPORT_NAME=R.dll VER_LANGUAGE=English (United States) [0x409]
EXE_WRAPPER=0x0 /
MATCHING_FILE NAME=R.exe SIZE=39936 CHECKSUM=0x8919B6FD
BIN_FILE_VERSION=3.21.2995.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows front-end FILE_VERSION=3.2.1 
(2015-06-18) LEGAL_COPYRIGHT=R Core Team 1995-2015 VERDATEHI=0x0
VERDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1 MODULE_TYPE=WIN32
PE_CHECKSUM=0x15CE3 LINKER_VERSION=0x0
UPTO_BIN_FILE_VERSION=3.21.2995.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=06/18/2015 17:20:00 UPTO_LINK_DATE=06/18/2015 17:20:00
VER_LANGUAGE=English (United States) [0x409] EXE_WRAPPER=0x0 /
MATCHING_FILE NAME=Rblas.dll SIZE=343623 CHECKSUM=0x3B624D2B
BIN_FILE_VERSION=3.21.2995.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows DLL FILE_VERSION=3.2.1  (2015-06-18)
LEGAL_COPYRIGHT=R Core Team 1995-2015 VERDATEHI=0x0 VERDATELO=0x0
VERFILEOS=0x4 VERFILETYPE=0x2 MODULE_TYPE=WIN32
PE_CHECKSUM=0x5F357 LINKER_VERSION=0x0
UPTO_BIN_FILE_VERSION=3.21.2995.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=06/18/2015 17:19:54 UPTO_LINK_DATE=06/18/2015 17:19:54
EXPORT_NAME=Rblas.dll VER_LANGUAGE=English (United States) [0x409]
EXE_WRAPPER=0x0 /
MATCHING_FILE NAME=Rcmd.exe SIZE=39936 CHECKSUM=0x8F60F12D
BIN_FILE_VERSION=3.21.2995.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows front-end FILE_VERSION=3.2.1 
(2015-06-18) LEGAL_COPYRIGHT=R Core Team 1995-2015 VERDATEHI=0x0
VERDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1 MODULE_TYPE=WIN32
PE_CHECKSUM=0x13E5C LINKER_VERSION=0x0
UPTO_BIN_FILE_VERSION=3.21.2995.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=06/18/2015 17:19:59 UPTO_LINK_DATE=06/18/2015 17:19:59
VER_LANGUAGE=English (United States) [0x409] EXE_WRAPPER=0x0 /
MATCHING_FILE NAME=Rfe.exe SIZE=23040 CHECKSUM=0x8D69D4D8
BIN_FILE_VERSION=3.21.2995.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows front-end FILE_VERSION=3.2.1 
(2015-06-18) LEGAL_COPYRIGHT=R Core Team 1995-2015 VERDATEHI=0x0
VERDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1 MODULE_TYPE=WIN32
PE_CHECKSUM=0x13155 LINKER_VERSION=0x0
UPTO_BIN_FILE_VERSION=3.21.2995.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=06/18/2015 17:20:03 UPTO_LINK_DATE=06/18/2015 17:20:03
VER_LANGUAGE=English (United States) [0x409] EXE_WRAPPER=0x0 /
MATCHING_FILE NAME=Rgraphapp.dll SIZE=377702
CHECKSUM=0xC8C6CA6E BIN_FILE_VERSION=3.21.2995.0
BIN_PRODUCT_VERSION=3.0.0.0 FILE_DESCRIPTION=Graphapp DLL for R
FILE_VERSION=3.2.1  (2015-06-18) LEGAL_COPYRIGHT=R Core Team
1995-2015 

Re: [R] Survival Analysis and Predict time-to-death

2015-08-18 Thread Göran Broström



On 2015-08-18 01:44, David Winsemius wrote:


On Aug 17, 2015, at 1:51 PM, David Winsemius wrote:



On Aug 17, 2015, at 12:10 PM, survivalUser wrote:


Dear All,

I would like to build a model, based on survival analysis on some
data, that is able to predict the /*expected time until death*/
for a new data instance.


Are you sure you want to use life expectancy as the outcome? In
order to establish a mathematical expectation  you need to have
know the risk at all time in the future, which as pointed out in
the print.survfit help page is undefined unless the last
observation is a death. Very few datasets support such an estimate.
If on the other hand you have sufficient events in the future, then
you may be able to more readily justify an estimate of a median
survival.


Dear survivalUser;

I've been reminded that you later asked for a parametric model built
with survreg. The above commentary applies to the coxph models and
objects and not to survreg objects. If you do have a parametric
model, even with incomplete observation then calculating life
expectancy should be a simple matter of plugging the parameters for
the distribution's mean value, since life-expectancy is the
statistical mean. So maybe you do want such a modle. The default
survreg  distribution is weibull so just go to your mathematical
statistics text and look up the formula for the mean of a Weibull
distribution with the estimated parameters.

No need for 'the mathematical statistics text': The necessary 
information is found on the help page for the Weibull distribution: E(T) 
=  b Gamma(1 + 1/a), where 'b' is scale (really!) and 'a' is shape. You 
must however take into account the special parametrization that is used 
by 'survreg'; see its help page for how to do it.


Alternatively, use 'aftreg' in the package 'eha' and get the same 
parametrization as in base  R.


After getting the baseline expectation by the formula above, simply 
multiply that value by exp(-lp) to get the expected life for an 
individual with linear predictor lp.


A useful alternative is simulation (use 'rweibull') or numerical 
integration, especially for estimating remaining expected life 'later in 
life'. And for other distributions than the Weibull.



Göran Broström
(author of the eha package)

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


Re: [R] Survival Analysis and Predict time-to-death

2015-08-18 Thread David Winsemius
It depends on several factors. You need answers to all these questions:  How 
many events occurred, ... and was the period of observation long enough to 
cover a significant fraction of the life expectancy, …. and is there external 
evidence or theory that will help establish that this process should follow 
Weibull statistics?

— 
David.

 On Aug 17, 2015, at 2:18 PM, survivalUser tufanomich...@hotmail.it wrote:
 
 Thank you David for your answer.
 
 Some follow-up questions:
 
 - So, do you think that try to estimate the life expectancy would be risky
 and probably not justifiable? Is there some sort of 'confidence' that the
 model could give me for a prediction?
 
 - type=response - I found it here: 
 https://stat.ethz.ch/R-manual/R-devel/library/survival/html/predict.survreg.html
 
 I have not tried it yet, but I was planning to use that because it says that
 predict the original scale of the data.
 
 - Yes, I think they are time-varying predictors. Would you suggest other
 models? (coxph?)
 
 Overall, do you think this analysis is feasible/correct? Predicting how much
 time a new individual (with those covariates) will be alive till death, is a
 reasonable thing to predict with survival model?
 
 Thank you again!
 
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Survival-Analysis-and-Predict-time-to-death-tp4711198p4711207.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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

[R] R: forecasting a binary time series using the VLMC package

2015-08-18 Thread Gauthier Pierard
I would like to ask some clarifications on the method:

predict.vlmc

My problem is to forecast a binary time series one period ahead. I have a
time series bin2 of length 2000. When using

m2-vlmc(bin2)
fc2-predict(m2)


   1. fc2[i] is a prediction for i, not for i+1, is that correct? I am
   aware that the documentation stipulates Compute predictions on a fitted
   VLMC object for each (but the first) element of another discrete time
   series., but am still asking to make it 100% clear.
   2.

   I guess that the predictions fc2 are based on the full range [1:2000] of
   bin2, because I fitted a VLMC to the full timeseries on the first line
   above. Therefore, I am actually forecasting each period by already knowing
   the future, is that correct?
   3.

   In order to forecast while not knowing the future, can I do the
   following:

   for(i in 1000:1999) {
   retFull2 - window(retFull, start=1, end=i)
   bin2- window(bin, start=1, end=i)
   dummy-ts(c(bin2,0))  #Adding a dummy zero at the end of each window
 #so that a prediction will be made for i+1 as well
 #without using i+1 while fitting the model
   m2-vlmc(bin2) # bin2 granges from 1 to i
   fct2-predict(m2, dummy)[i+1,1]  #forecasting on an 
artificially-added i+1 index.}

   I am adding a dummy zero at the end of each windowed ts, and
   predicting for i+1 as well. Is it relevant at all? Any suggestions? Any
   practical suggestions on how to best forecast these binary time series?

Many thanks in advance, cheers

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] NB-L Regression

2015-08-18 Thread Serpil Aktaş Altunay
Hi All,

I am trying to run Negative Binomial Lindley regression under glm. But
NB-L is not defined in the family group. I will perform a simulation. The
model has only one covariate generated from uniform distribution, the count
response variable follows the NB distribution.

the model should be  glm(count~x, family=nbl)

I would greatly appreciate any help.

Serpil

[[alternative HTML version deleted]]

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


Re: [R] date format in xyplot

2015-08-18 Thread Duncan Mackay
Hi

I forgot to change the format and put the panel back in - I was trying to get 
the data right

see ? strptime for a list of all the combinations for dates.

Have a look at 
http://lmdvr.r-forge.r-project.org/figures/figures.html
which may give you some ideas.

If you want  to restrict data to a certain period you will have to put limits 
on the x axis and you do that in the scales argument ie x =list(limits = c(min 
date, max date) )  NB date format
For one panel it is easy but for 2+ it can be tricky as you will be working 
with a list. 
Then the code would be something like

xyplot(Abun~Date2|Year, Raw, 
scales = list(x = list(limits = list(c(min y1, max y1), c(min y2, 
max y2))) 
..
)
where y[1...] is the applicable year 
have a look at aspect which may improve things for the final plot if desired.

If you want to space groups of years-- see between 
 
Regards

Duncan

-Original Message-
From: Christine Lee [mailto:leptostra...@yahoo.com] 
Sent: Wednesday, 19 August 2015 00:26
To: R; Duncan Mackay
Subject: RE: [R] date format in xyplot

Thank you Duncan,

I have tried the scales function.  It ends up with 2015-09-15, which is 
acceptable. It is far much better than 09 15 shown on the axis.  The problem 
is the data were obtained in different years.  This makes 2015 shown in 
lattice plots of different years.  I have tried to put in the year in the raw 
data (such as 1/10/2013), but the plot is really bizzard, with the 2002 plots 
have all the points on the left of the plot whereas 2013 plots have all the 
data points on the right of the plots because the x-axis shows data from 2001 
to 2013.  I feel like hopeless to insist to have the axis label shown as Sep 
15 because it seems to be the problem of my computer setting.  Is there a way 
to shows graphs in different years, but with the same scale beginning from 
September to December?

Regards,
Christine



2015年8月18日 星期二,Duncan Mackay dulca...@bigpond.com 寫道﹕

 主題: RE: [R] date format in xyplot
 收件人: R r-help@r-project.org
 副本(CC): 'Christine Lee' leptostra...@yahoo.com
 日期: 2015年8月18日,星期二,下午4:08

 Hi Christine

 If somethings go wrong:
 1 first check your data

 str(Raw)
 'data.frame':   10 obs. of 
 5 variables:
  $ Date   : Factor
 w/ 16 levels 1/10,1/11,..: 6 7 2 4
 12 9 7 2 4 12
  $ Year   : int 
 2002 2002 2002 2002 2002 2002 2002 2002 2002 2002
  $ Station: Factor w/ 4 levels
 E,F,H,I: 1 1
 1 1 1 2 2 2 2 2
  $ Abun   : num 
 3.42 1.33 3.67 3.67 3.92 2.17 2.5 1.67 6.33 0.67
  $ Date1  : Date, format:
 2015-09-19 2015-10-02
 2015-11-01
 2015-11-12 ...

 Raw$Date2 - as.character(Raw$Date1)
 Raw$Date2
 [1]
 2015-09-19 2015-10-02
 2015-11-01 2015-11-12
 2015-11-29
 2015-09-20 2015-10-02
 2015-11-01 2015-11-12
 2015-11-29
 Raw$Date2 -
 as.Date(Raw$Date2, %Y-%m-%d)

 2 read the help guide again if not done
 recently ?lattice::xyplot or ?xyplot
 3 start
 with a minimum number of arguments

 xyplot(Abun~Date2|as.factor(Year), Raw)
 or 
 xyplot(Abun~Date2, Raw)
 if you are still having problems

 Dates are hard work in any
 language as they are not consistent so:
 a. 
 use  default
 b.  use your own 

 This works

 xyplot(Abun~Date2|as.factor(Year), Raw,
par.settings =
 list(stripbackground = transparent), #
 background
 colour controlled here
type=p,
scales = list(x = list(at =
 sort(c(seq(as.Date(Raw$Date2[1]-4), by =
 months, length = 4),

seq(as.Date(Raw$Date2[1]+12),
 by
 = months, length = 3))),

labels =
 format(sort(c(seq(as.Date(Raw$Date2[1]-4), by =
 months, length = 4),
  
 seq(as.Date(Raw$Date2[1]+12), by =
 months, length = 3))), %m-%d) )
 ),

xlab=list(Month,cex=1.5),

ylab=list(Abundance,cex=1.5),
cex=2,
  
  pch=c(16,16,21),

col=c(Black,Grey,Black)
 )

 par.settings
 is confining the parameters set by trellis.par.set()  to
 the
 function
 to get them

 names(trellis.par.get() )
 and going further
 trellis.par.get()$superpose.symbol
 will give you the values for
 superpose.symbol

 Beware: Do
 not make the labels etc so big that the axis labels are hard
 to
 read. Think of final size

 Regards

 Duncan

 Duncan
 Mackay
 Department of Agronomy and Soil
 Science
 University of New England
 Armidale NSW 2351
 Email: home:
 mac...@northnet.com.au

 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org]
 On Behalf Of Christine
 Lee via R-help
 Sent: Tuesday, 18 August 2015 14:16
 To: r-help@r-project.org
 Subject: [R] date format in xyplot

 To whom it may concern,

 I have tried to plot some
 numbers against time with the time on the X-axis
 shown as Jan, Feb,
 etc.

 I used the following
 commands:
 Raw-structure(list(Date =
 structure(c(6L, 7L, 2L, 4L, 12L, 9L, 7L, 
 2L, 4L, 12L), .Label = c(1/10,
 1/11, 11/11, 12/11,
 13/10, 
 19/9,
 2/10, 2/11, 20/9,
 26/11, 29/10, 29/11,
 30/11, 
 31/10,
 4/10, 6/10), class =
 

[R] Output In R

2015-08-18 Thread Shivi82
Hello All, 

 As i am a newbie in R so most of you would have seen this question zillion
times. I searched for the answer on this forum as well on other various
forums however could not find the answer i am looking for.

 I am dplyr package and used a very basic code:
 select(june,city,state,mod)

 The data sheet i am using has more than 3 million observations but the
console does not print all of them and show only few options and give a
message:
[ reached getOption(max.print) -- omitted 376341 rows ]


 What is the option that i need to add to see all values in the output.
Similarly once i scroll down and then if i scroll up i am not able to see
the values starting from row #1. Please suggest



--
View this message in context: 
http://r.789695.n4.nabble.com/Output-In-R-tp4711227.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Running R in Server

2015-08-18 Thread Bos, Roger
There is probably nothing that can give you a step by step guide.  You are 
touching on a couple of different subjects.  If you just want to run code 
automatically on a windows server you can use task scheduler to call Rscript 
filename.R.  If you want to create Web application, that's a bit harder.  I 
still use Rpad, which works on windows, but development of it stopped a long 
time so I wouldn't suggest using it.  All the other web application approaches 
such as RApache only work on Linux.

If I understand correctly what you want to do, you might be able to create a 
HTML report using RMarkdown and host that on the website.  If you really need a 
web app, I suggest looking into Shiny.  You can make a shiny app, host it for 
free on the cloud.  You will have a lot to learn, but it will be time well 
spent.  https://www.rstudio.com/

Thanks,

Roger



***
This message and any attachments are for the intended recipient's use only.
This message may contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by an error in transmission.
If you have received this message in error, please immediately
notify the sender by e-mail, delete the message, any attachments and all
copies from your system and destroy any hard copies.  You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Swagato 
Chatterjee
Sent: Sunday, August 16, 2015 4:17 AM
To: r-help@r-project.org
Subject: [R] Running R in Server

Hello,

I have written a R script which runs a regression of a dataset and saves the 
result in a csv file.

Now this dataset has to be edited periodically which is done in a server. I 
need to run the R script in a server so that the results can also be shared in 
a server and used in a web application.

I have coded in R and have used R in windows. I have never used Ubuntu/Linux. 
Is there a step by step guide on how to run a R code in server?

Thanks and Regards,

--
Swagato Chatterjee

[[alternative HTML version deleted]]

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


Re: [R] How are packages installed with install_github() updated in RStudio?

2015-08-18 Thread Hadley Wickham
RStudio just calls the same underlying R functions, so it doesn't make
any difference that you're using RStudio.  Currently, there's no
automatic way to update packages installed from github.

Hadley

On Tue, Aug 18, 2015 at 8:14 AM, John Kane jrkrid...@inbox.com wrote:
 Hi Michal,

 Because RStudio seems to use its own method of updating you might be better 
 off asking in their forum.

 John Kane
 Kingston ON Canada


 -Original Message-
 From: prgo...@gmail.com
 Sent: Tue, 18 Aug 2015 10:43:20 +0200
 To: r-help@r-project.org
 Subject: [R] How are packages installed with install_github() updated in
 RStudio?

 Hallo.

 I use RStudio. Because of a bug in the latest CRAN version of dplyr, I
 installed the GitHub version with install_github(). Now I wonder what
 happens when there is a new version. Does RStudio update the packages
 installed from GitHub? If so, does it replace it with the new CRAN
 version,
 or a new GitHub version?

 Many thanks for you answer,
 Michal Kvasnicka

   [[alternative HTML version deleted]]

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

 
 Can't remember your password? Do you need a strong and secure password?
 Use Password manager! It stores your passwords  protects your account.

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



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

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


Re: [R] Running R in Server

2015-08-18 Thread Loris Bennett
Swagato Chatterjee swagato1...@gmail.com writes:

 Hello,

 I have written a R script which runs a regression of a dataset and saves
 the result in a csv file.

 Now this dataset has to be edited periodically which is done in a server. I
 need to run the R script in a server so that the results can also be shared
 in a server and used in a web application.

 I have coded in R and have used R in windows. I have never used
 Ubuntu/Linux. Is there a step by step guide on how to run a R code in
 server?

 Thanks and Regards,

 Swagato

If you are lucky, you can just copy your script to the server and call

Rscript /path/to/your/r/script

on the linux command line.

However, you'll probably have to make sure that all the packages you
need are installed on the server.

HTH

Loris

-- 
This signature is currently under construction.

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


Re: [R] Survival analysis and predict time-to-death

2015-08-18 Thread Therneau, Terry M., Ph.D.
I read this list a day late as a digest so my answers are rarely the first.  (Which is 
nice as David W answers most of the survival questions for me!)


What you are asking is reasonable, and in fact is common practice in the realm of 
industrial reliability, e.g., Meeker and Escobar, Statistical Methods for Reliability 
Analysis.  Extrapolation of the survival curve to obtain the mean and percentiles of the 
lifetime distribution for some device (e.g. a washing machine) is their bread and butter, 
used for instance to determine the right size for an inventory of spare parts.  For most 
of us on this list who do medical statistics and live in the Kaplan-Meier/ Cox model world 
the ideas are uncommon.  I was lucky enough to sit through one of Bill Meeker's short 
courses and retain some (minimal) memory of it.


  1. You are correct that parametric models are essential.  If the extrapolation is 
substantial (30% or more censored, say), then the choice of distribution can be critical. 
 If failure is due to repeated insult, e.g., the multi-hit model, then Weibull tends to 
be preferred; if it is from degradation, e.g., flexing of a diaphram, then the log-normal. 
 Beyond this you need more guidance than mine.


  2. The survreg routine assumes that log(y) ~ covariates + error.  For a log-normal 
distribion the error is Gaussian and thus the predict(fit, type='response') will be 
exp(predicted mean of log time), which is not the predicted mean time.  For Weibull the 
error dist is asymmetric so things are more muddy.  Each is the MLE prediction for the 
subject, just not interpretable as a mean.  To get the actual mean you need to look up the 
formulas for Weibull and/or lognormal in a textbook, and map from the survreg 
parameterization to whatever one the textbook uses.  The two parameterizations are never 
the same.


  3. Another option is predicted quantiles.  ?predict.survreg shows how to get the entire 
survival curve.  The mean can be obtained as the area under the survival curve.  Relevant 
to your question, the expected time remaining for a subject still alive at time =10, say, 
is  integral(S(t), from 10 to infin) / S(10), where S is the survival curve.  You can also 
read off quantiles of the expected remaining life.


Terry Therneau
(author of the survival package)

On 08/18/2015 05:00 AM, r-help-requ...@r-project.org wrote:

Dear All,

I would like to build a model, based on survival analysis on some data, that
is able to predict the /*expected time until death*/ for a new data
instance.

Data
For each individual in the population I have the, for each unit of time, the
status information and several continuous covariates for that particular
time. The data is right censored since at the end of the time interval
analyzed, instances could be still alive and die later.

Model
I created the model using R and the survreg function:

lfit - survreg(Surv(time, status) ~ X)

where:
- time is the time vector
- status is the status vector (0 alive, 1 death)
- X is a bind of multiple vectors of covariates

Predict time to death
Given a new individual with some covariates values, I would like to predict
the estimated time to death. In other words, the number of time units for
which the individual will be still alive till his death.

I think I can use this:

ptime - predict(lfit, newdata=data.frame(X=NEWDATA), type='response')

Is that correct? Am I going to get the expected-time-to-death that I would
like to have?

In theory, I could provide also the time information (the time when the
individual has those covariates values), should I simply add that in the
newdata:

ptime - predict(lfit, newdata=data.frame(time=TIME, X=NEWDATA),
type='response')

Is that correct? Is this going to improve the prediction? (for my data, the
time already passed should be an important variable).

Any other suggestions or comments?

Thank you!


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


Re: [R] Running R in Server

2015-08-18 Thread John McKown
On Sun, Aug 16, 2015 at 3:27 AM, Swagato Chatterjee swagato1...@gmail.com
wrote:

 Hello,

 I have written a R script which runs a regression of a dataset and saves
 the result in a csv file.

 Now this dataset has to be edited periodically which is done in a server. I
 need to run the R script in a server so that the results can also be shared
 in a server and used in a web application.

 I have coded in R and have used R in windows. I have never used
 Ubuntu/Linux. Is there a step by step guide on how to run a R code in
 server?

 Thanks and Regards,

 Swagato


I
​ was going to answer yesterday, but work went insane. Also, I was hoping
someone else had something, because I don't have any step by step
instructions.

This is a rather complicated question. So I'm going to ask a number of
questions and make some statement for you to correct, if necessary.​

​Statement: You have a Windows desktop and have used R on it, so you are
familiar with R in a Windows environment.​
Statement: You are not Linux (Ubuntu) trained.
Statement: You wrote an R script on Windows, which works, but you need to
run it on Ubuntu.

The above is my starting point. Now I have some questions.

Can you connect to the Ubuntu server from your Windows desktop? If so, how?
If not, I'm confused about how you could get anything to run on the Ubuntu
server.

Where does this dataset reside? On you desktop? On a Windows shared
folder? On the Ubuntu server? Other?

Who or what edits the dataset? That is, is it always yourself? Some one
in your group? Some other human? Some automated process?

Why can't you run the R script as you do now, then deploy the results to
the Ubuntu server? Since I don't know the environment that the Ubuntu
server runs in, I can't address how to deploy an updated file into it. I
assume you have some sort of deployment software. It could be as easy as
being able to ftp the results from your desktop to the proper places on the
Ubuntu server.

​===

Now, whatever the answers are to the above, you'll likely need some help
from your Ubuntu server people. My first approach, given my ignorance,
would be that I would have something set up so that you could edit this
dataset on your desktop (assuming that's what you do). I would then have
you ftp it ​to a special directory on the Ubuntu server set up especially
for this function. Now, what remains would be running the R script, likely
in a shell script (like a PowerShell command file), whenever you do the
ftp. There is a function in Ubuntu (any Linux) called icrond. This is a
daemon (Windows service equivalent) which can monitor a file or directory
for changes. When a change is detected it can take an action. In this case
it would be to schedule the execution of the previously mentioned shell
script. The shell script would then take the actions necessary to do the
R script (R CMD script-name parameters ... for instance) and then deploy
the results to the web server (however you normally do this).  Setting up
the icrond environment is going to take some work by your Ubuntu
administrator.

===

I hope this was at least the start of some help to you.




-- 

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! 
John McKown

[[alternative HTML version deleted]]

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

Re: [R] date format in xyplot

2015-08-18 Thread Christine Lee via R-help
Thank you Duncan,

I have tried the scales function.  It ends up with 2015-09-15, which is 
acceptable. It is far much better than 09 15 shown on the axis.  The problem 
is the data were obtained in different years.  This makes 2015 shown in 
lattice plots of different years.  I have tried to put in the year in the raw 
data (such as 1/10/2013), but the plot is really bizzard, with the 2002 plots 
have all the points on the left of the plot whereas 2013 plots have all the 
data points on the right of the plots because the x-axis shows data from 2001 
to 2013.  I feel like hopeless to insist to have the axis label shown as Sep 
15 because it seems to be the problem of my computer setting.  Is there a way 
to shows graphs in different years, but with the same scale beginning from 
September to December?

Regards,
Christine



2015年8月18日 星期二,Duncan Mackay dulca...@bigpond.com 寫道﹕

 主題: RE: [R] date format in xyplot
 收件人: R r-help@r-project.org

 日期: 2015年8月18日,星期二,下午4:08

 Hi Christine

 If somethings go wrong:
 1 first check your data

 str(Raw)
 'data.frame':   10 obs. of 
 5 variables:
  $ Date   : Factor
 w/ 16 levels 1/10,1/11,..: 6 7 2 4
 12 9 7 2 4 12
  $ Year   : int 
 2002 2002 2002 2002 2002 2002 2002 2002 2002 2002
  $ Station: Factor w/ 4 levels
 E,F,H,I: 1 1
 1 1 1 2 2 2 2 2
  $ Abun   : num 
 3.42 1.33 3.67 3.67 3.92 2.17 2.5 1.67 6.33 0.67
  $ Date1  : Date, format:
 2015-09-19 2015-10-02
 2015-11-01
 2015-11-12 ...

 Raw$Date2 - as.character(Raw$Date1)
 Raw$Date2
 [1]
 2015-09-19 2015-10-02
 2015-11-01 2015-11-12
 2015-11-29
 2015-09-20 2015-10-02
 2015-11-01 2015-11-12
 2015-11-29
 Raw$Date2 -
 as.Date(Raw$Date2, %Y-%m-%d)

 2 read the help guide again if not done
 recently ?lattice::xyplot or ?xyplot
 3 start
 with a minimum number of arguments

 xyplot(Abun~Date2|as.factor(Year), Raw)
 or 
 xyplot(Abun~Date2, Raw)
 if you are still having problems

 Dates are hard work in any
 language as they are not consistent so:
 a. 
 use  default
 b.  use your own 

 This works

 xyplot(Abun~Date2|as.factor(Year), Raw,
        par.settings =
 list(stripbackground = transparent), #
 background
 colour controlled here
        type=p,
        scales = list(x = list(at =
 sort(c(seq(as.Date(Raw$Date2[1]-4), by =
 months, length = 4),
                                
            seq(as.Date(Raw$Date2[1]+12),
 by
 = months, length = 3))),
                            
    labels =
 format(sort(c(seq(as.Date(Raw$Date2[1]-4), by =
 months, length = 4),
  
 seq(as.Date(Raw$Date2[1]+12), by =
 months, length = 3))), %m-%d) )
 ),
    
    xlab=list(Month,cex=1.5),
    
    ylab=list(Abundance,cex=1.5),
        cex=2,
  
      pch=c(16,16,21),
    
    col=c(Black,Grey,Black)
 )

 par.settings
 is confining the parameters set by trellis.par.set()  to
 the
 function
 to get them

 names(trellis.par.get() )
 and going further
 trellis.par.get()$superpose.symbol
 will give you the values for
 superpose.symbol

 Beware: Do
 not make the labels etc so big that the axis labels are hard
 to
 read. Think of final size

 Regards

 Duncan

 Duncan
 Mackay
 Department of Agronomy and Soil
 Science
 University of New England
 Armidale NSW 2351
 Email: home:
 mac...@northnet.com.au

 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org]
 On Behalf Of Christine
 Lee via R-help
 Sent: Tuesday, 18 August 2015 14:16
 To: r-help@r-project.org
 Subject: [R] date format in xyplot

 To whom it may concern,

 I have tried to plot some
 numbers against time with the time on the X-axis
 shown as Jan, Feb,
 etc.

 I used the following
 commands:
 Raw-structure(list(Date =
 structure(c(6L, 7L, 2L, 4L, 12L, 9L, 7L, 
 2L, 4L, 12L), .Label = c(1/10,
 1/11, 11/11, 12/11,
 13/10, 
 19/9,
 2/10, 2/11, 20/9,
 26/11, 29/10, 29/11,
 30/11, 
 31/10,
 4/10, 6/10), class =
 factor), Year = c(2002L, 
 2002L,
 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L, 2002L
 ), Station = structure(c(1L, 1L, 1L, 1L, 1L,
 2L, 2L, 2L, 2L, 
 2L), .Label =
 c(E, F, H,
 I), class = factor), Abun = c(3.42,

 1.33, 3.67, 3.67, 3.92, 2.17, 2.5, 1.67,
 6.33, 0.67), Date1 =
 structure(c(16697, 
 16710, 16740, 16751, 16768, 16698, 16710,
 16740, 16751, 16768
 ), class =
 Date)), .Names = c(Date,
 Year, Station, Abun, 
 Date1), row.names = c(NA, 10L),
 class = data.frame)

 Raw$Date1-as.Date(Raw$Date,%d/%m)
 xyplot(Abun~Date1|as.factor(Year),Raw,type=p,xlab=list(Month,cex=1.5),yl
 ab=list(Abundance,cex=1.5),cex=2,pch=c(16,16,21),col=c(Black,Grey,Bla
 ck),strip=strip.custom(bg='white'),format=%B-%d)

 The date format shown on
 X-axis was just 10-1, 10-15

 I should be grateful if any
 one could help indicating what has gone wrong?

 Regards,
 Christine

 __
 R-help@r-project.org
 mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide 

Re: [R] Output In R

2015-08-18 Thread Greg Snow
I would suggest that instead of trying to view all the results in the
console that you save the result into a object then use the View (note
the capitol V) function to be able to scroll through the results.  The
head and tail functions have already been mentioned and I second their
use for a quick view.  Since you are already using dplyr you should
look at the slice (and possibly filter) function for another way to
display pieces of the resulting object.

On Tue, Aug 18, 2015 at 6:41 AM, Shivi82 shivibha...@ymail.com wrote:
 Hello All,

  As i am a newbie in R so most of you would have seen this question zillion
 times. I searched for the answer on this forum as well on other various
 forums however could not find the answer i am looking for.

  I am dplyr package and used a very basic code:
  select(june,city,state,mod)

  The data sheet i am using has more than 3 million observations but the
 console does not print all of them and show only few options and give a
 message:
 [ reached getOption(max.print) -- omitted 376341 rows ]


  What is the option that i need to add to see all values in the output.
 Similarly once i scroll down and then if i scroll up i am not able to see
 the values starting from row #1. Please suggest



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Output-In-R-tp4711227.html
 Sent from the R help mailing list archive at Nabble.com.

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



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

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


Re: [R] Output In R

2015-08-18 Thread Loris Bennett
Shivi82 shivibha...@ymail.com writes:

 Hello All, 

  As i am a newbie in R so most of you would have seen this question zillion
 times. I searched for the answer on this forum as well on other various
 forums however could not find the answer i am looking for.

  I am dplyr package and used a very basic code:
  select(june,city,state,mod)

  The data sheet i am using has more than 3 million observations but the
 console does not print all of them and show only few options and give a
 message:
 [ reached getOption(max.print) -- omitted 376341 rows ]


  What is the option that i need to add to see all values in the output.
 Similarly once i scroll down and then if i scroll up i am not able to see
 the values starting from row #1. Please suggest

You need to sharpen your searching skills.  The first result of
looking  for

r max.print

via a well-known search engine is a question on StackOverflow.  One of
the answers given there is to set the value of max.print in the
following manner:

options(max.print=99)

I'll leave finding the appropriate value as an exercise for the reader.

Cheers,

Loris

-- 
This signature is currently under construction.

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


Re: [R] Output In R

2015-08-18 Thread Scott Tetrick
?write.csv and look at with the editor of choice.



On Tue, Aug 18, 2015 at 6:41 AM, Shivi82 shivibha...@ymail.com wrote:

 Hello All,

  As i am a newbie in R so most of you would have seen this question zillion
 times. I searched for the answer on this forum as well on other various
 forums however could not find the answer i am looking for.

  I am dplyr package and used a very basic code:
  select(june,city,state,mod)

  The data sheet i am using has more than 3 million observations but the
 console does not print all of them and show only few options and give a
 message:
 [ reached getOption(max.print) -- omitted 376341 rows ]


  What is the option that i need to add to see all values in the output.
 Similarly once i scroll down and then if i scroll up i am not able to see
 the values starting from row #1. Please suggest



 --
 View this message in context:
 http://r.789695.n4.nabble.com/Output-In-R-tp4711227.html
 Sent from the R help mailing list archive at Nabble.com.

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


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Non linear regression - Von Bertalanffy Growth Function - singular gradient matrix at initial parameter estimates

2015-08-18 Thread Xochitl CORMON

Dear all,

I am trying to estimate VBGF parameters K and Linf using non linear 
regression and nls(). First I used a classic approach where I estimate 
both parameters together as below with alkdyr being a subset per year 
of my age-length-key database and running in a loop.


vbgf.par - nls(Lgtcm ~  Linf *(1 - exp(-K * (Age - tzero))), start = 
c(K= 0.07, Linf = 177.1), data=alkdyr)


I obtain an estimation of both parameters that are strongly correlated. 
Indeed after plotting Linf ~ K and fitting a linear regression I obtain 
a function (Linf = a + b*K) with R2= 0.8 and a = 215, b = -763.


In this context, to take into account explicitly correlation between 
parameters, I decided to fit a new non linear regression derivate from 
VBGF but where Linf is expressed depending on K (I am most interested in 
K). To do so, I tried this model:
vbgf.par - nls(Lgtcm ~  (a + (b*k)) *(1 - exp(-k * (Age - tzero))), 
start = c(k= 0.07, a= 215, b=-763), data=alkdyr)


Unfortunately at this point I cannot go further as I get the error 
message singular gradient matrix at initial parameter estimates.


I tried to use alg= plinear (which I am not sure I understand properly 
yet). If I give a starting value for a and b only, I have an error 
message stating step factor below minFactor (even when minFactor is 
set to 1000).


Any help will be more than welcome as this is quite urgent

Best,

Xochitl C.




--

   

Xochitl CORMON
+33 (0)3 21 99 56 84

Doctorante en écologie marine et science halieutique
PhD student in marine ecology and fishery science

   

IFREMER
Centre Manche Mer du Nord
150 quai Gambetta
62200 Boulogne-sur-Mer

   

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


Re: [R] Running R in Server

2015-08-18 Thread arnaud gaboury
On Sun, Aug 16, 2015, 2:29 PM Swagato Chatterjee swagato1...@gmail.com
wrote:

Hello,

I have written a R script which runs a regression of a dataset and saves
the result in a csv file.

Now this dataset has to be edited periodically which is done in a server. I
need to run the R script in a server so that the results can also be shared
in a server and used in a web application.

Have a look at deployR on Revolutioanalytic website. There is a free
open-source solution for windows.

I have coded in R and have used R in windows. I have never used
Ubuntu/Linux. Is there a step by step guide on how to run a R code in
server?

Thanks and Regards,

Swagato

[[alternative HTML version deleted]]

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

[[alternative HTML version deleted]]

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


Re: [R] Non linear regression - Von Bertalanffy Growth Function - singular gradient matrix at initial parameter estimates

2015-08-18 Thread Bert Gunter
These appear to be primarily statistics/nonlinear optimization issues
that are off topic here, which is about R programming. Post on a
statistics list like stats.stackexchange.com instead.


Cheers,
Bert




Bert Gunter

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
   -- Clifford Stoll


On Tue, Aug 18, 2015 at 9:08 AM, Xochitl CORMON
xochitl.cor...@ifremer.fr wrote:
 Dear all,

 I am trying to estimate VBGF parameters K and Linf using non linear
 regression and nls(). First I used a classic approach where I estimate both
 parameters together as below with alkdyr being a subset per year of my
 age-length-key database and running in a loop.

 vbgf.par - nls(Lgtcm ~  Linf *(1 - exp(-K * (Age - tzero))), start = c(K=
 0.07, Linf = 177.1), data=alkdyr)

 I obtain an estimation of both parameters that are strongly correlated.
 Indeed after plotting Linf ~ K and fitting a linear regression I obtain a
 function (Linf = a + b*K) with R2= 0.8 and a = 215, b = -763.

 In this context, to take into account explicitly correlation between
 parameters, I decided to fit a new non linear regression derivate from VBGF
 but where Linf is expressed depending on K (I am most interested in K). To
 do so, I tried this model:
 vbgf.par - nls(Lgtcm ~  (a + (b*k)) *(1 - exp(-k * (Age - tzero))), start =
 c(k= 0.07, a= 215, b=-763), data=alkdyr)

 Unfortunately at this point I cannot go further as I get the error message
 singular gradient matrix at initial parameter estimates.

 I tried to use alg= plinear (which I am not sure I understand properly yet).
 If I give a starting value for a and b only, I have an error message stating
 step factor below minFactor (even when minFactor is set to 1000).

 Any help will be more than welcome as this is quite urgent

 Best,

 Xochitl C.




 --



 Xochitl CORMON
 +33 (0)3 21 99 56 84

 Doctorante en écologie marine et science halieutique
 PhD student in marine ecology and fishery science



 IFREMER
 Centre Manche Mer du Nord
 150 quai Gambetta
 62200 Boulogne-sur-Mer



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

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

Re: [R] Output In R

2015-08-18 Thread Boris Steipe
That's a very odd request: surely you would not want to visually inspect 3 
million rows in the console?

Typically one would assign the (large) results of a function to a variable for 
further processing. If you need to inspect the beginning and end of your 
dataset, use head() and tail().

Try getOption(max.print) to see what it is set to: it's a large and 
reasonable value, remember your console uses memory and at some point it needs 
to truncate the values you store in the console, to stay within its allotted 
memory. You can change the max.print option, but I can't see how that would 
be reasonable.

Cheers,
Boris




On Aug 18, 2015, at 8:41 AM, Shivi82 shivibha...@ymail.com wrote:

 Hello All, 
 
 As i am a newbie in R so most of you would have seen this question zillion
 times. I searched for the answer on this forum as well on other various
 forums however could not find the answer i am looking for.
 
 I am dplyr package and used a very basic code:
 select(june,city,state,mod)
 
 The data sheet i am using has more than 3 million observations but the
 console does not print all of them and show only few options and give a
 message:
 [ reached getOption(max.print) -- omitted 376341 rows ]
 
 
 What is the option that i need to add to see all values in the output.
 Similarly once i scroll down and then if i scroll up i am not able to see
 the values starting from row #1. Please suggest
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Output-In-R-tp4711227.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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