Re: [R] Return value from function with For loop

2017-04-16 Thread Bert Gunter
David et. al.: "this levels is the level where you realize that the `for` function is different from most other R functions. It is really a side-effect-fucntion. " for(), while(), if(), next, etc. are *not* functions. ?for says: "These are the basic control-flow constructs of the R language."

Re: [R] help on readBin in R

2017-04-16 Thread Jeff Newmiller
That may or may not work, since text file newlines get altered in them. May have more luck with a "png" extension? -- Sent from my phone. Please excuse my brevity. On April 16, 2017 7:33:06 PM PDT, jim holtman wrote: >If the file is not too large, just change the extension

Re: [R] Return value from function with For loop

2017-04-16 Thread David Winsemius
> On Apr 16, 2017, at 7:26 PM, Ramnik Bansal wrote: > > In the code below > > > *ff <- function(n){ for(i in 1:n) (i+1)}* > > *n<-3;ff(n)->op;print(op)* > > Why doesnt *print(op) * print 4 and instead prints NULL. > Isnt the last line of code executed is *i+1 * and

Re: [R] Return value from function with For loop

2017-04-16 Thread jim holtman
In the first case you have a "for" and it is the statement after the 'for' that is the return value and it is a NULL. For example: > print(for (i in 1:4) i+1) NULL In the second case, the last statement if the expression '(n+1)' which give you the correct value: > xx <- function(n) n+1 >

Re: [R] help on readBin in R

2017-04-16 Thread jim holtman
If the file is not too large, just change the extension to '.txt' and attach it. Also include the code that you are using to read it in and a definition of the what the data is; e.g., first two byte are temperature, next four bytes are a station ID, Here is an example of reading in a binary

[R] Return value from function with For loop

2017-04-16 Thread Ramnik Bansal
In the code below *ff <- function(n){ for(i in 1:n) (i+1)}* *n<-3;ff(n)->op;print(op)* Why doesnt *print(op) * print 4 and instead prints NULL. Isnt the last line of code executed is *i+1 * and therefore that should be returned instead of NULL instead if I say *ff <- function(n){ (n+1) }*

Re: [R] question about the anova() function for deviance analysis

2017-04-16 Thread Jeff Newmiller
You are sending your email to a whole mailing list of volunteers, not a specific "maintainer" (and I am not one). However, your assertions convey unfamiliarity with statistics rather than deficiencies in R, and this mailing list is not a stats tutoring list. I did a quick Google search and

Re: [R] help on readBin in R

2017-04-16 Thread Jeff Newmiller
The mailing list has tight restrictions on attachments, so your attachment was not let through. Read the Posting Guide, and note that sometimes success requires some extended understanding of how your mail software works, and we probably don't know the details either. You might have success

Re: [R] question about the anova() function for deviance analysis

2017-04-16 Thread Bert Gunter
This list is about R programming; your question seems mostly about statistics, and is therefore off topic here. I suggest you consult a local statistical expert who *is* comfortable with such statistical analyses. In general, partitions of sums of squares in statistical models can depend on the

[R] question about the anova() function for deviance analysis

2017-04-16 Thread Sophie Dubois
Dear Maintener, > I have recently had a bad experience with the anova() function. > Indeed, I wanted to process a deviance analysis between 2 mixed linear > models and I was really surprise to see that depending on the ordre in > which I gave my models, the function did not the same thing: once it

[R] help on readBin in R

2017-04-16 Thread M.M saifuddin
I need to view the attached binary file. but can not read it, instead am getting very weird( i think garbage) numbers. The values are Temperature data so it should be somewhat in between 250 to 500. Can any altruist view it and give me the R code to view it. I am attaching the file. Please

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-16 Thread David Winsemius
> On Apr 16, 2017, at 3:43 PM, BR_email wrote: > > Peter: > Thanks for reply and suggestion. > Sorry, I am not sure how to assess. > The doc is too technical for me to understand. > I found multiple instructions online and in R and RStudio books. > I'm doing what it says, but

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-16 Thread peter dalgaard
That was aimed at Rolf... For the actual question, I think the best approach would be to follow up on Bill Dunlap's suggestion. The mails from Jeff and Henrik pretty much tell you step by step what to try to find out which files on yours system are being checked in order to find startup code.

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-16 Thread BR_email
Peter: Thanks for reply and suggestion. Sorry, I am not sure how to assess. The doc is too technical for me to understand. I found multiple instructions online and in R and RStudio books. I'm doing what it says, but no success. The instructions are simple as a-b-c, but some setting within the

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-16 Thread peter dalgaard
Um, tried help(.Rprofile) lately? -pd > On 17 Apr 2017, at 00:08 , Rolf Turner wrote: > > > On 17/04/17 08:46, John C Frain wrote: > >> Bruce >> >> The official documentation for these startup files can be obtained with >> the command >> >> Help(Startup) > > >

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-16 Thread Rolf Turner
On 17/04/17 08:46, John C Frain wrote: Bruce The official documentation for these startup files can be obtained with the command Help(Startup) Minor point of order, Mr. Chairman. That should be: help(Startup) There is (as far as I know) no such function as "Help()". It is

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-16 Thread Bruce Ratner PhD
Dear John: Thank you so much for your continued support. You are exceptional. I have followed everything you stated with no success. Prior to asking a question, I promise you my style is "to solve it myself." I read everything on the web, and purchased and read $200 in books. I hate to repeat,

