[R] Math kernel library from intel

2018-04-15 Thread Partha Sinha
I use win 10 ( 64 bit) with latest R available. Intel has released math
kernel library. Is it necessary to install for data driven work ?
Regards
Partha

[[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] Question

2018-04-15 Thread Marc Girondot via R-help

Le 15/04/2018 à 17:56, alireza daneshvar a écrit :

break-down point


Can you explain more what you plan to do and give an example of what you 
have tried to do until now to do a "break down point" in R. Perhaps a 
"break down point" is common in your field, but I have no idea about 
what it is !


https://en.wikipedia.org/wiki/Breakdown_(1997_film)

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] Question

2018-04-15 Thread alireza daneshvar
Hi,
How to calculate break-down point in R?
Thanks

[[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] Adding a new conditional column to a list of dataframes

2018-04-15 Thread David Winsemius

> On Apr 15, 2018, at 4:08 AM, Allaisone 1  wrote:
> 
> 
> Hi all ..,
> 
> 
> I have a list of 7000 dataframes with similar column headers and I wanted to 
> add a new column to each dataframe based on a certain condition which is the 
> same for all dataframes.
> 
> 
> When I extract one dataframe and apply my code it works very well as follows 
> :-
> 
> 
> First suppose this is my first dataframe in the list
> 
>> OneDF <- Mylist[[1]]
> 
>> OneDF
> 
> 
> ID   Pdate  Tdate
> 
> 1 2010-09-30   2011-05-10
> 
> 2 2011-11-07   2009-09-31
> 
> 3 2012-01-052008-06-23
> 
> 
> To add a new column where "C" has to be written in that column only if the 
> date in
> 
> "Tdate" column is less than the first date(row) in "Pdate" column.Otherwise 
> "NA" is written.
> 
> I have written this code to do so :-
> 
> 
> OneDF$NewCol [ OneDF[ ,3] <  OneDF[ 1,2] ] <- "C"
> 
> 
> This gave me what I want as follows :-
> 
> 
> ID   Pdate  Tdate  NewCol
> 
> 1 2010-09-30   2011-05-10NA
> 
> 2 2011-11-07   2009-09-31  C
> 
> 3 2012-01-052008-06-23 C
> 
> 
> However, when I tried to apply this code in a function and then apply this 
> function
> 
> to all dataframes using lapply() function , I do not get what I want.
> 
> 
> I wrote this function first :-
> 
> 
> MyFunction <- function(x) x$NewCol [ x[ ,3] <  x[ 1,2] ] <- "C"
> 
> 
> Then I wrote this code to apply my function to all dataframes in "Mylist" :
> 
> 
> NewList <- lapply(names(Mylist), function(x) MyFunction(Mylist[[x]]))
> 
> 
> This returned a list of 7000 elements and each of which contain "C'' letter. 
> Each
> 
> dataframe has become a vector of "C'' letter which is totally away from what 
> I need.
> 
> I expected to see a list of my 7000 dataframes and each of which looks like 
> the output
> 
> I have shown above with the new column.
> 
> 
> I spent a lot of time trying to know what  is the mistake I have made in 
> these last two codes
> 
> but was not able to know the issue.

A function returns the result of the last function call. In your case the last 
function called was `[<-` and if you look at that function's help page you will 
find only the value of its RHS (in your case "C") is returned. That assignment 
function has is predominat action via side-effect rather than by a truly 
functional operation.. The function might have been written:

 MyFunction <- function(x) { x$NewCol [ x[ ,3] <  x[ 1,2] ] <- "C"; x } # so 
that x gets returned

I say "might" since you have not included a reproducible example.

Another point: The `$` operator is not ideal for work within functions.

And. Noting this:

>   [[alternative HTML version deleted]]
Do read the Posting Guide.
-- 

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

__
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] Adding a new conditional column to a list of dataframes

2018-04-15 Thread Jeff Newmiller
Your failure to send your question using plain text format means that the 
mailing list tried to fix that and we are seeing your code all messed up. 
Please learn how to use your email program... or we may not even be able to 
figure out your question at all. 

I think you need to pay attention to what your function is returning... 
whatever is on the last line of the function is key. Try testing your function 
separately from the lapply to insure you get what you want. Also be sure to use 
braces when they are needed to define your function. 

