[R] Multiple plot in a page

2016-08-02 Thread roslinazairimah zakaria
Dear r-users,

I would like to plot 4 graphs arranged as 2 by 2 and follows are my codes.
However, it only shows one graph.

par(mfrow=c(1,2))

par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i")  ## To control
white space around and between the plots
hist(stn_all[,1],prob=TRUE, main ="Balok ",col="yellowgreen", cex.axis=1.2,
xlab="Rain (mm)", ylab="Relative frequency", ylim= c(0,.004),
xlim=c(0,1200))
lines(x, dgam1,col="red",lwd=3)
legend("topright", legend = c("observed","fitted"),
   col = c("yellowgreen", "red"), pch=c(15,NA), lty = c(0, 1),
   lwd=c(0,3),bty="n", pt.cex=2)
text(100,.012 , expression(paste(beta==64.64)))
box()

par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i")  ## To control
white space around and between the plots
hist(stn_all[,2],prob=TRUE, main ="Gambang ",col="yellowgreen",
cex.axis=1.2,
xlab="Rain (mm)", ylab="Relative frequency", ylim= c(0,.004),
xlim=c(0,1200))
lines(x, dgam2,col="red",lwd=3)
legend("topright", legend = c("observed","fitted"),
   col = c("yellowgreen", "red"), pch=c(15,NA), lty = c(0, 1),
   lwd=c(0,3),bty="n", pt.cex=2)
text(100,.012 , expression(paste(beta==64.64)))
box()


Thank you for your help.

-- 
*Dr. Roslinazairimah Binti Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairi...@ump.edu.my ;
roslina...@gmail.com *
Deputy Dean (Academic & Student Affairs)
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