Re: [R] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-16 Thread John C Frain
Bruce The official documentation for these startup files can be obtained with the command Help(Startup) at the R prompt or through search help in R studio. I have used R in various versions of Windows and Linux using the console version of R and various IDEs including Rstudio and these have

Re: [R] what does this syntax mean in R

2017-04-16 Thread Duncan Murdoch
On 16/04/2017 2:03 PM, Ramnik Bansal wrote: ​I am not able to understand the output of the following lines of code. *if(TRUE)(print("A"))​* Versus *if(TRUE){print("A"))* I assume you have a typo here (or maybe your posting in HTML has done more damage than usual. This line should be

[R] what does this syntax mean in R

2017-04-16 Thread Ramnik Bansal
​I am not able to understand the output of the following lines of code. *if(TRUE)(print("A"))​* Versus *if(TRUE){print("A"))* *In first case I get the ooutput as * *>[1] "A"* *>[1] "A"* *Why does the first case print "A" twice * *Why does it not happen with the statement

Re: [R] the difference between "-" and "!" between base and data.table package

2017-04-16 Thread Carl Sutton via R-help
Hi Thank you all for your input. But I must apologize. When I was searching the help page I went this far and stopped Logic {base}R Documentation Logical Operators Description These operators act on raw, logical and number-like vectors. Usage ! x x & y x && y x | y x || y xor(x, y)

[R] seq argument alomg.with

2017-04-16 Thread Carl Sutton via R-help
Hi Thank you gentlemen for sharing your knowledge. It makes perfect sense and using seq_along prevents errors that could be perplexing and time consuming to discover. Thank you Carl Sutton __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

Re: [R] the difference between "-" and "!" between base and data.table package

2017-04-16 Thread David Winsemius
> On Apr 15, 2017, at 5:18 PM, Carl Sutton via R-help > wrote: > > Hi > > > I normally use package data.table but today was doing some base R coding. > Had a problem for a bit which I finally resolved. I was attempting to > separate a data frame between train and

Re: [R] the difference between "-" and "!" between base and data.table package

2017-04-16 Thread Jeff Newmiller
! is a logical operator... it means "not". When you write lidx <- seq_along( mtcars[[ 1 ]] ) %in% train_indices you end up with a vector of logical values for which ! makes sense. Since R supports logical indexing this can be a very convenient way to select one group or the other. If you

Re: [R] How to integrate OpenBLAS LAPACK to my RStudio in WINDOWS 7?

2017-04-16 Thread David Winsemius
> On Apr 15, 2017, at 7:27 PM, Allan Tanaka via R-help > wrote: > > Hi. > I have installed OpenBLAS and LAPACK. It's working correctly in Python. > I also want OpenBLAS and LAPACK to be used in R to speed up computational > time but i can't find the installation guide

[R] the difference between "-" and "!" between base and data.table package

2017-04-16 Thread Carl Sutton via R-help
Hi I normally use package data.table but today was doing some base R coding. Had a problem for a bit which I finally resolved. I was attempting to separate a data frame between train and test sets, and in base R was using the "!" to exclude training set indices from the data frame. All I

[R] How to integrate OpenBLAS LAPACK to my RStudio in WINDOWS 7?

2017-04-16 Thread Allan Tanaka via R-help
Hi. I have installed OpenBLAS and LAPACK. It's working correctly in Python. I also want OpenBLAS and LAPACK to be used in R to speed up computational time but i can't find the installation guide for RStudio in Windows7. Does it mean that RStudio automatically detect the installed OpenBLAS and