On April 15, 2018 4:08:35 AM PDT, Allaisone 1  wrote:
>
>Hi all ..,
>
>
>I have a list of 7000 dataframes with similar column headers and I
>wanted to add a new column to each dataframe based on a certain
>condition which is the same for all dataframes.
>
>
>When I extract one dataframe and apply my code it works very well as
>follows :-
>
>
>First suppose this is my first dataframe in the list
>
>> OneDF <- Mylist[[1]]
>
>> OneDF
>
>
>ID   Pdate  Tdate
>
>1 2010-09-30   2011-05-10
>
>2 2011-11-07   2009-09-31
>
>3 2012-01-052008-06-23
>
>
>To add a new column where "C" has to be written in that column only if
>the date in
>
>"Tdate" column is less than the first date(row) in "Pdate"
>column.Otherwise "NA" is written.
>
>I have written this code to do so :-
>
>
>OneDF$NewCol [ OneDF[ ,3] <  OneDF[ 1,2] ] <- "C"
>
>
>This gave me what I want as follows :-
>
>
>ID   Pdate  Tdate  NewCol
>
>1 2010-09-30   2011-05-10NA
>
>2 2011-11-07   2009-09-31  C
>
>3 2012-01-052008-06-23 C
>
>
>However, when I tried to apply this code in a function and then apply
>this function
>
>to all dataframes using lapply() function , I do not get what I want.
>
>
>I wrote this function first :-
>
>
>MyFunction <- function(x) x$NewCol [ x[ ,3] <  x[ 1,2] ] <- "C"
>
>
>Then I wrote this code to apply my function to all dataframes in
>"Mylist" :
>
>
>NewList <- lapply(names(Mylist), function(x) MyFunction(Mylist[[x]]))
>
>
>This returned a list of 7000 elements and each of which contain "C''
>letter. Each
>
>dataframe has become a vector of "C'' letter which is totally away from
>what I need.
>
>I expected to see a list of my 7000 dataframes and each of which looks
>like the output
>
>I have shown above with the new column.
>
>
>I spent a lot of time trying to know what  is the mistake I have made
>in these last two codes
>
>but was not able to know the issue.
>
>
>Could you please let me know my mistake and how to correct my syntax ?
>
>
>Kind Regards
>
>Allaisone
>
>
>
>
>
>
>
>
>   [[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.

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

__
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] Adding a new conditional column to a list of dataframes

2018-04-15 Thread Duncan Murdoch

On 15/04/2018 7:08 AM, Allaisone 1 wrote:


Hi all ..,


I have a list of 7000 dataframes with similar column headers and I wanted to 
add a new column to each dataframe based on a certain condition which is the 
same for all dataframes.


When I extract one dataframe and apply my code it works very well as follows :-


First suppose this is my first dataframe in the list


OneDF <- Mylist[[1]]



OneDF



ID   Pdate  Tdate

1 2010-09-30   2011-05-10

2 2011-11-07   2009-09-31

3 2012-01-052008-06-23


To add a new column where "C" has to be written in that column only if the date 
in

"Tdate" column is less than the first date(row) in "Pdate" column.Otherwise 
"NA" is written.

I have written this code to do so :-


OneDF$NewCol [ OneDF[ ,3] <  OneDF[ 1,2] ] <- "C"


This gave me what I want as follows :-


ID   Pdate  Tdate  NewCol

1 2010-09-30   2011-05-10NA

2 2011-11-07   2009-09-31  C

3 2012-01-052008-06-23 C


However, when I tried to apply this code in a function and then apply this 
function

to all dataframes using lapply() function , I do not get what I want.


I wrote this function first :-


MyFunction <- function(x) x$NewCol [ x[ ,3] <  x[ 1,2] ] <- "C"


Then I wrote this code to apply my function to all dataframes in "Mylist" :


NewList <- lapply(names(Mylist), function(x) MyFunction(Mylist[[x]]))


This returned a list of 7000 elements and each of which contain "C'' letter. 
Each

dataframe has become a vector of "C'' letter which is totally away from what I 
need.

  I expected to see a list of my 7000 dataframes and each of which looks like 
the output

I have shown above with the new column.


I spent a lot of time trying to know what  is the mistake I have made in these 
last two codes

but was not able to know the issue.


Could you please let me know my mistake and how to correct my syntax ?



Your function should return x after modifying it.  As it is, it returns 
the value of x$NewCol [ x[ ,3] <  x[ 1,2] ] <- "C", which is "C".  So 
change it to


MyFunction <- function(x) {
  x$NewCol [ x[ ,3] <  x[ 1,2] ] <- "C"
  x
}

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] Specifying forbidden configurations in Morris One at a Time (OAT) sensitivity analysis

