Re: [R] Rtools required

2020-04-28 Thread Wang Jiefei
I do not exactly know what is going on with your problem but it is better
to use the old-school method to install the package so that you can avoid
any problems with Rstudio.

>From your post, I guess you are using Windows, so please see this link for
how to add the Rtools and R to the environment variable PATH:

https://www.computerhope.com/issues/ch000549.htm

 Then go to the command prompt, here is how:

https://www.howtogeek.com/235101/10-ways-to-open-the-command-prompt-in-windows-10/

Type R and enter. If you can see welcome information from R, that means at
least you have correctly added R into PATH. Check whether the R version is
4.0

Type "q()" to quit R, then go to the directory where your package is. For
example, if your package is in "D:\packages\mypackage", go to
"D:\packages\".

Type "R CMD INSTALL  mypackage", replace mypackage with the true folder
name of your package.

If everything is correct, you should be able to install the package. If you
get the same error, type "echo %PATH%" and post here so we can know exactly
what is going on.

Best,
Jiefei

On Tue, Apr 28, 2020 at 11:39 PM Duncan Murdoch 
wrote:

> On 28/04/2020 11:16 a.m., Steven Yen wrote:
> > Thanks. Can you kindly tell me what to read to do it the "standard way"?
>
> Start with ?INSTALL, and find more details in the Writing R Extensions
> manual.  I believe RStudio can be configured to use those tools rather
> than the devtools ones, but I don't know if it will still run its test
> for Rtools if you do it that way.
>
> I imagine you can also update RStudio and all of your packages;
> eventually that will work, if this is really the issue.
>
> Duncan Murdoch
>
> > Also, where can I find file .Renviron.
> >
> > On 2020/4/28 下午 11:08, Duncan Murdoch wrote:
> >> On 28/04/2020 11:02 a.m., Steven Yen wrote:
> >>> In RStudio, I enter File -> Open Project -> and browse to open a .Rproj
> >>> file. Then, I click Build -> Build Binary Package. Thanks.
> >>
> >> Do it the standard way instead of using devtools.
> >>
> >> Duncan Murdoch
> >>
> >>>
> >>> On 2020/4/28 下午 10:55, Duncan Murdoch wrote:
>  On 28/04/2020 9:56 a.m., Steven Yen wrote:
> > Thanks. I visited the Rtools web page and learned to run the
> following
> > lines. I am still getting the same warning message.
> 
>  And you are still not telling us what command you used to trigger that
>  message.
> 
>  Duncan Murdoch
> 
> >
> > > writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con =
> > "~/.Renviron")
> > > Sys.which("make")
> >   make
> > "C:\\rtools40\\usr\\bin\\make.exe"
> >
> > On 2020/4/28 下午 08:39, Duncan Murdoch wrote:
> >> On 28/04/2020 5:57 a.m., Steven T. Yen wrote:
> >>> Dear All
> >>>
> >>> I updated to R-4.0.0. and also installed the latest Rtools 4.0
> >>> (to now
> >>> the new default folder c:\rtools40). While compiling a package
> >>> (binary)
> >>> I received the follow marning message saying Rtools is required.
> Any
> >>> clues? Thanks.
> >>
> >> Presumably you didn't put it on your path, or you used a
> non-standard
> >> way to build.  You need to say what command you used.
> >>
> >> 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.
>