[[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] Anderson Darling Goodness of fit test

2016-08-02 Thread roslinazairimah zakaria
Hi Marc,

I will try again. Thank you.

On Wed, Aug 3, 2016 at 1:02 AM, Marc Schwartz  wrote:

>
> > On Aug 2, 2016, at 11:37 AM, roslinazairimah zakaria <
> roslina...@gmail.com> wrote:
> >
> > Dear r-users,
> >
> > I would like to perform Anderson Darling Goodness of fit test as such:
> >
> > install.packages("adk")
> > library(adk)
> > x3 <- list(stn_all[,1], balok_gen); x3
> > adk.test(x3)
> >
> > #x3 <- list(jun_data1_pos,jun_gen); x3
> > #adk.test(x3)
> >
> > However, I got this reply:
> >
> >> adk.test(x3)
> > Error: could not find function "adk.test"
> >
> >
> > Thank you so much for any help given.
>
>
> According to CRAN:
>
>   https://cran.r-project.org/web/packages/adk/index.html
>
> The 'adk' package has been archived, so it is likely that you did not
> actually install the package and should have received an error message:
>
> Warning message:
> package ‘adk’ is not available (for R version 3.3.1)
>
> presuming that you are using the current stable release of R.
>
> A search using http://rseek.org would suggest that the test is available
> in other packages on CRAN.
>
> You may also wish to search the R-Help archives to see frequent
> discussions on the utility (or primarily the lack thereof) of normality
> tests...
>
> Regards,
>
> Marc Schwartz
>
>
>


-- 
*Dr. Roslinazairimah Binti Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairi...@ump.edu.my ;
roslina...@gmail.com *
Deputy Dean (Academic & Student Affairs)
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

[[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] Anderson Darling Goodness of fit test

2016-08-02 Thread roslinazairimah zakaria
Hi david,

I will try again. Thank you..

On Wed, Aug 3, 2016 at 1:01 AM, David L Carlson  wrote:

> I think you did not include the other error messages you got while running
> your code. Package adk was removed from CRAN a while ago:
>
> > install.packages("adk")
> Warning message:
> package 'adk' is not available (for R version 3.3.1)
> > library(adk)
> Error in library(adk) : there is no package called 'adk'
>
> The error you included says that adk.test could not be found since the
> package was never installed.
>
> There are many implementations of the Anderson Darling test. A quick
> search using Google turned up versions in packages nortest, kSamples, and
> DescTools.
>
> -
> David L Carlson
> Department of Anthropology
> Texas A University
> College Station, TX 77840-4352
>
>
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of
> roslinazairimah zakaria
> Sent: Tuesday, August 2, 2016 11:37 AM
> To: r-help mailing list
> Subject: [R] Anderson Darling Goodness of fit test
>
> Dear r-users,
>
> I would like to perform Anderson Darling Goodness of fit test as such:
>
> install.packages("adk")
> library(adk)
> x3 <- list(stn_all[,1], balok_gen); x3
> adk.test(x3)
>
> #x3 <- list(jun_data1_pos,jun_gen); x3
> #adk.test(x3)
>
> However, I got this reply:
>
> > adk.test(x3)
> Error: could not find function "adk.test"
>
>
> Thank you so much for any help given.
>
> --
> *Dr. Roslinazairimah Binti Zakaria*
> *Tel: +609-5492370; Fax. No.+609-5492766*
>
> *Email: roslinazairi...@ump.edu.my ;
> roslina...@gmail.com *
> Deputy Dean (Academic & Student Affairs)
> Faculty of Industrial Sciences & Technology
> University Malaysia Pahang
> Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia
>
> [[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.
>



-- 
*Dr. Roslinazairimah Binti Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairi...@ump.edu.my ;
roslina...@gmail.com *
Deputy Dean (Academic & Student Affairs)
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

[[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] plot many dfs in ggplot

2016-08-02 Thread lily li
Another question is, if I want to shade the range between the maximum and
minimum values for daily or annual values, how to do it? Thanks again.


On Tue, Aug 2, 2016 at 12:50 PM, lily li  wrote:

> Hi all,
>
> I have another question. There are several dataframes, each has the same
> columns: time, varA, varB, varC, etc. If I want to plot time ~ varA of each
> dataframe, where different dataframe names use different colors. How to do
> this in ggplot? Thanks for your help.
>
> Right now, I tried to use the code below, but very laborious, and needs
> colors manually.
>
> fig1 = ggplot()+
> geom_path(data=df1, aes(x=time, y= varA, color= 'df1'))+
> geom_path(data=df2, aes(x=time, y= varA, color= 'df2'))+
> geom_path(data=df3, aes(x=time, y= varA, color= 'df3'))+
> ...
> scale_color_manual('', limits=c('df1', 'df2', 'df3', ...),
> values=c('blue', red', 'green', ...))
> show(fig1)
>
>
>

[[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] generate a vector of random numbers within confines of certain parameters

2016-08-02 Thread Bert Gunter
All floating point operations are done to machine precision -- roughly
16 digits. See ?.Machine . You can choose to round, truncate, or
display to anything less than that that you care to. See also the
digits parameter of  ?options

The rest of your post is ambiguous to me. But note that (all?/most?)
rng's are vectorized, so e.g.

> set.seed(1123)

> rnorm(10,mean= runif(10,2,3), sd = runif(10,4,6))

 [1]  4.369411  1.944876  3.143913  6.489048 -1.093468  1.330675
-3.936239 11.740755
 [9] -2.260413 -1.748759

... if that's what you meant.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Tue, Aug 2, 2016 at 11:56 AM, Adrian Johnson
 wrote:
> Dear group,
>
> I am trying to generate a vector of random numbers for 20K observation.
>
> however, I want to generate numbers (with 6 decimal places) within the range 
> of
> Std. Dev : 2-3
> mean  : 4-6
>
> Is there a method to generate numbers with 6 decimal places under
> these parameters
>
> thank you.
> Adrian
>
> __
> 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] generate a vector of random numbers within confines of certain parameters

2016-08-02 Thread Jeff Newmiller
x <- rnorm( 2, 5, 2.5 )

The requirement for "random" is ill-specified because it omits mention of which 
random distribution you want (I assumed normal distribution above).

The requirement for "decimal places" is ill-defined because floating point 
numbers are internally represented with mantissa and exponent ("scientific 
notation"), so large numbers have fewer significant "decimal places" in the 
fraction than small numbers do. For most purposes double precision IEEE754 
numbers have more precision than you will need. What gets sticky is if you want 
to LIMIT the number of decimals... you may need to use the sprintf function and 
export the data as character values if that is important (which I doubt).

Note that the default behavior of the R console is to PRINT values with four 
decimals, but the rest of the significant digits are really still there. 
-- 
Sent from my phone. Please excuse my brevity.

On August 2, 2016 11:56:35 AM PDT, Adrian Johnson  
wrote:
>Dear group,
>
>I am trying to generate a vector of random numbers for 20K observation.
>
>however, I want to generate numbers (with 6 decimal places) within the
>range of
>Std. Dev : 2-3
>mean  : 4-6
>
>Is there a method to generate numbers with 6 decimal places under
>these parameters
>
>thank you.
>Adrian
>
>__
>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] Three way correspondence analyses?

2016-08-02 Thread Suparna Mitra
Hello R experts,
   have some data for microbiome, metabolome and cytokine from the same
sample. Now I want to do a three-way correspondence analyses. From three
normalised data I was trying,
#Now CCA

with two data it works good like:
Metab.Cytok.Microb.cca <- cca(normMicrobiome_NEC,normCytok_and_ProInf)
 plot(Metab.Cytok.Microb.cca )
Metab.Cytok.Microb.cca <- cca(normMicrobiome_NEC,normMetab_NEC)
plot(Metab.Cytok.Microb.cca )

But when I tried with three
Metab.Cytok.Microb.cca <-
cca(normMicrobiome_NEC,normMetab_NEC,normCytok_and_ProInf)
plot(Metab.Cytok.Microb.cca )
But this is not displaying all three variables.
Sorry, I am very new in this. Can anybody please help me?
Thanks a lot,
Mitra

[[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] generate a vector of random numbers within confines of certain parameters

2016-08-02 Thread David L Carlson
The second one (x2) uses the same mean/sd for the 2 variates. If you want 
to change the mean/sd for each variate:

> x3 <- round(replicate(2, rnorm(1, runif(1, 4, 6), runif(1, 2, 3))), 6)
> head(x3)
[1] 5.648530 5.689563 2.945512 3.915723 8.527447 0.298535

---
David C

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David L Carlson
Sent: Tuesday, August 2, 2016 2:40 PM
To: Adrian Johnson; r-help
Subject: Re: [R] generate a vector of random numbers within confines of certain 
parameters

Try

> set.seed(42)
> x1 <- round(rnorm(2, 4, 2), 6)
> head(x1)
[1] 6.741917 2.870604 4.726257 5.265725 4.808537 3.787751

Setting the seed makes the sequence reproducible, but if that is not important, 
you can leave it out. This assumes you want a normal distribution and you want 
to specify the mean and standard deviation. If you want those to be selected 
randomly. The following does that using uniform distributions so each mean and 
standard deviation is equally likely within the range:

> x2 <- round(rnorm(2, runif(1, 4, 6), runif(1, 2, 3)), 6)
> head(x2)
[1] 4.054289 4.745569 5.795536 6.316750 4.370713 5.586646

-
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352




-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Adrian Johnson
Sent: Tuesday, August 2, 2016 1:57 PM
To: r-help
Subject: [R] generate a vector of random numbers within confines of certain 
parameters

Dear group,

I am trying to generate a vector of random numbers for 20K observation.

however, I want to generate numbers (with 6 decimal places) within the range of
Std. Dev : 2-3
mean  : 4-6

Is there a method to generate numbers with 6 decimal places under
these parameters

thank you.
Adrian

__
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-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] generate a vector of random numbers within confines of certain parameters

2016-08-02 Thread David L Carlson
Try

> set.seed(42)
> x1 <- round(rnorm(2, 4, 2), 6)
> head(x1)
[1] 6.741917 2.870604 4.726257 5.265725 4.808537 3.787751

Setting the seed makes the sequence reproducible, but if that is not important, 
you can leave it out. This assumes you want a normal distribution and you want 
to specify the mean and standard deviation. If you want those to be selected 
randomly. The following does that using uniform distributions so each mean and 
standard deviation is equally likely within the range:

> x2 <- round(rnorm(2, runif(1, 4, 6), runif(1, 2, 3)), 6)
> head(x2)
[1] 4.054289 4.745569 5.795536 6.316750 4.370713 5.586646

-
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352




-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Adrian Johnson
Sent: Tuesday, August 2, 2016 1:57 PM
To: r-help
Subject: [R] generate a vector of random numbers within confines of certain 
parameters

Dear group,

I am trying to generate a vector of random numbers for 20K observation.

however, I want to generate numbers (with 6 decimal places) within the range of
Std. Dev : 2-3
mean  : 4-6

Is there a method to generate numbers with 6 decimal places under
these parameters

thank you.
Adrian

__
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] generate a vector of random numbers within confines of certain parameters

2016-08-02 Thread Adrian Johnson
Dear group,

I am trying to generate a vector of random numbers for 20K observation.

however, I want to generate numbers (with 6 decimal places) within the range of
Std. Dev : 2-3
mean  : 4-6

Is there a method to generate numbers with 6 decimal places under
these parameters

thank you.
Adrian

__
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] plot many dfs in ggplot

2016-08-02 Thread lily li
Hi all,

I have another question. There are several dataframes, each has the same
columns: time, varA, varB, varC, etc. If I want to plot time ~ varA of each
dataframe, where different dataframe names use different colors. How to do
this in ggplot? Thanks for your help.

Right now, I tried to use the code below, but very laborious, and needs
colors manually.

fig1 = ggplot()+
geom_path(data=df1, aes(x=time, y= varA, color= 'df1'))+
geom_path(data=df2, aes(x=time, y= varA, color= 'df2'))+
geom_path(data=df3, aes(x=time, y= varA, color= 'df3'))+
...
scale_color_manual('', limits=c('df1', 'df2', 'df3', ...),
values=c('blue', red', 'green', ...))
show(fig1)

[[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] how to plot annual values directly

2016-08-02 Thread lily li
Hi R users,

I have a dataframe, with daily precipitation data, is it possible to plot
annual mean or annual sum values directly? Thanks for your help.

df
year   month   day   precip   time
2010 1  10.5 2010-01-01
2010 1  20.8 2010-01-02
2010 1  31.0 2010-01-03
2010 1  40.9 2010-01-04
...

fig1 = ggplot()+ geom_path(data=df, aes(x=time, y= precip)
show(fig1)

[[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] What is "args" in this function?

2016-08-02 Thread Jeff Newmiller
Unfortunately for you, this email list is about R (not C), and while the 
Posting Guide indicates that questions discussing how to interface with C 
belong in R-devel, that is not a forum for learning C.

On the plus side,  the data types and macros you are asking questions about are 
highly specific to the implementation of R, so if you spend some time filling 
in your gaps in C on your own or in another forum, you ought be able to get 
answers to your questions on R-devel.

FWIW the R code you show does not appear (to me) to be what calls the C code 
you show... at least not directly. There should be a much more straightforward 
correspondence between the caller and callee than you imply here. 

-- 
Sent from my phone. Please excuse my brevity.

On August 2, 2016 9:06:55 AM PDT, Justin Thong  wrote:
>Hi again I need help
>
>*R-code*
>debug(model.matrix)
>model.matrix(~S)
>
>*model.matrix code*
>ans <- .External2(C_modelmatrix, t, data) #t =terms(object) ,
>data="data
>frame of object"
>
>*modelframe C-code*
>SEXP modelframe(SEXP call, SEXP op, SEXP args, SEXP rho)
>{
>SEXP terms, data, names, variables, varnames, dots, dotnames,
>na_action;
>SEXP ans, row_names, subset, tmp;
>char buf[256];
>int i, j, nr, nc;
>int nvars, ndots, nactualdots;
>const void *vmax = vmaxget();
>
>args = CDR(args);
>terms = CAR(args); args = CDR(args);
>row_names = CAR(args); args = CDR(args);
>variables = CAR(args); args = CDR(args);
>varnames = CAR(args); args = CDR(args);
>dots = CAR(args); args = CDR(args);
>dotnames = CAR(args); args = CDR(args);
>subset = CAR(args); args = CDR(args);
>na_action = CAR(args);
>
>. . . .
>
>I am sorry I virtually have no experience in C.
>Can someone explain to me what "args" is at the point when it enters
>the
>function? I know CAR points to the first element of an object, and CDR
>points to the complement of the first element of an object.
>
>Does "args" represent the list of t and data?
>or
>Does "args" represent the thrid argument in .External2 which is data?
>or
>something else
>
>I am guessing this whole process of playing CAR and CDR is just a way
>of
>extracting variables from "args" until everything thing in "args" is
>assigned to.
>
>For instance, if args=(1,2,3,4,5,6) then below correspond in square
>brackets
>
>  args = CDR(args); [(1,2,3,4,5,6)]
>  terms = CAR(args) ;[(1)] args = CDR(args);[(2,3,4,5,6)]
>row_names = CAR(args);[(2)] args = CDR(args);[(3,4,5,6)]
>variables = CAR(args);[(3)] args = CDR(args);[(4,5,6)]
>varnames = CAR(args);[(4)] args = CDR(args);[(5,6)]
>   etc
>
>Is this correct?
>
>I am sorry if I am asking too many questions on C. Please advise if I
>am
>posting inappropriately.

__
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] Anderson Darling Goodness of fit test

2016-08-02 Thread Marc Schwartz

> On Aug 2, 2016, at 11:37 AM, roslinazairimah zakaria  
> wrote:
> 
> Dear r-users,
> 
> I would like to perform Anderson Darling Goodness of fit test as such:
> 
> install.packages("adk")
> library(adk)
> x3 <- list(stn_all[,1], balok_gen); x3
> adk.test(x3)
> 
> #x3 <- list(jun_data1_pos,jun_gen); x3
> #adk.test(x3)
> 
> However, I got this reply:
> 
>> adk.test(x3)
> Error: could not find function "adk.test"
> 
> 
> Thank you so much for any help given.


According to CRAN:

  https://cran.r-project.org/web/packages/adk/index.html

The 'adk' package has been archived, so it is likely that you did not actually 
install the package and should have received an error message:

Warning message:
package ‘adk’ is not available (for R version 3.3.1) 

presuming that you are using the current stable release of R.

A search using http://rseek.org would suggest that the test is available in 
other packages on CRAN.

You may also wish to search the R-Help archives to see frequent discussions on 
the utility (or primarily the lack thereof) of normality tests...

Regards,

Marc Schwartz

__
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] Anderson Darling Goodness of fit test

2016-08-02 Thread David L Carlson
I think you did not include the other error messages you got while running your 
code. Package adk was removed from CRAN a while ago:

> install.packages("adk")
Warning message:
package 'adk' is not available (for R version 3.3.1)
> library(adk)
Error in library(adk) : there is no package called 'adk'

The error you included says that adk.test could not be found since the package 
was never installed.

There are many implementations of the Anderson Darling test. A quick search 
using Google turned up versions in packages nortest, kSamples, and DescTools.

-
David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77840-4352



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of roslinazairimah 
zakaria
Sent: Tuesday, August 2, 2016 11:37 AM
To: r-help mailing list
Subject: [R] Anderson Darling Goodness of fit test

Dear r-users,

I would like to perform Anderson Darling Goodness of fit test as such:

install.packages("adk")
library(adk)
x3 <- list(stn_all[,1], balok_gen); x3
adk.test(x3)

#x3 <- list(jun_data1_pos,jun_gen); x3
#adk.test(x3)

However, I got this reply:

> adk.test(x3)
Error: could not find function "adk.test"


Thank you so much for any help given.

-- 
*Dr. Roslinazairimah Binti Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairi...@ump.edu.my ;
roslina...@gmail.com *
Deputy Dean (Academic & Student Affairs)
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

[[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] Regression expression to delete one or more spaces at end of string

2016-08-02 Thread David R Forrest
Double the [[]] and add a + for one-or-more characters: 

sub("[[:blank:]]+$", "", COLNAMES)



> On Aug 2, 2016, at 12:46 PM, Dennis Fisher  wrote:
> 
> R 3.3.1
> OS X
> 
> Colleagues, 
> 
> I have encountered an unexpected regex problem
> 
> I have read an Excel file into R using the readxl package.  Columns names are:
> 
> COLNAMES  <- c("Study ID", "Test and Biological Matrix", "Subject No. ", 
> "Collection Date", 
> "Collection Time", "Scheduled Time Point", "Concentration", "Concentration 
> Units", 
> "LLOQ", "ULOQ", "Comment”)
> 
> As you can see, there is a trailing space in “Subject No. “.  I would like to 
> delete that space.  The following works:
>   sub(“ $”, “”, COLNAMES)
> However, I would like a more general approach that removes any trailing 
> whitespace.
> 
> I tried variations such as:
>   sub("[:blank:]$", "", COLNAMES)
> (also, without the $ and ‘space' instead of ‘blank') without success — to my 
> surprise, characters other than the trailing space were deleted but the 
> trailing space remained.
> 
> Guidance on the correct syntax would be appreciated.
> 
> Dennis
> 
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone / Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.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.

--
Dr. David Forrest
d...@vims.edu
804-684-7900w
757-968-5509h
804-413-7125c
#240 Andrews Hall
Virginia Institute of Marine Science
Route 1208, Greate Road
PO Box 1346
Gloucester Point, VA, 23062-1346










__
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] Regression expression to delete one or more spaces at end of string

2016-08-02 Thread William Dunlap via R-help
First, use [[:blank:]] instead of [:blank:]. that latter matches colon, b,
l,
a, n, and k, the former whitespace.

Second, put + after [[:blank:]] to match one or more of them.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Aug 2, 2016 at 9:46 AM, Dennis Fisher  wrote:

> R 3.3.1
> OS X
>
> Colleagues,
>
> I have encountered an unexpected regex problem
>
> I have read an Excel file into R using the readxl package.  Columns names
> are:
>
> COLNAMES<- c("Study ID", "Test and Biological Matrix", "Subject
> No. ", "Collection Date",
> "Collection Time", "Scheduled Time Point", "Concentration", "Concentration
> Units",
> "LLOQ", "ULOQ", "Comment”)
>
> As you can see, there is a trailing space in “Subject No. “.  I would like
> to delete that space.  The following works:
> sub(“ $”, “”, COLNAMES)
> However, I would like a more general approach that removes any trailing
> whitespace.
>
> I tried variations such as:
> sub("[:blank:]$", "", COLNAMES)
> (also, without the $ and ‘space' instead of ‘blank') without success — to
> my surprise, characters other than the trailing space were deleted but the
> trailing space remained.
>
> Guidance on the correct syntax would be appreciated.
>
> Dennis
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone / Fax: 1-866-PLessThan (1-866-753-7784)
> www.PLessThan.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.

Re: [R] Regression expression to delete one or more spaces at end of string

2016-08-02 Thread Marc Schwartz

> On Aug 2, 2016, at 11:46 AM, Dennis Fisher  wrote:
> 
> R 3.3.1
> OS X
> 
> Colleagues, 
> 
> I have encountered an unexpected regex problem
> 
> I have read an Excel file into R using the readxl package.  Columns names are:
> 
> COLNAMES  <- c("Study ID", "Test and Biological Matrix", "Subject No. ", 
> "Collection Date", 
> "Collection Time", "Scheduled Time Point", "Concentration", "Concentration 
> Units", 
> "LLOQ", "ULOQ", "Comment”)
> 
> As you can see, there is a trailing space in “Subject No. “.  I would like to 
> delete that space.  The following works:
>   sub(“ $”, “”, COLNAMES)
> However, I would like a more general approach that removes any trailing 
> whitespace.
> 
> I tried variations such as:
>   sub("[:blank:]$", "", COLNAMES)
> (also, without the $ and ‘space' instead of ‘blank') without success — to my 
> surprise, characters other than the trailing space were deleted but the 
> trailing space remained.
> 
> Guidance on the correct syntax would be appreciated.
> 
> Dennis


Dennis, 

There is actually an example in ?gsub:

## trim trailing white space
str <- "Now is the time  "
sub(" +$", "", str)  ## spaces only

The '+' sign will match the preceding space one or more times at the end of the 
character string.

Note that as per ?regex, it is [:space:], not [:blank:] and the brackets need 
to be doubled in the regex to define the enclosing character group. An example 
would be:

sub("[[:space:]]+$", "", str) ## white space, POSIX-style

which is also in ?gsub.

Regards,

Marc Schwartz

__
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] Fuzzy_partition with fuzzy_trapezoid

2016-08-02 Thread Arthur Stilben
Thanks, Sarah, for response. But you showed me an example with
fuzzy_variable. I'd like to use fuzzy_partition. I also tried:

> teste = fuzzy_partition(varnames = c('a', 'b'), FUN = fuzzy_trapezoid, 
> corners = c(1,2,3,4), height = c(1,1) )

But the trapezoids 'a' and 'b' were overlap. Is there a way to
construct two separeted trapezoids with fuzzy_partitions?

2016-08-02 12:51 GMT-03:00 Sarah Goslee :
> As already discussed, yes, but you can't specify corners and height
> twice in a single call.
> Please do read the help for the functions you're interested in, and
> perhaps go back to refresh yourself on some basic R.
>
>> sets_options("universe", seq(from = 0, to = 10, by = 0.1))
>> test1 = fuzzy_variable( a = fuzzy_trapezoid( corners = c( 0, 1, 2, 3 )))
>>
>> sets_options("universe",  seq( from = 0, to = 5, by = 0.1 ))
>> test2 = fuzzy_variable( b = fuzzy_trapezoid( corners = c( 4, 5, 6, 7 )))
>>
>
> On Tue, Aug 2, 2016 at 11:14 AM, Arthur Stilben
>  wrote:
>> I already made this question, but I was not subscribed and not
>> received any reply. I tried this:
>>
>>> install.packages("sets")
>> ...
>>> library(sets)
>>> teste = fuzzy_partition(varnames = c('a', 'b'), FUN = fuzzy_trapezoid, 
>>> corners = c(1,2,3,4), height = c(1,1), corners = c(5,6,7,8), height = 
>>> c(1,1) )
>>
>> But I got this error:
>>
>> Error in FUN(i, ...) :
>>   formal argument "corners" represents multiples specified arguments
>>
>> Is it possible to combine fuzzy_partition with fuzzy_trapezoid?
>>
>> Att,
>>



-- 
Arthur Rodrigues Stilben
Geoinformática - LENEP
(22) 2765-6555

__
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] Regression expression to delete one or more spaces at end of string

2016-08-02 Thread Dennis Fisher
R 3.3.1
OS X

Colleagues, 

I have encountered an unexpected regex problem

I have read an Excel file into R using the readxl package.  Columns names are:

COLNAMES<- c("Study ID", "Test and Biological Matrix", "Subject No. ", 
"Collection Date", 
"Collection Time", "Scheduled Time Point", "Concentration", "Concentration 
Units", 
"LLOQ", "ULOQ", "Comment”)

As you can see, there is a trailing space in “Subject No. “.  I would like to 
delete that space.  The following works:
sub(“ $”, “”, COLNAMES)
However, I would like a more general approach that removes any trailing 
whitespace.

I tried variations such as:
sub("[:blank:]$", "", COLNAMES)
(also, without the $ and ‘space' instead of ‘blank') without success — to my 
surprise, characters other than the trailing space were deleted but the 
trailing space remained.

Guidance on the correct syntax would be appreciated.

Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone / Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.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] Anderson Darling Goodness of fit test

2016-08-02 Thread roslinazairimah zakaria
Dear r-users,

I would like to perform Anderson Darling Goodness of fit test as such:

install.packages("adk")
library(adk)
x3 <- list(stn_all[,1], balok_gen); x3
adk.test(x3)

#x3 <- list(jun_data1_pos,jun_gen); x3
#adk.test(x3)

However, I got this reply:

> adk.test(x3)
Error: could not find function "adk.test"


Thank you so much for any help given.

-- 
*Dr. Roslinazairimah Binti Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairi...@ump.edu.my ;
roslina...@gmail.com *
Deputy Dean (Academic & Student Affairs)
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

[[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] What is "args" in this function?

2016-08-02 Thread Justin Thong
Hi again I need help

*R-code*
debug(model.matrix)
model.matrix(~S)

*model.matrix code*
ans <- .External2(C_modelmatrix, t, data) #t =terms(object) , data="data
frame of object"

*modelframe C-code*
SEXP modelframe(SEXP call, SEXP op, SEXP args, SEXP rho)
{
SEXP terms, data, names, variables, varnames, dots, dotnames, na_action;
SEXP ans, row_names, subset, tmp;
char buf[256];
int i, j, nr, nc;
int nvars, ndots, nactualdots;
const void *vmax = vmaxget();

args = CDR(args);
terms = CAR(args); args = CDR(args);
row_names = CAR(args); args = CDR(args);
variables = CAR(args); args = CDR(args);
varnames = CAR(args); args = CDR(args);
dots = CAR(args); args = CDR(args);
dotnames = CAR(args); args = CDR(args);
subset = CAR(args); args = CDR(args);
na_action = CAR(args);

. . . .

I am sorry I virtually have no experience in C.
Can someone explain to me what "args" is at the point when it enters the
function? I know CAR points to the first element of an object, and CDR
points to the complement of the first element of an object.

Does "args" represent the list of t and data?
or
Does "args" represent the thrid argument in .External2 which is data?
or
something else

I am guessing this whole process of playing CAR and CDR is just a way of
extracting variables from "args" until everything thing in "args" is
assigned to.

For instance, if args=(1,2,3,4,5,6) then below correspond in square
brackets

  args = CDR(args); [(1,2,3,4,5,6)]
  terms = CAR(args) ;[(1)] args = CDR(args);[(2,3,4,5,6)]
row_names = CAR(args);[(2)] args = CDR(args);[(3,4,5,6)]
variables = CAR(args);[(3)] args = CDR(args);[(4,5,6)]
varnames = CAR(args);[(4)] args = CDR(args);[(5,6)]
   etc

Is this correct?

I am sorry if I am asking too many questions on C. Please advise if I am
posting inappropriately.



-- 
Yours sincerely,
Justin

*I check my email at 9AM and 4PM everyday*
*If you have an EMERGENCY, contact me at +447938674419(UK) or
+60125056192(Malaysia)*

[[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] Fuzzy_partition with fuzzy_trapezoid

2016-08-02 Thread Sarah Goslee
As already discussed, yes, but you can't specify corners and height
twice in a single call.
Please do read the help for the functions you're interested in, and
perhaps go back to refresh yourself on some basic R.

> sets_options("universe", seq(from = 0, to = 10, by = 0.1))
> test1 = fuzzy_variable( a = fuzzy_trapezoid( corners = c( 0, 1, 2, 3 )))
>
> sets_options("universe",  seq( from = 0, to = 5, by = 0.1 ))
> test2 = fuzzy_variable( b = fuzzy_trapezoid( corners = c( 4, 5, 6, 7 )))
>

On Tue, Aug 2, 2016 at 11:14 AM, Arthur Stilben
 wrote:
> I already made this question, but I was not subscribed and not
> received any reply. I tried this:
>
>> install.packages("sets")
> ...
>> library(sets)
>> teste = fuzzy_partition(varnames = c('a', 'b'), FUN = fuzzy_trapezoid, 
>> corners = c(1,2,3,4), height = c(1,1), corners = c(5,6,7,8), height = c(1,1) 
>> )
>
> But I got this error:
>
> Error in FUN(i, ...) :
>   formal argument "corners" represents multiples specified arguments
>
> Is it possible to combine fuzzy_partition with fuzzy_trapezoid?
>
> Att,
>

__
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] questions about co-linearity in logistic regression from Stefano Sofia

2016-08-02 Thread Greg Snow
Stefano,

It is usually best to keep these discussions on R-help.  People there
may be quicker to respond and could have better answers. Keeping the
discussion on the list also means that if others in the future find
your question, they will also find the answers and discussion.  And
some of us can spend some time answering questions on the list as a
community stewardship contribution, but when asked directly it turns
into consulting and we would need to start charging a fee (and I
expect that sharing your answer with the community as a whole is lot
cheaper than what my employer would insist that I charge you as a
consultant).

Quick answers to your questions:

1. an example of the data:

> tmp.dat <- data.frame(color=factor(c('red','green','blue'),
+ levels=c('red','green','blue'))
+ )
> model.matrix(~color-1, data=tmp.dat)
  colorred colorgreen colorblue
11  0 0
20  1 0
30  0 1
attr(,"assign")
[1] 1 1 1
attr(,"contrasts")
attr(,"contrasts")$color
[1] "contr.treatment"


2.  There is co-linearity with the intercept because the intercept is
represented by a column of 1's and you can see that if you add the 3
columns above you also will see a column of 1's.

3. There are 3 pieces of information (3 colors) so you need 3 columns
to represent those, you can reconstruct the "blue" column by
subtracting "red" and "green" from the column of 1's that represent
the intercept.  Dropping the last 2 columns only leaves 2 pieces left
which will not contain all the information (just "red" and the
intercept, "blue" and "green" would be combined in that case).  Any
column could be dropped (including the intercept), R/S just chose to
drop the last one by default.

4.  The full answer to this would involve studying the reparameterized
cell-means model:
Bryce, G. Rex, Del T. Scott, and M. W. Carter. "ESTIMATION AND
HYPOTHESIS-TESTING IN LINEAR-MODELS-REPARAMETERIZATION APPROACH TO THE
CELL MEANS MODEL." COMMUNICATIONS IN STATISTICS PART A-THEORY AND
METHODS 9.2 (1980): 131-150.

but the quick answer can be seen by the parameterization using the
intercept and dropping a column for "blue":

> tmp.dat <- data.frame(color=factor(c('red','green','blue')))
> model.matrix(~color, data=tmp.dat)
  (Intercept) colorgreen colorred
1   1  01
2   1  10
3   1  00
attr(,"assign")
[1] 0 1 1
attr(,"contrasts")
attr(,"contrasts")$color
[1] "contr.treatment"

> solve(.Last.value)
 1 2  3
(Intercept)   0 0  1
colorgreen   0 1 -1
colorred  1 0 -1

You can see that the rows corresponding to "blue" have only the
intercept as non-zero while the other rows have the intercept plus
another column as 1's, In the contrast matrix (the result of `solve`)
the intercept corresponds exactly to 3/blue and the others are the
difference between blue and the other 2 colors.  Even with the dummy
variables you can see that when predicting red you take the intercept
plus the coefficient for red, when predicting green you take the
intercept plus the coefficient for green, and when predicting for blue
you just use the intercept.  This should intuitively suggest that the
intercept is the mean/prediction for blue and the other coefficients
are the differences to be added to "blue" to get the other values.

5. see answer to 4




On Mon, Aug 1, 2016 at 4:18 AM, Stefano Sofia
 wrote:
> Dear Dr. Snow,
> my name is Stefano Sofia (I am a meteorologist), I always read posts on the
> r-mailing list.
>
> Few days ago I read with great interest your answer about "Why the order of
> parameters in a logistic regression affects results significantly?"
>
> I am very interested in regression, I have some basis about it but not so
> solid to understand the considerations you mentioned.
> Therefore may I ask you some questions (only if you have got time), or a
> reference text where I can find the answers?
>
> Sorry for the disturb, and thank you for your help.
> Stefano Sofia PhD
>
> Here my questions.
>
> 1. Could you please give me a very short example of three predictors (red,
> green and blue) that are indicators variables with a 1 in exactly one of
> those variables?
> 2. Why in this case there is co-linearity with the intercept?
> 3. Why in case of co-linearity only the last variable is removed (the blue)
> and not the last two ones?
> 4. Why the intercept is the average for blue?
> 5. And finally why the coefficients are the differences between red/green
> and blue on average?
>
> Here there is your original e-mail:
> "...
> The fact that the last coefficient is NA in both outputs suggests that
> there was some co-linearity in your predictor variables and R chose to
> drop one of the offending variables from the model (the last one in
> each case).  Depending on the nature of the co-linearity, the
> interpretation (and therefore the estimates) can change.
>
> For example lets say 

[R] Fuzzy_partition with fuzzy_trapezoid

2016-08-02 Thread Arthur Stilben
I already made this question, but I was not subscribed and not
received any reply. I tried this:

> install.packages("sets")
...
> library(sets)
> teste = fuzzy_partition(varnames = c('a', 'b'), FUN = fuzzy_trapezoid, 
> corners = c(1,2,3,4), height = c(1,1), corners = c(5,6,7,8), height = c(1,1) )

But I got this error:

Error in FUN(i, ...) :
  formal argument "corners" represents multiples specified arguments

Is it possible to combine fuzzy_partition with fuzzy_trapezoid?

Att,

-- 
Arthur Rodrigues Stilben
Geoinformática - LENEP
(22) 2765-6555

__
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] Fuzzy variable universe

2016-08-02 Thread Arthur Stilben
Thanks, Sarah, for the reply. It really works.

2016-07-28 15:50 GMT-03:00 Sarah Goslee :
> On Thu, Jul 28, 2016 at 2:46 PM, Arthur Rodrigues Stilben
>  wrote:
>>
>>
>> Em 28-07-2016 15:45, Arthur Rodrigues Stilben escreveu:
>>>
>>> Sarah,
>>>
>>> First of all, thanks for reply.
>>>
>>> Second, It really works, but in fact I would to like to set individuals
>>> universe groups for each fuzzy_variable. Something like this:
>>>
>>> > test1 = fuzzy_variable( a = fuzzy_trapezoid( corners = c( 0, 1, 2, 3 )
>>> > ), universe = seq( from = 0, to = 10, by = 0.1 ) )
>>> > test2 = fuzzy_variable( b = fuzzy_trapezoid( corners = c( 4, 5, 6, 7 )
>>> > ), universe = seq( from = 0, to = 5, by = 0.1 ) )
>
> You have to do it as two steps. fuzzy_variable() doesn't accept a
> universe argument.
>
> sets_options("universe", seq(from = 0, to = 10, by = 0.1))
> test1 = fuzzy_variable( a = fuzzy_trapezoid( corners = c( 0, 1, 2, 3 )))
>
> sets_options("universe",  seq( from = 0, to = 5, by = 0.1 ))
> test2 = fuzzy_variable( b = fuzzy_trapezoid( corners = c( 4, 5, 6, 7 )))
>
> But there's no reason you can't set it as many times as you want.
>
>>> Em 28-07-2016 15:25, Sarah Goslee escreveu:

 As Jeff suggested, I read the help for you.

 Based on the examples, you need:


   ## set universe
   sets_options("universe", seq(from = 0, to = 10, by = 0.1))
   teste2 = fuzzy_variable( a = fuzzy_trapezoid( corners = c( 0, 1, 2,
 3 ) ) )

 comparing
 plot(teste) # complete with Warning
 and
 plot(teste2)
 makes me think this did what you wanted. At least, it did something.

 Sarah

 On Thu, Jul 28, 2016 at 2:11 PM, Arthur Rodrigues Stilben
  wrote:
>
> Sorry, I forgot to mention:
>
>> install.packages("sets")
>
> ...
>>
>> library(sets)
>> teste = fuzzy_variable( a = fuzzy_trapezoid( corners = c( 0, 1, 2, 3 )
>> ),
>> universe = seq( from = 0, to = 10, by = 0.1 ) )
>> teste
>
> A fuzzy variable with values: a, universe
>
> The ideia is to set the universe group for the fuzzy variable, but it
> didn't
> work.
>
> PS.: I'm newbie here, so I apologize for some mistakes :P.
>
> Att,
>
> Em 28-07-2016 11:23, Jeff Newmiller escreveu:
>>
>> This appears to be a question about a contributed package, though you
>> have
>> not specified which one (so your example code is not reproducible).
>>
>> Be warned that I have never seen discussion of fuzzy logic on this
>> list,
>> so any help you get here is likely to be from someone reading the
>> documentation for you. Please be sure to read it carefully yourself
>> first,
>> and read about reproducibility and support for contributed packages in
>> the
>> Posting Guide.
>
>
> --
> Arthur Rodrigues Stilben
>



-- 
Arthur Rodrigues Stilben
Geoinformática - LENEP
(22) 2765-6555

__
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] Colour gradients in ggtern

2016-08-02 Thread Ulrik Stervbo
Hi Jake,

maybe you can just revet the colours given to the scale:

scale_colour_gradientn(colours = rev(rainbow(5.5)))

Best,
Ulrik

On Tue, 2 Aug 2016 at 16:41 Jake William Andrae 
wrote:

> Hello,
>
> This is my first time posting to the r-help mailing list and I'm a
> relative amateur using R, so forgive my naivety. I am constructing a
> ternary diagram using the ggtern extension of the ggplot package, and I'm
> having some trouble with the colour gradient I want it to display. I have
> attached the output plot, where a rainbow colour gradient can be seen, but
> I really need these colours to be in reverse order. This is the command I
> used to construct the plot;
>
>
> #Plot construction
>
> > ggtern(data= C27_C29_C31, aes(x=C27,y=C29,z=C31))+geom_point(aes(colour=
> GST),size=3)+theme_light()+theme_nogrid_minor()+scale_colour_gradientn(colours
> = rainbow(5.5))
>
>
> Is there a simple way to reverse the colours in the scale_colour_gradientn
> command?
>
> Kind regards,
> Jake Andrae
>
>
>
> __
> 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] Fwd: Help: malloc/free deadlock in unsafe signal handler 'Rf_onsigusr1'

2016-08-02 Thread Ming Li
Thanks luke. cc hawq dev team.

I sent this email to R-devel 2 days before forwarding it to R-help, but no
one reply.

Is there any workaround? When were SIGUSR1 and SIGUSR2 sent in R? Or maybe
we should move all operations not too emergency out of signal handler?

Thanks.


On Tue, Aug 2, 2016 at 4:02 AM,  wrote:

> The handlers for SIGUSR1 and SIGUSR2 are really intended as an
> emergency break, not for ordinary programming. These could be
> rewritten to be safer but that would make them less immediate.
>
> Followups would be more appropriate on R-devel.
>
> Best,
>
> luke
>
>
> On Mon, 1 Aug 2016, Ming Li wrote:
>
> Hi all,
>>
>> I am working on a bug,  which running PLR on HAWQ. The process hung and
>> can't be terminated.
>>
>> From my investigation, it seems signal handler 'Rf_onsigusr1' trigger a
>>>
>> malloc/free deadlock.
>>
>> The calling stack is below.
>>
>> Thread 1 (Thread 0x7f4c93af48e0 (LWP 431263)):
>> #0  0x7f4c9015805e in __lll_lock_wait_private () from /lib64/libc.so.6
>> #1  0x7f4c900dd16b in _L_lock_9503 () from /lib64/libc.so.6
>> #2  0x7f4c900da6a6 in malloc () from /lib64/libc.so.6
>> #3  0x7f4c9008fb39 in _nl_make_l10nflist () from /lib64/libc.so.6
>> #4  0x7f4c9008ddf5 in _nl_find_domain () from /lib64/libc.so.6
>> #5  0x7f4c9008d6e0 in __dcigettext () from /lib64/libc.so.6
>> #6  0x7f4c6fabcfe3 in Rf_onsigusr1 () from
>> /usr/local/lib64/R/lib/libR.so
>> #7  
>> #8  0x7f4c9014079a in brk () from /lib64/libc.so.6
>> #9  0x7f4c90140845 in sbrk () from /lib64/libc.so.6
>> #10 0x7f4c900dd769 in __default_morecore () from /lib64/libc.so.6
>> #11 0x7f4c900d87a2 in _int_free () from /lib64/libc.so.6
>> #12 0x00b3ff24 in gp_free2 ()
>> #13 0x00b356fc in AllocSetDelete ()
>> #14 0x00b38391 in MemoryContextDeleteImpl ()
>> #15 0x0077c851 in ExecEndAgg ()
>> #16 0x007592ad in ExecEndNode ()
>> #17 0x0075186c in ExecEndPlan ()
>> #18 0x0079dffa in ExecEndSubqueryScan ()
>> #19 0x0075921d in ExecEndNode ()
>> #20 0x0075186c in ExecEndPlan ()
>> #21 0x00752565 in ExecutorEnd ()
>> #22 0x006dd9bd in PortalCleanup ()
>> #23 0x00b3f077 in AtCommit_Portals ()
>> #24 0x0051abe5 in CommitTransaction ()
>> #25 0x0051f1d5 in CommitTransactionCommand ()
>> #26 0x0099809e in PostgresMain ()
>> #27 0x008f1031 in BackendStartup ()
>> #28 0x008f70e0 in PostmasterMain ()
>> #29 0x007f63da in main ()
>>
>>
>> I googled and found below info maybe useful to fix it: The best way to
>> avoid this kind of deadlock is to Call only asynchronous-safe functions
>> within signal handlers.
>>
>>
>> https://www.securecoding.cert.org/confluence/display/c/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers
>>
>> Thanks a lot.
>>
>> [[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.
>>
>>
> --
> Luke Tierney
> Ralph E. Wareham Professor of Mathematical Sciences
> University of Iowa  Phone: 319-335-3386
> Department of Statistics andFax:   319-335-3017
>Actuarial Science
> 241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
> Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu
>

[[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] Colour gradients in ggtern

2016-08-02 Thread Jake William Andrae
Hello,

This is my first time posting to the r-help mailing list and I'm a relative 
amateur using R, so forgive my naivety. I am constructing a ternary diagram 
using the ggtern extension of the ggplot package, and I'm having some trouble 
with the colour gradient I want it to display. I have attached the output plot, 
where a rainbow colour gradient can be seen, but I really need these colours to 
be in reverse order. This is the command I used to construct the plot;


#Plot construction

> ggtern(data= C27_C29_C31, aes(x=C27,y=C29,z=C31))+geom_point(aes(colour= 
> GST),size=3)+theme_light()+theme_nogrid_minor()+scale_colour_gradientn(colours
>  = rainbow(5.5))


Is there a simple way to reverse the colours in the scale_colour_gradientn 
command?

Kind regards,
Jake Andrae



__
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] Read output:

2016-08-02 Thread roslinazairimah zakaria
Dear all, All of you are right.  I use the external hard drive and
yesterday my laptop screen went blackout.  So I guess that is the cause.

Thank you for your help.

On Tue, Aug 2, 2016 at 9:53 PM, Jeff Newmiller 
wrote:

> R could not find the specified file. Either it is not there or file system
> permissions (off topic here) prevented access to the file.
> --
> Sent from my phone. Please excuse my brevity.
>
> On August 1, 2016 11:30:42 PM PDT, roslinazairimah zakaria <
> roslina...@gmail.com> wrote:
> >Dear r-usersl,
> >
> >I don't understand this comment:
> >
> >> gambang <- read.csv("G:/A_backup 11 mei 2015/DATA (D)/1 Universiti
> >Malaysia Pahang/ISM-3 2016 UM/Data/Hourly
> >Rainfall/gambang2.csv",header=TRUE)
> >Error in file(file, "rt") : cannot open the connection
> >In addition: Warning message:
> >In file(file, "rt") :
> >cannot open file 'G:/A_backup 11 mei 2015/DATA (D)/1 Universiti
> >Malaysia
> >Pahang/ISM-3 2016 UM/Data/Hourly Rainfall/gambang2.csv': No such file
> >or
> >directory
> >
> >Thank you for helping.
>
>


-- 
*Dr. Roslinazairimah Binti Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairi...@ump.edu.my ;
roslina...@gmail.com *
Deputy Dean (Academic & Student Affairs)
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

[[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] Read output:

2016-08-02 Thread Jeff Newmiller
R could not find the specified file. Either it is not there or file system 
permissions (off topic here) prevented access to the file. 
-- 
Sent from my phone. Please excuse my brevity.

On August 1, 2016 11:30:42 PM PDT, roslinazairimah zakaria 
 wrote:
>Dear r-usersl,
>
>I don't understand this comment:
>
>> gambang <- read.csv("G:/A_backup 11 mei 2015/DATA (D)/1 Universiti
>Malaysia Pahang/ISM-3 2016 UM/Data/Hourly
>Rainfall/gambang2.csv",header=TRUE)
>Error in file(file, "rt") : cannot open the connection
>In addition: Warning message:
>In file(file, "rt") :
>cannot open file 'G:/A_backup 11 mei 2015/DATA (D)/1 Universiti
>Malaysia
>Pahang/ISM-3 2016 UM/Data/Hourly Rainfall/gambang2.csv': No such file
>or
>directory
>
>Thank you for helping.

__
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] Antwort: Re: Re: Spread data.frame on 2 variables (SOLVED)

2016-08-02 Thread G . Maubach
Hi Ulrik,

many thanks for your help.

The problem was that R regards a dataset with a combination like

caseID  custID  channel unit
1   100010  10
2   100020  10
3   100020  30

as two diffrenet sets of cases: 1 set = case 1, 2 set = case 2 and 3 due 
to the different values of unit in case 3 value 30, althought all cases 
should be restructured based just on custID.

To get a dataset like

caseID  custID  channel -10 channel-20  unit-10 
unit-30
1   10001   1   1 1

instead of

caseID  custID  channel -10 channel-20  unit-10 
unit-30
1   10001   1   1 NA
2   1000NA  1   NA 1

I used the approach you suggested:

1. I created a subset of my data with the first variable to be 
restructured:

d_temp1 <- dataset[ , c("custID", "channel"))

2. I deleted all the cases the were dupliates

d_temp1 <- duplicated(d_temp1, c("custID", "channel")

3. I introduced a dummy variable delivering the values for the new 
variables created by dplyr:spread()

d_temp1$dummy <- 1 

4. Then I restructured the subset
d_temp1 <- dplyr::spread(d_temp1, key_variable = "channel", value = 
d_temp1$dummy)

5. I repeaed steps 1 to 4 with the other variable "unit" (instead of 
"channel") creating a new dataset named d_temp2.

6. I deleted the variables used for restructuring in steps 1 to 5 
"channel" and "unit" from the original dataset "dataset".

dataset$channel <- NULL
dataset$unit <- NULL

7. I checked if I still had duplicates

duplicates <- duplicated(dataset, key_variable = c("Debitor"))

sum(duplicates)  # was 0 it this time

8. I merged the datasets back together

dataset_2 <- merge(x = dataset, y = d_temp1, by.x = "Debitor", by.y = 
"Debitor", all.x = TRUE, all.y = TRUE)  # leaving out all.y would be fine
dataset_2 <- merge(x = dataset2, y = d_temp2, by.x = "Debitor", by.y = 
"Debitor", all.x = TRUE, all.y = TRUE)  # leaving out all.y would be fine

There might be a combination of commands and functions doing the same 
thing in one step but I find that this is clear, comprehensible and 
reproducable even at a later date or by other readers willing to use base 
R for their work.

Many thanks again for your help.

Kind regards

Georg





Von:Ulrik Stervbo 
An: g.maub...@weinwolf.de, R-help , 
Datum:  28.07.2016 14:20
Betreff:Re: Re: [R] Spread data.frame on 2 variables



Hi Georg,

it is difficult to figure out what happens between your expectation and 
the outcome if we cannot see a minimal dataset.

Based on your description I did this

library(tidyr)
library(dplyr)

test_df <- data_frame(channel = LETTERS[1:5], unit = letters[1:5], custID 
= c(1:5), dummy = 1)
test_df %>% spread(channel, dummy) %>% mutate(dummy = 1) %>% spread(unit, 
dummy) 

which seems to be working fine as I get wide data. If a combination is 
missing in the long form it will also be missing in the wide form. Maybe 
you are looking for something like this:

channel_wide <- test_df  %>% select(channel, custID) %>% spread(channel, 
custID) 
unit_wide <- test_df  %>% select(unit, custID) %>% spread(unit, custID) 
bind_cols(channel_wide, unit_wide)

Apologies for the HTML - it's gmail

Best wishes,
Ulrik

On Thu, 28 Jul 2016 at 13:54  wrote:
Hi Ulrik,

I have included a reproducable example. I ran the code and it did exactly
what I wanted to show you.

You are right: the solution shall merge cases in the end cause the values
on the variables are either missing or the same.

Example 1: Values are the same
If you look at 6 and 7 and variable 70 the value is 1 in both cases. This
is in this context the same information and cases 6 and 7 with custID can
be merged to 1 for variable 70.

Example 2: Values are missing and not missing
If you look at cases 8 and 9 the value for case 8 at variable 40, 50 and
2000 is missing whereas the variables 40, 50 and 2000 have all 1 for case
9. Case 8 and 9 could be merged together cause the missing values are
overwritten what is correct in this case.

The solution I am looking for is to transform the data from long into wide
form and keep all but missing value information.

Did I explain my problem in a comprehensible way? Are there any further
questions?

Kind regards

Georg





Von:Ulrik Stervbo 
An: g.maub...@weinwolf.de, r-help@r-project.org,
Datum:  28.07.2016 12:59
Betreff:Re: [R] Spread data.frame on 2 variables



Hi Georg,

it's hard to tell without a reproducible example.

Should spread really merge elements? Does spread know anything about
CustID? Maybe you need to make a useful key of the CustIDs first and
spread on that?

Maybe I'm all off, because I'm really just 

Re: [R] Read output:

2016-08-02 Thread Duncan Murdoch

On 02/08/2016 2:30 AM, roslinazairimah zakaria wrote:

Dear r-usersl,

I don't understand this comment:


gambang <- read.csv("G:/A_backup 11 mei 2015/DATA (D)/1 Universiti

Malaysia Pahang/ISM-3 2016 UM/Data/Hourly
Rainfall/gambang2.csv",header=TRUE)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'G:/A_backup 11 mei 2015/DATA (D)/1 Universiti Malaysia
Pahang/ISM-3 2016 UM/Data/Hourly Rainfall/gambang2.csv': No such file or
directory



It says that the file doesn't exist.  It's got a long name, so you may 
have made an error typing it.  I recommend using


f <- file.choose()

to put the correct filename into f, then

read.csv(f, header = TRUE)

to read it.

Duncan Murdoch

__
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] DEA -- Extract the Frontier and ggplot2

2016-08-02 Thread Roman Luštrik
Hi,

this is not really a ggplot2 issue, but here goes.

If you look at the source code of the Benchmarking package (here
) you will
notice that the function is not very explicit about what to return - so the
returned thing is actually a plotting line (lines()). What you could do is
fork the repository, add your own return statement to include the `hpts`
 which
could be used to find the correct values in `x` (see for example here
 how
plotting is done).

After you have the formed repository ready (and pushed to your account),
you can install it through
devtools::install_github("yourname/Benchmarking"). Blesssed thee, open
source.

Cheers,
Roman

On Tue, Aug 2, 2016 at 11:11 AM, Lorenzo Isella 
wrote:

> Hello,
> Thanks for your suggestion, but it is does not help me much.
> Indeed, in this case where RTS="vrs", things are easy as you say.
> However, try for instance to change the technology assumption
> (e.g. replace it with RTS="drs" everywhere in my script) and you'll
> see that things are not that simple.
> I really need a way to extract the frontier -- it is plotted, so it is
> calculated and it has to be buried somewhere in the package, just I do
> not know where.
> Cheers
>
> Lorenzo
>
> On Tue, Aug 02, 2016 at 09:05:15AM +, Jose Iparraguirre wrote:
>
>> Lorenzo,
>>
>> dea.plot plots the vectors x and y, which you already have:
>> data.frame(x,y)
>>   x  y
>> 1 20 20
>> 2 40 30
>> 3 40 50
>> 4 60 40
>> 5 70 60
>> 6 50 20
>>
>> dea.plot.frontier plots the highest values of y for each value of x.
>> Therefore, for x=20, the plot goes through y=20 but for X=40, where you
>> have Y=30 and Y=50, the plot goes through the latter.
>>
>> Others in the list may give you an easier and better answer, but it's not
>> difficult to plot all the X and Y in a scatterplot in ggplot and then to
>> add a line along the highest values of Y per each X.
>>
>> I'm assuming you want an input orientation as in your example, of course.
>>
>> Hope it helps,
>>
>> José
>>
>>
>> Prof. José Iparraguirre
>> Chief Economist
>> Age UK
>>
>> Age UK
>> Tavis House, 1- 6 Tavistock Square
>> London, WC1H 9NB
>>
>> T 020 303 31482
>> E jose.iparragui...@ageuk.org.uk
>> Twitter @jose.iparraguirre@ageuk
>>
>> www.ageuk.org.uk | ageukblog.org.uk |
>> @ageukcampaigns
>>
>>
>> Interested in our Policy and Research publications? Sign up to our
>> monthly bulletin at
>> http://www.ageuk.org.uk/professional-resources-home/research/
>>
>> For evidence and statistics on the older population, visit the Age UK
>> Knowledge Hub
>> http://www.ageuk.org.uk/professional-resources-home/knowledge-hub-evidence-statistics/
>>
>>
>>
>>
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Lorenzo
>> Isella
>> Sent: 02 August 2016 09:05
>> To: r-help@r-project.org
>> Cc: ggpl...@googlegroups.com
>> Subject: [R] DEA -- Extract the Frontier and ggplot2
>>
>> Dear All,
>> Please consider the code at the end of the email.
>> Everything is fine in this little example, just I do not know how to
>> extract the DEA frontier (solid line in the plot).
>> The reason is that I want to reproduce a more complicated DEA frontier
>> plot using ggplot2 and I need to understand how I can extract the
>> frontier data. Alternatively: can anyone reproduce the same plot with
>> ggplot2?
>> Many thanks
>>
>> Lorenzo
>>
>> ###à
>>
>>
>>
>> library(Benchmarking) # load the Benchmarking library
>>
>> x <- matrix(c(20, 40, 40, 60, 70, 50),ncol=1) #define inputs
>> y <- matrix(c(20, 30, 50, 40, 60, 20),ncol=1) #define outputs
>>
>> e_vrs <- dea(x,y, RTS="vrs", ORIENTATION="in")#solve LP problem
>> eff_dea <- eff(e_vrs) #select efficiency scores from the results in e
>>
>>
>>
>>
>> dd <- as.data.frame(cbind(x,y))
>>
>> names(dd) <- c("Input", "Output")
>> dd$Firm <- LETTERS[1:length(x)]
>>
>> dd$Input <- as.integer(dd$Input)
>> dd$Output <- as.integer(dd$Output)
>>
>> pdf("dea-frontier-vrs.pdf")
>> par( mar = c(4.5,5, 1, 1) + 0.1)
>>
>> dea.plot(x,y,RTS="vrs",ORIENTATION="in",txt=LETTERS[1:length(x)],lty="dashed",
>> xlab="Input", ylab="Output", fex=2,
>> cex=2,cex.lab=2,cex.axis=2)
>> dea.plot.frontier(x,y, RTS="vrs", add=T)
>> text(10,60, "VRS", cex=2)
>> dev.off()
>>
>> __
>> R-help@r-project.org mailing list -- To
>> UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help<
>> 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.
>>
>>
>>
>>
>>
>> Age UK
>>
>> 

Re: [R] DEA -- Extract the Frontier and ggplot2

2016-08-02 Thread Lorenzo Isella

Hello,
Thanks for your suggestion, but it is does not help me much.
Indeed, in this case where RTS="vrs", things are easy as you say.
However, try for instance to change the technology assumption
(e.g. replace it with RTS="drs" everywhere in my script) and you'll
see that things are not that simple.
I really need a way to extract the frontier -- it is plotted, so it is
calculated and it has to be buried somewhere in the package, just I do
not know where.
Cheers

Lorenzo

On Tue, Aug 02, 2016 at 09:05:15AM +, Jose Iparraguirre wrote:

Lorenzo,

dea.plot plots the vectors x and y, which you already have:
data.frame(x,y)
  x  y
1 20 20
2 40 30
3 40 50
4 60 40
5 70 60
6 50 20

dea.plot.frontier plots the highest values of y for each value of x. Therefore, 
for x=20, the plot goes through y=20 but for X=40, where you have Y=30 and 
Y=50, the plot goes through the latter.

Others in the list may give you an easier and better answer, but it's not 
difficult to plot all the X and Y in a scatterplot in ggplot and then to add a 
line along the highest values of Y per each X.

I'm assuming you want an input orientation as in your example, of course.

Hope it helps,

José


Prof. José Iparraguirre
Chief Economist
Age UK

Age UK
Tavis House, 1- 6 Tavistock Square
London, WC1H 9NB

T 020 303 31482
E jose.iparragui...@ageuk.org.uk
Twitter @jose.iparraguirre@ageuk

www.ageuk.org.uk | ageukblog.org.uk | @ageukcampaigns


Interested in our Policy and Research publications? Sign up to our monthly 
bulletin at http://www.ageuk.org.uk/professional-resources-home/research/

For evidence and statistics on the older population, visit the Age UK Knowledge 
Hub 
http://www.ageuk.org.uk/professional-resources-home/knowledge-hub-evidence-statistics/




From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Lorenzo Isella
Sent: 02 August 2016 09:05
To: r-help@r-project.org
Cc: ggpl...@googlegroups.com
Subject: [R] DEA -- Extract the Frontier and ggplot2

Dear All,
Please consider the code at the end of the email.
Everything is fine in this little example, just I do not know how to
extract the DEA frontier (solid line in the plot).
The reason is that I want to reproduce a more complicated DEA frontier
plot using ggplot2 and I need to understand how I can extract the
frontier data. Alternatively: can anyone reproduce the same plot with ggplot2?
Many thanks

Lorenzo

###à



library(Benchmarking) # load the Benchmarking library

x <- matrix(c(20, 40, 40, 60, 70, 50),ncol=1) #define inputs
y <- matrix(c(20, 30, 50, 40, 60, 20),ncol=1) #define outputs

e_vrs <- dea(x,y, RTS="vrs", ORIENTATION="in")#solve LP problem
eff_dea <- eff(e_vrs) #select efficiency scores from the results in e




dd <- as.data.frame(cbind(x,y))

names(dd) <- c("Input", "Output")
dd$Firm <- LETTERS[1:length(x)]

dd$Input <- as.integer(dd$Input)
dd$Output <- as.integer(dd$Output)

pdf("dea-frontier-vrs.pdf")
par( mar = c(4.5,5, 1, 1) + 0.1)
dea.plot(x,y,RTS="vrs",ORIENTATION="in",txt=LETTERS[1:length(x)],lty="dashed",
xlab="Input", ylab="Output", fex=2,
cex=2,cex.lab=2,cex.axis=2)
dea.plot.frontier(x,y, RTS="vrs", add=T)
text(10,60, "VRS", cex=2)
dev.off()

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





Age UK

Together, we can help everyone make the most of later life.

Get involved and find out how you can donate, volunteer or give your support to 
help more people love later life at www.ageuk.org.uk

---
Age UK is a registered charity and company limited by guarantee, (registered 
charity number 1128267, registered company number 6825798) Registered office: 
Tavis House, 1-6 Tavistock Square, London WC1H 9NA
Charitable Services are offered through Age UK (the Charity) and commercial 
products and services are offered by the Charity’s subsidiary companies. The 
Age UK Group comprises of Age UK, and its subsidiary companies and charities, 
dedicated to helping more people make the most of later life. Our network 
includes the three national charities Age Cymru, Age NI and Age Scotland and 
more than 150 local Age UK charities.
---
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you receive a message in error, please advise the sender and delete immediately.
Except where 

Re: [R] about netcdf files

2016-08-02 Thread Marc Girondot via R-help

You can find many tutorials in internet. For example, I did one here:
http://max2.ese.u-psud.fr/epc/conservation/Girondot/Publications/Blog_r/Entrees/2014/4/27_Comparison_between_packages_RnetCDF%2C_ncdf4_and_ncdf.html
Without any reproducibl example, it is impossible to help you further.

Sincerely

Marc

__
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] DEA -- Extract the Frontier and ggplot2

2016-08-02 Thread Lorenzo Isella

Dear All,
Please consider the code at the end of the email.
Everything is fine in this little example, just I do not know how to
extract the DEA frontier (solid line in the plot).
The reason is that I want to reproduce a more complicated DEA frontier
plot using ggplot2 and I need to understand how I can extract the
frontier data. Alternatively: can anyone reproduce the same plot with ggplot2?
Many thanks

Lorenzo

###à



library(Benchmarking) # load the Benchmarking library

x <- matrix(c(20, 40, 40, 60, 70, 50),ncol=1) #define inputs
y <- matrix(c(20, 30, 50, 40, 60, 20),ncol=1) #define outputs

e_vrs <- dea(x,y, RTS="vrs", ORIENTATION="in")#solve LP problem
eff_dea <- eff(e_vrs) #select efficiency scores from the results in e




dd <- as.data.frame(cbind(x,y))

names(dd) <- c("Input", "Output")
dd$Firm <- LETTERS[1:length(x)]

dd$Input <- as.integer(dd$Input)
dd$Output <- as.integer(dd$Output)

pdf("dea-frontier-vrs.pdf")
par( mar = c(4.5,5, 1, 1) + 0.1)
dea.plot(x,y,RTS="vrs",ORIENTATION="in",txt=LETTERS[1:length(x)],lty="dashed",
xlab="Input", ylab="Output", fex=2,
 cex=2,cex.lab=2,cex.axis=2)
 dea.plot.frontier(x,y, RTS="vrs", add=T)
 text(10,60, "VRS", cex=2)
 dev.off()

__
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] Read output:

2016-08-02 Thread Jim Lemon
Hi Roslina,
As we do not know whether the file actually exists, all I can do is to
suggest that you look in your file manager (Windows Explorer,
probably) and see if the file is where you think it is. The problem is
most likely a spelling error somewhere in the path or filename.

Jim


On Tue, Aug 2, 2016 at 4:30 PM, roslinazairimah zakaria
 wrote:
> Dear r-usersl,
>
> I don't understand this comment:
>
>> gambang <- read.csv("G:/A_backup 11 mei 2015/DATA (D)/1 Universiti
> Malaysia Pahang/ISM-3 2016 UM/Data/Hourly
> Rainfall/gambang2.csv",header=TRUE)
> Error in file(file, "rt") : cannot open the connection
> In addition: Warning message:
> In file(file, "rt") :
>   cannot open file 'G:/A_backup 11 mei 2015/DATA (D)/1 Universiti Malaysia
> Pahang/ISM-3 2016 UM/Data/Hourly Rainfall/gambang2.csv': No such file or
> directory
>
> Thank you for helping.
> --
> *Dr. Roslinazairimah Binti Zakaria*
> *Tel: +609-5492370; Fax. No.+609-5492766*
>
> *Email: roslinazairi...@ump.edu.my ;
> roslina...@gmail.com *
> Deputy Dean (Academic & Student Affairs)
> Faculty of Industrial Sciences & Technology
> University Malaysia Pahang
> Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia
>
> [[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.


[R] Read output:

2016-08-02 Thread roslinazairimah zakaria
Dear r-usersl,

I don't understand this comment:

> gambang <- read.csv("G:/A_backup 11 mei 2015/DATA (D)/1 Universiti
Malaysia Pahang/ISM-3 2016 UM/Data/Hourly
Rainfall/gambang2.csv",header=TRUE)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file 'G:/A_backup 11 mei 2015/DATA (D)/1 Universiti Malaysia
Pahang/ISM-3 2016 UM/Data/Hourly Rainfall/gambang2.csv': No such file or
directory

Thank you for helping.
-- 
*Dr. Roslinazairimah Binti Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairi...@ump.edu.my ;
roslina...@gmail.com *
Deputy Dean (Academic & Student Affairs)
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

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