2018-04-15 Thread John Kane via R-help
If nothing else, I think you need to supply some sample data that includes 
examples of the "forbidden configurations"
See 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
and/or 

http://adv-r.had.co.nz/Reproducibility.html

 

On Monday, April 9, 2018, 11:45:21 a.m. EDT, Reshma C 
 wrote:  
 
 Hi!

I am trying to implement the Morris One at a Time (OAT) sensitivity
analysis technique in R using the package 'sensitivity'.  The OAT and
similar other techniques in the package requires data frame X (which stores
the design or parameter combinations) to be populated by some function in
the package such as fast99 or morris. These functions take only the range
and step size of the parameters as arguments. However, in my experiment
there are few forbidden configurations. Is there a way to specify this in
the analysis set up? To be specific, is there a way to tell the model that
certain combinations are forbidden such as feeding forbidden configurations
via a text file or specifying a conditional expression which will exclude
the forbidden configurations (eg: parameter 1 < parameter 2) ?

Thanks and regards,
Reshma CC

    [[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] Syntax roccomp-using R

2018-04-15 Thread John Kane via R-help
You really should  read the posting guide (link at the bottom of the e-mail) 
and also read one or both of http://stackoverflow.com/questions/5963269 
/how-to-make-a-great-r-reproducible-example and 
http://adv-r.had.co.nz/Reproducibility.html

As it stands your posts are very close to unreadable. The R-help list does not 
accept HTML files nor embedded images so your text is garbled and none of the 
images are coming through.

Your two attached pdf files are coming through but  are useless without a 
readable message. 
Two key elements in posting are: Alway post in plain text and provide sample 
data in dput() format. See ?dput for more information on this function.
Here is a example data set in dput format.
mydata  <- structure(list(aa = structure(c(2L, 6L, 3L, 7L, 2L, 15L, 1L, 
14L, 2L, 9L, 1L, 4L, 15L, 19L, 4L, 3L, 20L, 21L, 11L, 22L, 3L, 
12L, 14L, 1L, 19L, 10L, 16L, 1L, 3L, 14L, 2L, 8L, 1L, 11L, 8L, 
19L, 22L, 8L, 10L, 18L, 16L, 11L, 7L, 24L, 12L, 16L, 6L, 12L, 
22L, 12L, 12L, 10L, 8L, 20L, 3L, 21L, 9L, 23L, 5L, 17L, 5L, 8L, 
24L, 19L, 6L, 8L, 23L, 8L, 15L, 23L, 18L, 20L, 5L, 4L, 18L, 26L, 
24L, 24L, 24L, 2L, 13L, 23L, 20L, 1L, 19L, 12L, 5L, 25L, 2L, 
22L, 10L, 9L, 3L, 8L, 9L, 2L, 23L, 13L, 19L, 1L), .Label = c("A", 
"B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", 
"O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"), class = "factor"), 
    bb = c(19L, 13L, 14L, 6L, 15L, 13L, 11L, 20L, 20L, 3L, 3L, 
    6L, 4L, 7L, 19L, 18L, 12L, 19L, 12L, 8L, 3L, 2L, 10L, 9L, 
    9L, 9L, 13L, 5L, 16L, 12L, 9L, 8L, 10L, 7L, 14L, 10L, 6L, 
    12L, 8L, 13L, 13L, 13L, 10L, 10L, 10L, 4L, 12L, 6L, 9L, 13L, 
    7L, 20L, 3L, 5L, 20L, 17L, 4L, 8L, 14L, 9L, 5L, 4L, 5L, 1L, 
    13L, 2L, 5L, 11L, 9L, 16L, 3L, 6L, 7L, 14L, 18L, 6L, 19L, 
    2L, 12L, 9L, 10L, 20L, 17L, 13L, 9L, 7L, 3L, 1L, 14L, 12L, 
    11L, 15L, 15L, 15L, 10L, 9L, 2L, 11L, 11L, 16L)), .Names = c("aa", 
"bb"), row.names = c(NA, -100L), class = "data.frame")


 

On Sunday, April 8, 2018, 4:39:39 p.m. EDT, Hamzah Hasyim 
 wrote:  
 
 *Dear Bert, *

Thank you very much for your feedback and the useful link https://rseek.org/
and https://www.r-bloggers.com/calculating-auc-the-area-under-a-roc-curve/.
Actually, I want to know different performance between Stata and R, in
multilevel logistic regression. For this purposes, I replicate ".do" file
use Stata in
http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0153778. The
nice journal not only gives ".do" file but also ".dta" file for Stata
user. Fyi,
I succeed running my dataset accordingly approach that use in the nice
article.

In Model ii, by adding the random effects of the clusters (neighbourhoods)
only, I perform a multilevel logistic regression. Adding the neighbourhoods
a random effect considerably increase the DA of the model. If the AU-ROC
increases. This means the neighbourhoods have a relevant (observational)
General Contextual Effect on the individual outcome. That is, knowledge on
the clusters where the individuals reside is relevant for classifying
individuals. That is, for distinguishing those with from those without the
outcome. In Model iii, as expected, the AU-ROC remains similar to Model ii
after including a neighbourhoods level variable as a fixed effect. Model ii
represents the “ceiling” of the explanatory power of the clusters. However,
particularly both syntax in the steps below, the process taking time very
long, particularly for a data set with the 130,585 observation that I have.

I trust can be replicate the syntax Stata below into the script language of
R under your advice. I want to to know the performance of R to analyse in
the syntax " roccomp".  Unfortunately, the process still not finished in
this step yet at the moment.


. * FIGURE 1 - AU-ROC
.

.  roccomp Y  r1m1p r1m2p, graph summary

. * FIGURE 3 - AU-ROC
.

. roccomp Y  r2m1p r2m2p, graph summary


Abbreviations
Y      = The dependent (or responding) variable
AUC    = Area Under the Curve.
AUROC  = Area Under the Receiver Operating Characteristic curve.
ROC    = Receiver operating characteristic
r1m1p  =  Pr(malaria)
r1m2p  = Predicted mean
r1m3p  = Predicted mean


In addition, I saw in
https://cran.r-project.org/web/packages/auRoc/index.html, and in
https://www.rdocumentation.org/packages/limma/versions/3.28.14/topics/auROC
,  there is an issue regarding auROC.

Hopefully with install "CRAN - Package auRoc", I can be running the
"roccomp" used the plug-in. In addition, I can compute areas under ROC
curves using the R Commander. However, the R Commander doesn't include ROC
curves, but a Google search suggests that the RcmdrPlugin.EZR, a plug-in
package for the R Commander, includes ROC curves and may do what I want.
Isn't it?


Again thank you very much, I appreciate it.


Best wishes


Hamzah


On 

Re: [R] RQDA/RGtk2 Installation Problem

2018-04-15 Thread David Winsemius

> On Apr 14, 2018, at 7:11 PM, Ryoko Yamamoto  wrote:
> 
> Greetings,
> 
> I have been having a problem installing RQDA on my Mac (OS 10.13.2). I
> followed the installation process on the RQDA page (
> http://rqda.r-forge.r-project.org/), but I keep getting an error message
> saying that I am missing pkg-config and GTK. I reinstalled XQuartz and GTK+
> 2.24.17 multiple times (and reinstalled R version 3.4.4), but kept
> receiving the same error message. I also tried to install RGtk2 from
> MacPort, but got the same error messages.

That may have messed things up if it modified your PATH environment settings. 
You should notice that the instructions on the 
http://rqda.r-forge.r-project.org/ page are to install the GTK+ binary from 
http://r.research.att.com/

See below:

> I am posting the log below, in
> hope it will help someone to see the problem/solution.
> 
> In my Googling for solution, I saw some other people posting the same
> problem, but have not seen a solution. I'd appreciate if anyone could help
> me to fix this. I really would love to be able to use RQDA!
> 
> Thanks in advance for your help.
> 
> Ryoko
> 
> 
> 
>> install.packages('RQDA')
> --- Please select a CRAN mirror for use in this session ---
> also installing the dependencies ‘cairoDevice’, ‘gWidgetsRGtk2’, ‘RGtk2’
> 
> Packages which are only available in source form, and may need
>  compilation of C/C++/Fortran: ‘cairoDevice’ ‘RGtk2’
> Do you want to attempt to install these from sources?
> y/n: y
> 
> installing the source packages ‘cairoDevice’, ‘gWidgetsRGtk2’, ‘RGtk2’,
> ‘RQDA’
> 
> trying URL 'https://cran.ism.ac.jp/src/contrib/cairoDevice_2.24.tar.gz'
> Content type 'application/x-gzip' length 39639 bytes (38 KB)
> ==
> downloaded 38 KB
> 
> trying URL 'https://cran.ism.ac.jp/src/contrib/gWidgetsRGtk2_0.0-86.tar.gz'
> Content type 'application/x-gzip' length 165187 bytes (161 KB)
> ==
> downloaded 161 KB
> 
> trying URL 'https://cran.ism.ac.jp/src/contrib/RGtk2_2.20.34.tar.gz'
> Content type 'application/x-gzip' length 2793069 bytes (2.7 MB)
> ==
> downloaded 2.7 MB
> 
> trying URL 'https://cran.ism.ac.jp/src/contrib/RQDA_0.3-1.tar.gz'
> Content type 'application/x-gzip' length 134113 bytes (130 KB)
> ==
> downloaded 130 KB
> 
> * installing *source* package ‘cairoDevice’ ...
> ** package ‘cairoDevice’ successfully unpacked and MD5 sums checked
> checking for pkg-config... no
> ERROR: Cannot find pkg-config.
> ERROR: configuration failed for package ‘cairoDevice’
> * removing
> ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/cairoDevice’

So you are on a Mac. There's a special mailing list for us. Have you installed 
Xcode and the CLT?

You will need to read and foolw the advice at the top of the following page:

https://cran.r-project.org/bin/macosx/tools/

Have you searched StackOverflow? I found teh following answer there. (I think 
it's a bit incomplete since you should have the system variables set according 
to the Tools page, so I editted that answer.) But this looked like a starting 
point ... after setting environment variables and getting the Fortran 
compileras per above

https://stackoverflow.com/questions/19645590/running-rattle-on-mac-os-x-10-9-mavericks/19719518#19719518

Do not reply to this mailing list (or to just me); rather send it to the 
R-SIG-Mac mailing list (after subscribing and reading the Posting Guide which 
it appears you have not done.)

-- 
David.

> * installing *source* package ‘RGtk2’ ...
> ** package ‘RGtk2’ successfully unpacked and MD5 sums checked
> checking for pkg-config... no
> checking for INTROSPECTION... no
> checking for GTK... no
> configure: error: GTK version 2.8.0 required
> ERROR: configuration failed for package ‘RGtk2’
> * removing
> ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RGtk2’
> ERROR: dependencies ‘RGtk2’, ‘cairoDevice’ are not available for package
> ‘gWidgetsRGtk2’
> * removing
> ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/gWidgetsRGtk2’
> ERROR: dependencies ‘gWidgetsRGtk2’, ‘RGtk2’ are not available for package
> ‘RQDA’
> * removing
> ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RQDA’
> 
> The downloaded source packages are in
> 
> ‘/private/var/folders/1_/59k3mmjd42q869s4tkbpb020gn/T/RtmpeYrG4k/downloaded_packages’
> Warning messages:
> 1: In install.packages("RQDA") :
>  installation of package ‘cairoDevice’ had non-zero exit status
> 2: In install.packages("RQDA") :
>  installation of package ‘RGtk2’ had non-zero exit status
> 3: In install.packages("RQDA") :
>  installation of package ‘gWidgetsRGtk2’ had non-zero exit status
> 4: In install.packages("RQDA") :
>  installation of package ‘RQDA’ had non-zero exit