[[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] About the multiprecision computing package in R

2020-03-28 Thread Wang Jiefei
If you want to do a fancy matrix operation, you may need to invent the
wheel yourself. Rmpfr only supports limited matrix operations. There may
exist some C++ library that can do this job, I will suggest finding a
matrix library whose elements are of a template type, then combine it with
a multi-precision library so that you can do matrix operations in a very
high precision.

Best,
Jiefei

On Sat, Mar 28, 2020 at 12:32 AM 林伟璐 <13917987...@163.com> wrote:

> Thanks! I installed Rmpfr now.
>
>
> But it does NOT support eigen function ?
>
>
> x  <- array(1:16, dim=c(4,4))
> ev <- eigen(x)
> 
> mat <- mpfrArray(1:25, 64, dim = c(5,5))
> ev <- eigen(mat)
> Error in `dimnames<-`(`*tmp*`, value = NULL) : non-list RHS
> 
>
>
> WL
>
>
>
>
> At 2020-03-15 01:57:36, "Eric Berger" 
> CRAN Rmpfr
>
>
> On Sat, Mar 14, 2020 at 7:36 PM 林伟璐 <13917987...@163.com> wrote:
>
> Dear all
>
>
> I need a multiprecision computing package in R, if anyone in the list
> knows, please let me known...
>
>
> Many thanks
>
>
> Weilu Lin
> [[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.
>

[[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] Installing Packages

2020-03-11 Thread Wang Jiefei
Hi,

This means that the package you were trying to install does not have a
compiled version stored on the server. Sometimes you would not see the
question because the server has compiled the package for you, but sometimes
it doesn't.

Cheers,
Jiefei



On Wed, Mar 11, 2020 at 10:46 AM Jeff Reichman 
wrote:

> R-Help
>
>
>
> Recently I've started receiving the following message when updating
> packages
> - "Do you want to install from sources the packages which need
> compilation."
> I generally click "Yes," but what is this asking me. That is it appears to
> be re-compiling certain packages? Why?
>
>
>
> RStudio version: 1.2.5033
>
> R version: 3.6.3
>
>
>
>
>
> Sincerely
>
>
>
> Jeff Reichman
>
>
>
>
> [[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] [FORGED] Re: Help needed for one question (Urgent)

2019-11-05 Thread Wang Jiefei
Agree, especially there is an "Urgent" on the title. He must be too
"urgent" to think about your answer. I will wonder if your effort will be
in vain.

Best,
Jiefei



On Tue, Nov 5, 2019 at 4:52 PM Rolf Turner  wrote:

>
> Richard:  I know that you mean well, but *please* don't do people's
> homework for them!!!  (They are *cheating* by asking R-help to do their
> homework.)
>
> cheers,
>
> Rolf Turner
>
> On 6/11/19 4:27 AM, Richard O'Keefe wrote:
> > This looks vaguely like something from exercism.
> > Let's approach it logically.
> >   xa xb xc ya yb zc
> > We see two patterns here:
> > A:  x x x y y z
> > B: a b c a b c
> > If only we had these two character vectors, we could use
> >   paste(A, B, sep = "")
> > to get the desired result.  So now we have reduced the
> > problem to two simpler subproblems.  We have been given
> > a clue that rep() might be useful.
> > A: rep(c("x", "y", "z"), c(1, 2, 3))
> > B: rep(c("a", "b", "c"), 3)
> > But you were told not to use c().  So now we have three
> > simpler subsubproblems:
> > C: "x" "y" "z"
> > D: 3 2 1
> > E: "a" "b" "c"
> > You were given another hint.  seq().  That builds a vector of numbers.
> > Reading ?seq will give you
> > D: seq(from = 3, to = 1, by = -1)
> > or using ":" syntax,
> > D: 3:1
> >
> > What about C and E?  This needs two more pieces of knowledge:
> > - the variable letters,whose value is c("a","b",...,"y","z")
> > - how vector indexing works in R.
> > E: letters[1:3]
> > C: letters[24:26]
> > So now we can put all the pieces together:
> > paste(rep(letters[24:26], 3:1), rep(letters[1:3], 2), sep = "")
> >
> > You were given
> >   - seq
> >   - rep
> > as hints.  You were expected to look up string handling in R
> > and find things like paste(), substr(), and nchar().
> >
> > What about the variable 'letters'?
> > Well, you were expected to know or find out about substr.
> > You were certainly expected to know about "vectorising".
> > So you would naturally try substr("abc", 1:3, 1:3).
> > And that would not work.
> > So you would be expected to read the documentation:
> > ?substr
> > And then you would find that substr() *doesn't* do what
> > you expect, but substring() *does*.  So
> > C: substring("xyz", 1:3, 1:3)
> > E: substring("abc", 1:3, 1:3)
> >
> > This is not really an exercise in R programming.
> > In real R programming you *don't* avoid arbitrary aspects of the
> > language and library, but use whatever is appropriate.
> > So what *is* this exercise about?
> >
> > (1) It is an exercise in working backwards.  (See the classic book
> > "How to Solve It" by Polya.)  You know what you must construct,
> > you have been given some directions about what to use.  It's
> > about saying "well, I could *finish* this task by doing this action,
> > so what would I have to set up for that?"  In this case, the key
> > step for me was seeing xa xb xc ya yb yc as (x,x,x,y,y,z)++(a,b,c,a,b,c).
> > The mention of rep had me *looking* for repetitions like that.
> >
> > (2) It is an exercise in using the R documentation to figure out how to
> > use rep and seq and what is available for splitting and pasting strings.
> >
> > There is of course no unique answer to this.
> > substring("xaxbxcyaybzc", seq(from=1,to=11,by=2), seq(from=2,to=12,by=2))
> > is another solution.  You didn't say you *had* to use rep.
> >
> > It's not the answer that matters for an exercise like this.
> > It's how you get there.
> >
> >
> >
> >
> >
> > On Tue, 5 Nov 2019 at 23:40, Chandeep Kaur 
> wrote:
> >>
> >> Dear Team,
> >>
> >> Could you please help me with the below question? How can I get the
> desired
> >> output?
> >>
> >> Produce the following sequence using only rep(), seq() and potentially
> >> other functions/operators. You must not use c() nor explicit loops
> >>
> >> “xa” “xb” “xc” “ya” “yb” “zc”
> >>
> >> Thanks & Regards,
> >>
> >> Chandeep Kaur
>
> __
> 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] Simulations study not working entirely...

2019-10-21 Thread Wang Jiefei
What problem you have encountered? I still do not know your question.
Please elaborate on your question and post the error message or
something else that prevents you from running the code.

Thanks,
Jiefei

On Mon, Oct 21, 2019 at 3:13 PM varin sacha  wrote:

>  Dear Wang,
>
> Really appreciated but I have tried dependencies=TRUE and it still does
> not work.
> Is it because my R version is 3.6.1 ? sessionInfo() at the end of the
> message
>
> install.packages( "robustbase",dependencies=TRUE )
> install.packages( "MASS" ,dependencies=TRUE )
> install.packages( "quantreg" ,dependencies=TRUE )
> install.packages( "RobPer",dependencies=TRUE  )
> install.packages("devtools",dependencies=TRUE )
> install_github("kloke/hbrfit",dependencies=TRUE) install.packages('
> http://www.stat.wmich.edu/mckean/Stat666/Pkgs/npsmReg2_0.1.1.tar.gz',dependencies=TRUE
> )
> install.packages( "RobStatTM",dependencies=TRUE  )
>
> library(robustbase)
> library(MASS)
> library(quantreg)
> library(RobPer)
> library(hbrfit)
> library(RobStatTM)
>
> sessionInfo()
> R version 3.6.1 (2019-07-05)
> Platform: x86_64-apple-darwin15.6.0 (64-bit)
> Running under: macOS Sierra 10.12.6
> Matrix products: default
> BLAS:
> /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
> LAPACK:
> /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
> Random number generation:
> RNG: Mersenne-Twister
> Normal:  Inversion
> Sample:  Rounding
> locale:[1] fr_CH.UTF-8/fr_CH.UTF-8/fr_CH.UTF-8/C/fr_CH.UTF-8/fr_CH.UTF-8
> attached base packages:[1] stats graphics  grDevices utils
> datasets  methods   base
> loaded via a namespace (and not attached):[1] compiler_3.6.1
>
>
>
>
>
>
>
> Le lundi 21 octobre 2019 à 20:12:02 UTC+2, Wang Jiefei 
> a écrit :
>
>
>
>
>
> Hi,
>
> After I install all dependencies your example seems fine
>
> ```
> > MSE_fastMM
> [1] 2.629064e-05
> >
> > MSE_Huber
> [1] 1.826184e-05
> >
> > MSE_Tukey
> [1] 2.622499e-05
> >
> > MSE_L1
> [1] 1.044155e-05
> >
> > MSE_fastTau
> [1] NaN
> >
> > MSE_HBR
> [1] 1.60821e-05
> >
> > MSE_DCML
> [1] 9.519007e-06
> >
> > sessionInfo()
> R version 3.6.0 (2019-04-26)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows >= 8 x64 (build 9200)
>
> Matrix products: default
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
>
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] splines   stats graphics  grDevices utils datasets  methods
> base
>
> other attached packages:
>  [1] hbrfit_0.02   Rfit_0.23.0   RobStatTM_1.0.1
> fit.models_0.5-14
>  [5] RobPer_1.2.2  rgenoud_5.8-3.0   BB_2019.10-1  quantreg_5.51
>
>  [9] SparseM_1.77  MASS_7.3-51.4 robustbase_0.93-5
> ```
>
> There is no error or warning, except that  MSE_fastTau is an NaN. What
> problem are you looking for?
>
> Best,
> Jiefei
>
> On Mon, Oct 21, 2019 at 12:41 PM varin sacha via R-help <
> r-help@r-project.org> wrote:
> > Dear R-Experts,
> >
> > Here below my reproducible example working but not entirely (working).
> What I understand is that there is a problem of libraries library(hbrfit)
> and ... ? How can I make it work entirely, many thanks for your precious
> help.
> >
> > SIMULATION STUDY 3 variables with 10% outliers n=2000
> > install.packages( "robustbase" )
> > install.packages( "MASS" )
> > install.packages( "quantreg" )
> > install.packages( "RobPer" )
> > install.packages("devtools")  library("devtools")
> install_github("kloke/hbrfit") install.packages('
> http://www.stat.wmich.edu/mckean/Stat666/Pkgs/npsmReg2_0.1.1.tar.gz')
> > install.packages( "RobStatTM" )
> >
> >
> > library(robustbase)
> > library(MASS)
> > library(quantreg)
> > library(RobPer)
> > library(hbrfit)
> >
> > library(RobStatTM)
> >
> > n<-2000
> >
> > x<-runif(n, 0, 5)
> >
> > z <- rnorm(n, 2, 3)
> >
> > a <- runif(n, 0, 5)
> >
> > y_model<- 0.1*x - 0.5 * z - a + 10
> >
> > y_obs <- y_model +c( rnorm(n*0.9, 0, 0.1), rnorm(n*0.1, 0, 0.5) )
> >
> >
> > fastMM <- lmrob( y_obs ~ x+z+a)
> >
> > Huber <

Re: [R] Simulations study not working entirely...

2019-10-21 Thread Wang Jiefei
Hi,

After I install all dependencies your example seems fine

```
> MSE_fastMM
[1] 2.629064e-05
>
> MSE_Huber
[1] 1.826184e-05
>
> MSE_Tukey
[1] 2.622499e-05
>
> MSE_L1
[1] 1.044155e-05
>
> MSE_fastTau
[1] NaN
>
> MSE_HBR
[1] 1.60821e-05
>
> MSE_DCML
[1] 9.519007e-06
>
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252

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

other attached packages:
 [1] hbrfit_0.02   Rfit_0.23.0   RobStatTM_1.0.1   fit.models_0.5-14
 [5] RobPer_1.2.2  rgenoud_5.8-3.0   BB_2019.10-1  quantreg_5.51
 [9] SparseM_1.77  MASS_7.3-51.4 robustbase_0.93-5
```

There is no error or warning, except that  MSE_fastTau is an NaN. What
problem are you looking for?

Best,
Jiefei

On Mon, Oct 21, 2019 at 12:41 PM varin sacha via R-help <
r-help@r-project.org> wrote:

> Dear R-Experts,
>
> Here below my reproducible example working but not entirely (working).
> What I understand is that there is a problem of libraries library(hbrfit)
> and ... ? How can I make it work entirely, many thanks for your precious
> help.
>
> SIMULATION STUDY 3 variables with 10% outliers n=2000
> install.packages( "robustbase" )
> install.packages( "MASS" )
> install.packages( "quantreg" )
> install.packages( "RobPer" )
> install.packages("devtools")  library("devtools")
> install_github("kloke/hbrfit") install.packages('
> http://www.stat.wmich.edu/mckean/Stat666/Pkgs/npsmReg2_0.1.1.tar.gz')
> install.packages( "RobStatTM" )
>
>
> library(robustbase)
> library(MASS)
> library(quantreg)
> library(RobPer)
> library(hbrfit)
>
> library(RobStatTM)
>
> n<-2000
>
> x<-runif(n, 0, 5)
>
> z <- rnorm(n, 2, 3)
>
> a <- runif(n, 0, 5)
>
> y_model<- 0.1*x - 0.5 * z - a + 10
>
> y_obs <- y_model +c( rnorm(n*0.9, 0, 0.1), rnorm(n*0.1, 0, 0.5) )
>
>
> fastMM <- lmrob( y_obs ~ x+z+a)
>
> Huber <- rlm( y_obs ~ x+z+a)
>
> Tukey <- rlm( y_obs ~ x+z+a, psi = psi.bisquare )
>
> L1 <- rq( y_obs ~ x+z+a, tau = 0.5 )
>
> fastTau <-
> FastTau(model.matrix(~newdata$x+newdata$z+newdata$a),newdata$y_obs)
>
> HBR<-hbrfit(y_obs ~ x+z+a)
>
> DCML <-lmrobdetDCML(y_obs ~ x+z+a)
>
>
> MSE_fastMM<-mean((fastMM$fitted.values - y_model)^2)
>
> MSE_Huber<-mean((Huber$fitted.values - y_model)^2)
>
> MSE_Tukey<-mean((Tukey$fitted.values - y_model)^2)
>
> MSE_L1<-mean((L1$fitted.values - y_model)^2)
>
> MSE_fastTau<-mean((fastTau$fitted.values - y_model)^2)
>
> MSE_HBR<-mean((HBR$fitted.values - y_model)^2)
>
> MSE_DCML<-mean((DCML$fitted.values - y_model)^2)
>
>
> MSE_fastMM
>
> MSE_Huber
>
> MSE_Tukey
>
> MSE_L1
>
> MSE_fastTau
>
> MSE_HBR
>
> MSE_DCML
>
> ###
>
> __
> 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] Simulations study not working entirely...

2019-10-21 Thread Wang Jiefei
Hi Varin,

I did not look inside your code yet but I have a few suggestions. First I
think your problem should be described in more detail, just saying you have
a problem is not enough for us to diagnose. Second Your example depends on
too many other packages and I'm not sure if you need all of them to
reproduce the error. A minimum example will be appreciated. finally, if
this is a package problem as you said, it might be better to ask the
question in https://github.com/kloke/hbrfit/issues since the author
definitely knows the context more than us and might be able to provide a
solution for your question.

Best,
Jiefei

On Mon, Oct 21, 2019 at 12:41 PM varin sacha via R-help <
r-help@r-project.org> wrote:

> Dear R-Experts,
>
> Here below my reproducible example working but not entirely (working).
> What I understand is that there is a problem of libraries library(hbrfit)
> and ... ? How can I make it work entirely, many thanks for your precious
> help.
>
> SIMULATION STUDY 3 variables with 10% outliers n=2000
> install.packages( "robustbase" )
> install.packages( "MASS" )
> install.packages( "quantreg" )
> install.packages( "RobPer" )
> install.packages("devtools")  library("devtools")
> install_github("kloke/hbrfit") install.packages('
> http://www.stat.wmich.edu/mckean/Stat666/Pkgs/npsmReg2_0.1.1.tar.gz')
> install.packages( "RobStatTM" )
>
>
> library(robustbase)
> library(MASS)
> library(quantreg)
> library(RobPer)
> library(hbrfit)
>
> library(RobStatTM)
>
> n<-2000
>
> x<-runif(n, 0, 5)
>
> z <- rnorm(n, 2, 3)
>
> a <- runif(n, 0, 5)
>
> y_model<- 0.1*x - 0.5 * z - a + 10
>
> y_obs <- y_model +c( rnorm(n*0.9, 0, 0.1), rnorm(n*0.1, 0, 0.5) )
>
>
> fastMM <- lmrob( y_obs ~ x+z+a)
>
> Huber <- rlm( y_obs ~ x+z+a)
>
> Tukey <- rlm( y_obs ~ x+z+a, psi = psi.bisquare )
>
> L1 <- rq( y_obs ~ x+z+a, tau = 0.5 )
>
> fastTau <-
> FastTau(model.matrix(~newdata$x+newdata$z+newdata$a),newdata$y_obs)
>
> HBR<-hbrfit(y_obs ~ x+z+a)
>
> DCML <-lmrobdetDCML(y_obs ~ x+z+a)
>
>
> MSE_fastMM<-mean((fastMM$fitted.values - y_model)^2)
>
> MSE_Huber<-mean((Huber$fitted.values - y_model)^2)
>
> MSE_Tukey<-mean((Tukey$fitted.values - y_model)^2)
>
> MSE_L1<-mean((L1$fitted.values - y_model)^2)
>
> MSE_fastTau<-mean((fastTau$fitted.values - y_model)^2)
>
> MSE_HBR<-mean((HBR$fitted.values - y_model)^2)
>
> MSE_DCML<-mean((DCML$fitted.values - y_model)^2)
>
>
> MSE_fastMM
>
> MSE_Huber
>
> MSE_Tukey
>
> MSE_L1
>
> MSE_fastTau
>
> MSE_HBR
>
> MSE_DCML
>
> ###
>
> __
> 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] [R-devel] Source Code for function

2019-09-06 Thread Wang Jiefei
If you are looking for an R code parser, I think the `parse` and `eval`
function might be a good start point. See the example below.

> parse(text="function(x)message(x)")
expression(function(x)message(x))
> eval(parse(text="function(x)message(x)"))
function(x)message(x)

Best,
Jiefei

On Fri, Sep 6, 2019 at 12:55 PM Golden, Shelby  wrote:

> Hello Bert,
>
> Thank you for the reply and your clarifications. Yes, it might be helpful
> to look into R’s formal grammar to see how “function” parses input to
> delegate correct syntax. Is that accessible online?
>
> Thank you,
> Shelby
>
>
> From: Bert Gunter 
> Date: Friday, September 6, 2019 at 10:44 AM
> To: "Golden, Shelby" 
> Cc: "r-help@R-project.org" , "Gillenwater, Lucas" <
> gillenwat...@njhealth.org>
> Subject: Re: [R] [R-devel] Source Code for function
>
> 1. This is a plain text list; all html is stripped. So there is no red
> highlighting.
>
> 2. There is no "source code" for "function" -- it is a reserved keyword.
> Or are you looking for R's formal grammar -- e.g. how it parses input to
> determine correct syntax?
>
>
>
> 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 Fri, Sep 6, 2019 at 8:51 AM Golden, Shelby  > wrote:
> Hi all,
>
> I have been attempting to access the source code for the keyword
> “function” to better understand how it assigns and stores logical inputs,
> like in the subset() [base] function. Does anyone know how I can access the
> source code for this?
>
> For example, if I have
> norm <- function(x){
>   sqrt(x%*%x))
> }
> I am looking for the source code for the “function” portion, highlighted
> in red.
>
> Thank you for your time and assistance,
> Shelby Golden
> Lab Researcher Technician
> Dr. Russell Bowler’s Lab
> Department of Medicine
> National Jewish Health in Denver, CO
> Phone: (303) 270-2598
>
> NOTICE: This email message is for the sole use of the intended
> recipient(s) and may contain confidential and privileged information. Any
> unauthorized review, use, disclosure or distribution is prohibited. If you
> are not the intended recipient, please contact the sender by reply email
> and destroy all copies of the original message.
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To
> UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help<
> http://mx2.njhealth.org:32224/?dmVyPTEuMDAxJiZmMWRiYmMxZjFmNmI5ZDBkMz01RDcyOEQwN18yMjk2OF8zOTk2XzEmJjljNzlmMDA4YWRmZTZjMz0xMjMzJiZ1cmw9aHR0cHMlM0ElMkYlMkZzdGF0JTJFZXRoeiUyRWNoJTJGbWFpbG1hbiUyRmxpc3RpbmZvJTJGci1oZWxw
> >
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<
> http://mx2.njhealth.org:32224/?dmVyPTEuMDAxJiZlMTkwYmMwMzFlNjk4ZTAzNz01RDcyOEQwN18yMjk2OF8zOTk2XzEmJmFkYTkxMWRkMWRhZTFkNz0xMjMzJiZ1cmw9aHR0cCUzQSUyRiUyRnd3dyUyRVItcHJvamVjdCUyRW9yZyUyRnBvc3RpbmctZ3VpZGUlMkVodG1s
> >
> 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.
>

[[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] [R-devel] Source Code for function

2019-09-06 Thread Wang Jiefei
Hi Shelby,

Not quite sure what you are trying to do. Mine might be off-topic but have
you seen this document?

http://adv-r.had.co.nz/Functions.html#function-components

It illustrates the components of a function.

Best,
Jiefei

On Fri, Sep 6, 2019 at 11:52 AM Golden, Shelby  wrote:

> Hi all,
>
> I have been attempting to access the source code for the keyword
> “function” to better understand how it assigns and stores logical inputs,
> like in the subset() [base] function. Does anyone know how I can access the
> source code for this?
>
> For example, if I have
> norm <- function(x){
>   sqrt(x%*%x))
> }
> I am looking for the source code for the “function” portion, highlighted
> in red.
>
> Thank you for your time and assistance,
> Shelby Golden
> Lab Researcher Technician
> Dr. Russell Bowler’s Lab
> Department of Medicine
> National Jewish Health in Denver, CO
> Phone: (303) 270-2598
>
> NOTICE: This email message is for the sole use of the intended
> recipient(s) and may contain confidential and privileged information. Any
> unauthorized review, use, disclosure or distribution is prohibited. If you
> are not the intended recipient, please contact the sender by reply email
> and destroy all copies of the original message.
> [[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.