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

2017-04-15 Thread Jeff Newmiller
Well, to be fair, .Rprofile is an R configuration file, so it was merely the 
subject line that was off-topic.
-- 
Sent from my phone. Please excuse my brevity.

On April 15, 2017 4:24:06 PM PDT, Rolf Turner  wrote:
>On 16/04/17 07:57, BR_email wrote:
>> Boris:
>> As before, you assume that I, Bruce Ratner, just asks questions
>without
>> first trying it myself.
>> FYI: I purchased and read four RStudio books, as well as all the
>links I
>> found in the web.
>> I will not take your maligning me.
>> Please try to assist me, but do not bully me.
>> Bruce Ratner, Ph.D.
>
>Bruce, you are being preciously hypersensitive.  Boris's comment was 
>completely appropriate and betrayed not the slightest trace of 
>"bullying".  If you had indeed done your homework in the manner that 
>Boris recommended you would had no need to clutter this mailing list 
>with your (off-topic) question.
>
>cheers,
>
>Rolf Turner

__
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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread BR_email

John:
Thanks for your help.

Regarding an apology to Boris. No. He is a condescending person.
On the three requests for help, which I made since starting with R, he 
tells me to read the manuals, blogs, etc.,

while persons like you offer help. That is not strange?
My three questions Boris replies with nothing, yet others feel my 
request is genuine and offer assistance.


I spend hours and hours reading the manuals, blogs, and purchasing and 
reading multiple books on R and RStudio.

After that, when I am stuck, I go to the r-help.

Bruce Ratner, Ph.D.
The Significant Statistician™
(516) 791-3544
Statistical Predictive Analtyics -- www.DMSTAT1.com
Machine-Learning Data Mining and Modeling -- www.GenIQ.net
 


John C Frain wrote:
If you have your Rprofile.site file in the default place you will need 
to start whatever editor you are using in administrator mode to save 
your changes. At least that is so on my PC with windows 10 with R 
installed in the default directory. I use notepad++ in administrator 
mode. I presume that you could do the same with rstudio.


If you think that answers are short or to the point remember that 
someone is giving of his time to help you. I think that you owe 
someone an apology.


John C Frain
3 Aranleigh Park
Rathfarnham
Dublin 14
Ireland
www.tcd.ie/Economics/staff/frainj/home.html 


mailto:fra...@tcd.ie 
mailto:fra...@gmail.com 

On 15 April 2017 at 23:19, Henrik Bengtsson 
> wrote:


Hi.

First, there should be no difference in where and how R and RStudio
locate the R startup file.

Second, if there is an .Rprofile in the working directory (i.e.
./.Rprofile), then that file with have higher priority than the file
located in ~/.Rprofile.  You can use the following R calls, also on
Windows, to check if you have either of these two files:

> file <- normalizePath("./.Rprofile")
> file
> file.exist(file)

> file <- normalizePath("~/.Rprofile")
> file
> file.exist(file)

In my case, my working directory is C:/Users/hb/Documents/Projects/, I
have a ~/.Rprofile file, but not a .Rprofile in the working directory.
So, I get:

> file <- normalizePath("./.Rprofile")
> file
[1] "C:\\Users\\hb\\Documents\\Projects\\.Rprofile"
> file.exists(file)
[1] FALSE

> file <- normalizePath("~/.Rprofile")
> file
[1] "C:\\Users\\hb\\Documents\\.Rprofile"
> file.exists(file)
[1] TRUE

This tells me that my startup file that R tries to load / source
during startup is "C:\\Users\\hb\\Documents\\.Rprofile" and that's the
one I should edit.

BTW, the value of normalizePath("~/.Rprofile") and
file.path(Sys.getenv("HOME"), ".Rprofile") should point to the same
file, expect that normalizePath() makes all backward slashed on
Windows; the former is just a neater version to use:

> normalizePath("~/.Rprofile")
[1] "C:\\Users\\hb\\Documents\\.Rprofile"

> file.path(Sys.getenv("HOME"), ".Rprofile")
[1] "C:/Users/hb/Documents/.Rprofile"

> normalizePath(file.path(Sys.getenv("HOME"), ".Rprofile"))
[1] "C:\\Users\\hb\\Documents\\.Rprofile"

(all of the above reference the same file).

So, if file.exists(normalizePath("~/.Rprofile")) gives FALSE, then you
don't have that file.  If you think you've edited that, then it might
be that you hit the peculiar Windows property where it hides the
filename extension from you in the Explorer.  It might be that you
instead have created / edited the file:

normalizePath("~/.Rprofile.txt")

That often happens when one uses Notepad and saves the file as
.Rprofile - Notepad simply add a *.txt filename extension unless you
save it with quotation marks in the Save-As panel.

Now, if you indeed have the file:

normalizePath("~/.Rprofile")

then there is one last annoyance in R that you might have hit. 
 If you're last

line in that file does not have a newline, the the file will be
silently ignored by R when R start.  There won't be a warning - not
even a message.  That is true for all OSes.  It's a "feature" that
should really be fixed, because I keep seeing it tricking beginners
and advanced R users all the times.  The easiest way to check if this
is your problem, use readLines() to read in the content; readLines()
will give a warning if the last line doesn't have a new line, e.g.

> readLines(normalizePath("~/.Rprofile"))
[1] "options(prompt=\"R> \")" "set.seed(12345)"
Warning message:
In readLines(normalizePath("~/.Rprofile")) :
  incomplete final line found on 'C:\Users\hb\Documents\.Rprofile'

If you don't see the warning message, you should be fine.

Finally, an easy way to setup a ~/.Rprofile startup file is to do it
from within R, e.g.

> 

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

2017-04-15 Thread Rolf Turner

On 16/04/17 07:57, BR_email wrote:

Boris:
As before, you assume that I, Bruce Ratner, just asks questions without
first trying it myself.
FYI: I purchased and read four RStudio books, as well as all the links I
found in the web.
I will not take your maligning me.
Please try to assist me, but do not bully me.
Bruce Ratner, Ph.D.


Bruce, you are being preciously hypersensitive.  Boris's comment was 
completely appropriate and betrayed not the slightest trace of 
"bullying".  If you had indeed done your homework in the manner that 
Boris recommended you would had no need to clutter this mailing list 
with your (off-topic) question.


cheers,

Rolf Turner

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

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


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

2017-04-15 Thread John C Frain
If you have your Rprofile.site file in the default place you will need to
start whatever editor you are using in administrator mode to save your
changes. At least that is so on my PC with windows 10 with R installed in
the default directory. I use notepad++ in administrator mode. I presume
that you could do the same with rstudio.

If you think that answers are short or to the point remember that someone
is giving of his time to help you. I think that you owe someone an apology.

John C Frain
3 Aranleigh Park
Rathfarnham
Dublin 14
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:fra...@tcd.ie
mailto:fra...@gmail.com

On 15 April 2017 at 23:19, Henrik Bengtsson 
wrote:

> Hi.
>
> First, there should be no difference in where and how R and RStudio
> locate the R startup file.
>
> Second, if there is an .Rprofile in the working directory (i.e.
> ./.Rprofile), then that file with have higher priority than the file
> located in ~/.Rprofile.  You can use the following R calls, also on
> Windows, to check if you have either of these two files:
>
> > file <- normalizePath("./.Rprofile")
> > file
> > file.exist(file)
>
> > file <- normalizePath("~/.Rprofile")
> > file
> > file.exist(file)
>
> In my case, my working directory is C:/Users/hb/Documents/Projects/, I
> have a ~/.Rprofile file, but not a .Rprofile in the working directory.
> So, I get:
>
> > file <- normalizePath("./.Rprofile")
> > file
> [1] "C:\\Users\\hb\\Documents\\Projects\\.Rprofile"
> > file.exists(file)
> [1] FALSE
>
> > file <- normalizePath("~/.Rprofile")
> > file
> [1] "C:\\Users\\hb\\Documents\\.Rprofile"
> > file.exists(file)
> [1] TRUE
>
> This tells me that my startup file that R tries to load / source
> during startup is "C:\\Users\\hb\\Documents\\.Rprofile" and that's the
> one I should edit.
>
> BTW, the value of normalizePath("~/.Rprofile") and
> file.path(Sys.getenv("HOME"), ".Rprofile") should point to the same
> file, expect that normalizePath() makes all backward slashed on
> Windows; the former is just a neater version to use:
>
> > normalizePath("~/.Rprofile")
> [1] "C:\\Users\\hb\\Documents\\.Rprofile"
>
> > file.path(Sys.getenv("HOME"), ".Rprofile")
> [1] "C:/Users/hb/Documents/.Rprofile"
>
> > normalizePath(file.path(Sys.getenv("HOME"), ".Rprofile"))
> [1] "C:\\Users\\hb\\Documents\\.Rprofile"
>
> (all of the above reference the same file).
>
> So, if file.exists(normalizePath("~/.Rprofile")) gives FALSE, then you
> don't have that file.  If you think you've edited that, then it might
> be that you hit the peculiar Windows property where it hides the
> filename extension from you in the Explorer.  It might be that you
> instead have created / edited the file:
>
> normalizePath("~/.Rprofile.txt")
>
> That often happens when one uses Notepad and saves the file as
> .Rprofile - Notepad simply add a *.txt filename extension unless you
> save it with quotation marks in the Save-As panel.
>
> Now, if you indeed have the file:
>
> normalizePath("~/.Rprofile")
>
> then there is one last annoyance in R that you might have hit.   If you're
> last
> line in that file does not have a newline, the the file will be
> silently ignored by R when R start.  There won't be a warning - not
> even a message.  That is true for all OSes.  It's a "feature" that
> should really be fixed, because I keep seeing it tricking beginners
> and advanced R users all the times.  The easiest way to check if this
> is your problem, use readLines() to read in the content; readLines()
> will give a warning if the last line doesn't have a new line, e.g.
>
> > readLines(normalizePath("~/.Rprofile"))
> [1] "options(prompt=\"R> \")" "set.seed(12345)"
> Warning message:
> In readLines(normalizePath("~/.Rprofile")) :
>   incomplete final line found on 'C:\Users\hb\Documents\.Rprofile'
>
> If you don't see the warning message, you should be fine.
>
> Finally, an easy way to setup a ~/.Rprofile startup file is to do it
> from within R, e.g.
>
> > cat('options(prompt="R> ")\n', file = "~/.Rprofile")
> > cat('set.seed(12345)\n', file = "~/.Rprofile", append = TRUE)
>
> The '\n' at the end of each string represents a newline character, so
> make sure you don't forget those.
>
> Hope this help
>
> Henrik
>
>
>
> On Sat, Apr 15, 2017 at 1:10 PM, David Winsemius 
> wrote:
> >
> >> On Apr 15, 2017, at 12:46 PM, Boris Steipe 
> wrote:
> >>
> >> As with R, do with RStudio: Read The Beautiful Manual, and peruse The
> Google. For example, searching Google with the two (admittedly hard to
> guess) cryptograms:
> >>  "RStudio Rprofile"
> >>
> >> will present more than a dozen most enlightening links to fulfil your
> desire.
> >>
> >> Perhaps the following link works better for you though:
> >>  https://www.bing.com/search?q=rstudio+rprofile
> >
> > Another promising search strategy would be SO with "[rstudio]" in the
> tags:
> >
> > http://stackoverflow.com/search?q=%5Brstudio%5D+rprofile+windows
> 

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

2017-04-15 Thread Henrik Bengtsson
Hi.

First, there should be no difference in where and how R and RStudio
locate the R startup file.

Second, if there is an .Rprofile in the working directory (i.e.
./.Rprofile), then that file with have higher priority than the file
located in ~/.Rprofile.  You can use the following R calls, also on
Windows, to check if you have either of these two files:

> file <- normalizePath("./.Rprofile")
> file
> file.exist(file)

> file <- normalizePath("~/.Rprofile")
> file
> file.exist(file)

In my case, my working directory is C:/Users/hb/Documents/Projects/, I
have a ~/.Rprofile file, but not a .Rprofile in the working directory.
So, I get:

> file <- normalizePath("./.Rprofile")
> file
[1] "C:\\Users\\hb\\Documents\\Projects\\.Rprofile"
> file.exists(file)
[1] FALSE

> file <- normalizePath("~/.Rprofile")
> file
[1] "C:\\Users\\hb\\Documents\\.Rprofile"
> file.exists(file)
[1] TRUE

This tells me that my startup file that R tries to load / source
during startup is "C:\\Users\\hb\\Documents\\.Rprofile" and that's the
one I should edit.

BTW, the value of normalizePath("~/.Rprofile") and
file.path(Sys.getenv("HOME"), ".Rprofile") should point to the same
file, expect that normalizePath() makes all backward slashed on
Windows; the former is just a neater version to use:

> normalizePath("~/.Rprofile")
[1] "C:\\Users\\hb\\Documents\\.Rprofile"

> file.path(Sys.getenv("HOME"), ".Rprofile")
[1] "C:/Users/hb/Documents/.Rprofile"

> normalizePath(file.path(Sys.getenv("HOME"), ".Rprofile"))
[1] "C:\\Users\\hb\\Documents\\.Rprofile"

(all of the above reference the same file).

So, if file.exists(normalizePath("~/.Rprofile")) gives FALSE, then you
don't have that file.  If you think you've edited that, then it might
be that you hit the peculiar Windows property where it hides the
filename extension from you in the Explorer.  It might be that you
instead have created / edited the file:

normalizePath("~/.Rprofile.txt")

That often happens when one uses Notepad and saves the file as
.Rprofile - Notepad simply add a *.txt filename extension unless you
save it with quotation marks in the Save-As panel.

Now, if you indeed have the file:

normalizePath("~/.Rprofile")

then there is one last annoyance in R that you might have hit.   If you're last
line in that file does not have a newline, the the file will be
silently ignored by R when R start.  There won't be a warning - not
even a message.  That is true for all OSes.  It's a "feature" that
should really be fixed, because I keep seeing it tricking beginners
and advanced R users all the times.  The easiest way to check if this
is your problem, use readLines() to read in the content; readLines()
will give a warning if the last line doesn't have a new line, e.g.

> readLines(normalizePath("~/.Rprofile"))
[1] "options(prompt=\"R> \")" "set.seed(12345)"
Warning message:
In readLines(normalizePath("~/.Rprofile")) :
  incomplete final line found on 'C:\Users\hb\Documents\.Rprofile'

If you don't see the warning message, you should be fine.

Finally, an easy way to setup a ~/.Rprofile startup file is to do it
from within R, e.g.

> cat('options(prompt="R> ")\n', file = "~/.Rprofile")
> cat('set.seed(12345)\n', file = "~/.Rprofile", append = TRUE)

The '\n' at the end of each string represents a newline character, so
make sure you don't forget those.

Hope this help

Henrik



On Sat, Apr 15, 2017 at 1:10 PM, David Winsemius  wrote:
>
>> On Apr 15, 2017, at 12:46 PM, Boris Steipe  wrote:
>>
>> As with R, do with RStudio: Read The Beautiful Manual, and peruse The 
>> Google. For example, searching Google with the two (admittedly hard to 
>> guess) cryptograms:
>>  "RStudio Rprofile"
>>
>> will present more than a dozen most enlightening links to fulfil your desire.
>>
>> Perhaps the following link works better for you though:
>>  https://www.bing.com/search?q=rstudio+rprofile
>
> Another promising search strategy would be SO with "[rstudio]" in the tags:
>
> http://stackoverflow.com/search?q=%5Brstudio%5D+rprofile+windows
>
> --
> david.
>>
>> B.
>>
>>
>>> On Apr 15, 2017, at 3:14 PM, BR_email  wrote:
>>>
>>> Bill:
>>> Thanks for reply.
>>> Sorry, I do not understand it.
>>> For example, where do I put "file.path(getwd(), ".Rprofile")" ?
>>>
>>> Bruce
>>>
>>>
>>> William Dunlap wrote:
 I think the site-specific R profile should be, using R syntax
   file.path(R.home("etc"), "Rprofile.site") # no dot before the capital R
 The personal R profile will be
   file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot before 
 capital R
 but if a local R profile,
   file.path(getwd(), ".Rprofile") # there is a dot before capital R
 exists it will be used and the one in HOME will not be.  (getwd() should
 be the startup directory.)


 Bill Dunlap
 TIBCO Software
 wdunlap tibco.com


 On Sat, Apr 15, 2017 at 9:06 AM, BR_email  wrote:

[R] output of filled.contour

2017-04-15 Thread 宓辰羲
Dear all:

 I used the argument of filled.contour for drawing. I just wonder how to 
shorten 
the spacing between the key and the picture?


Attached below is the output. Thanks very much for the kind help!


Best Cheers
  Chenxi  
__
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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread David Winsemius

> On Apr 15, 2017, at 12:46 PM, Boris Steipe  wrote:
> 
> As with R, do with RStudio: Read The Beautiful Manual, and peruse The Google. 
> For example, searching Google with the two (admittedly hard to guess) 
> cryptograms:
>  "RStudio Rprofile"
> 
> will present more than a dozen most enlightening links to fulfil your desire.
> 
> Perhaps the following link works better for you though:
>  https://www.bing.com/search?q=rstudio+rprofile

Another promising search strategy would be SO with "[rstudio]" in the tags:

http://stackoverflow.com/search?q=%5Brstudio%5D+rprofile+windows

-- 
david.
> 
> B.
> 
> 
>> On Apr 15, 2017, at 3:14 PM, BR_email  wrote:
>> 
>> Bill:
>> Thanks for reply.
>> Sorry, I do not understand it.
>> For example, where do I put "file.path(getwd(), ".Rprofile")" ?
>> 
>> Bruce
>> 
>> 
>> William Dunlap wrote:
>>> I think the site-specific R profile should be, using R syntax
>>>   file.path(R.home("etc"), "Rprofile.site") # no dot before the capital R
>>> The personal R profile will be
>>>   file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot before 
>>> capital R
>>> but if a local R profile,
>>>   file.path(getwd(), ".Rprofile") # there is a dot before capital R
>>> exists it will be used and the one in HOME will not be.  (getwd() should
>>> be the startup directory.)
>>> 
>>> 
>>> Bill Dunlap
>>> TIBCO Software
>>> wdunlap tibco.com
>>> 
>>> 
>>> On Sat, Apr 15, 2017 at 9:06 AM, BR_email  wrote:
 Hi R-helpers:
 Can you offer assistance in my getting .Rprofile and .Rprofile.site to run
 in RStudio?
 When I start RStudio nothing happens.
 I have put .Rprofile in [1] and [2], and .Rprofile.site in [2].
 
 Below, the info I believe you need to know.
 Thanks, in advance, for any help.
 Bruce
 
 The .Rprofile and .Rprofile.site are R-type files, which contain the two
 lines below.
 Also, I tried the profile files as text files.
 options(prompt="R> ")
 set.seed(12345)
 
> Sys.getenv("HOME") [1] "C:/Users/BruceRatner/Documents"
> Sys.getenv("R_HOME") [2] "C:/PROGRA~1/R/R-33~1.3"
 
 
 --
 
 __
 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.

David Winsemius
Alameda, CA, USA

__
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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread Jeff Newmiller
You type each expression interactively at the R console and look at the path it 
prints. Then you know where to look, or if no file exists there then you know 
where to put the file you want to be there. 
-- 
Sent from my phone. Please excuse my brevity.

On April 15, 2017 12:14:32 PM PDT, BR_email  wrote:
>Bill:
>Thanks for reply.
>Sorry, I do not understand it.
>For example, where do I put "file.path(getwd(), ".Rprofile")" ?
>
>Bruce
>
>  
>
>William Dunlap wrote:
>> I think the site-specific R profile should be, using R syntax
>> file.path(R.home("etc"), "Rprofile.site") # no dot before the
>capital R
>> The personal R profile will be
>> file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot
>before capital R
>> but if a local R profile,
>> file.path(getwd(), ".Rprofile") # there is a dot before capital R
>> exists it will be used and the one in HOME will not be.  (getwd()
>should
>> be the startup directory.)
>>
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>>
>> On Sat, Apr 15, 2017 at 9:06 AM, BR_email  wrote:
>>> Hi R-helpers:
>>> Can you offer assistance in my getting .Rprofile and .Rprofile.site
>to run
>>> in RStudio?
>>> When I start RStudio nothing happens.
>>> I have put .Rprofile in [1] and [2], and .Rprofile.site in [2].
>>>
>>> Below, the info I believe you need to know.
>>> Thanks, in advance, for any help.
>>> Bruce
>>>
>>> The .Rprofile and .Rprofile.site are R-type files, which contain the
>two
>>> lines below.
>>> Also, I tried the profile files as text files.
>>> options(prompt="R> ")
>>> set.seed(12345)
>>>
 Sys.getenv("HOME") [1] "C:/Users/BruceRatner/Documents"
 Sys.getenv("R_HOME") [2] "C:/PROGRA~1/R/R-33~1.3"
>>>
>>>
>>> --
>>>
>>> __
>>> 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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread BR_email

Boris:
As before, you assume that I, Bruce Ratner, just asks questions without 
first trying it myself.
FYI: I purchased and read four RStudio books, as well as all the links I 
found in the web.

I will not take your maligning me.
Please try to assist me, but do not bully me.
Bruce Ratner, Ph.D.

 


Boris Steipe wrote:

As with R, do with RStudio: Read The Beautiful Manual, and peruse The Google. 
For example, searching Google with the two (admittedly hard to guess) 
cryptograms:
   "RStudio Rprofile"

will present more than a dozen most enlightening links to fulfil your desire.

Perhaps the following link works better for you though:
   https://www.bing.com/search?q=rstudio+rprofile

B.



On Apr 15, 2017, at 3:14 PM, BR_email  wrote:

Bill:
Thanks for reply.
Sorry, I do not understand it.
For example, where do I put "file.path(getwd(), ".Rprofile")" ?

Bruce


William Dunlap wrote:

I think the site-specific R profile should be, using R syntax
file.path(R.home("etc"), "Rprofile.site") # no dot before the capital R
The personal R profile will be
file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot before capital R
but if a local R profile,
file.path(getwd(), ".Rprofile") # there is a dot before capital R
exists it will be used and the one in HOME will not be.  (getwd() should
be the startup directory.)


Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Sat, Apr 15, 2017 at 9:06 AM, BR_email  wrote:

Hi R-helpers:
Can you offer assistance in my getting .Rprofile and .Rprofile.site to run
in RStudio?
When I start RStudio nothing happens.
I have put .Rprofile in [1] and [2], and .Rprofile.site in [2].

Below, the info I believe you need to know.
Thanks, in advance, for any help.
Bruce

The .Rprofile and .Rprofile.site are R-type files, which contain the two
lines below.
Also, I tried the profile files as text files.
options(prompt="R> ")
set.seed(12345)


Sys.getenv("HOME") [1] "C:/Users/BruceRatner/Documents"
Sys.getenv("R_HOME") [2] "C:/PROGRA~1/R/R-33~1.3"


--

__
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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread BR_email

David:
Thank you.
Bruce

Bruce Ratner, Ph.D.
The Significant Statistician™
(516) 791-3544
Statistical Predictive Analtyics -- www.DMSTAT1.com
Machine-Learning Data Mining and Modeling -- www.GenIQ.net
 


David Winsemius wrote:

On Apr 15, 2017, at 12:14 PM, BR_email  wrote:

Bill:
Thanks for reply.
Sorry, I do not understand it.
For example, where do I put "file.path(getwd(), ".Rprofile")" ?

This is not the correct venue for questions about RStudio setup. Instead this 
questions should go to:

https://support.rstudio.com/hc/en-us



__
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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread Boris Steipe
As with R, do with RStudio: Read The Beautiful Manual, and peruse The Google. 
For example, searching Google with the two (admittedly hard to guess) 
cryptograms:
  "RStudio Rprofile"

will present more than a dozen most enlightening links to fulfil your desire.

Perhaps the following link works better for you though:
  https://www.bing.com/search?q=rstudio+rprofile

B.


> On Apr 15, 2017, at 3:14 PM, BR_email  wrote:
> 
> Bill:
> Thanks for reply.
> Sorry, I do not understand it.
> For example, where do I put "file.path(getwd(), ".Rprofile")" ?
> 
> Bruce
> 
> 
> William Dunlap wrote:
>> I think the site-specific R profile should be, using R syntax
>>file.path(R.home("etc"), "Rprofile.site") # no dot before the capital R
>> The personal R profile will be
>>file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot before 
>> capital R
>> but if a local R profile,
>>file.path(getwd(), ".Rprofile") # there is a dot before capital R
>> exists it will be used and the one in HOME will not be.  (getwd() should
>> be the startup directory.)
>> 
>> 
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>> 
>> 
>> On Sat, Apr 15, 2017 at 9:06 AM, BR_email  wrote:
>>> Hi R-helpers:
>>> Can you offer assistance in my getting .Rprofile and .Rprofile.site to run
>>> in RStudio?
>>> When I start RStudio nothing happens.
>>> I have put .Rprofile in [1] and [2], and .Rprofile.site in [2].
>>> 
>>> Below, the info I believe you need to know.
>>> Thanks, in advance, for any help.
>>> Bruce
>>> 
>>> The .Rprofile and .Rprofile.site are R-type files, which contain the two
>>> lines below.
>>> Also, I tried the profile files as text files.
>>> options(prompt="R> ")
>>> set.seed(12345)
>>> 
 Sys.getenv("HOME") [1] "C:/Users/BruceRatner/Documents"
 Sys.getenv("R_HOME") [2] "C:/PROGRA~1/R/R-33~1.3"
>>> 
>>> 
>>> --
>>> 
>>> __
>>> 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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread David Winsemius

> On Apr 15, 2017, at 12:14 PM, BR_email  wrote:
> 
> Bill:
> Thanks for reply.
> Sorry, I do not understand it.
> For example, where do I put "file.path(getwd(), ".Rprofile")" ?

This is not the correct venue for questions about RStudio setup. Instead this 
questions should go to:

https://support.rstudio.com/hc/en-us

-- 
David.

> 
> Bruce
> 
> 
> William Dunlap wrote:
>> I think the site-specific R profile should be, using R syntax
>>file.path(R.home("etc"), "Rprofile.site") # no dot before the capital R
>> The personal R profile will be
>>file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot before 
>> capital R
>> but if a local R profile,
>>file.path(getwd(), ".Rprofile") # there is a dot before capital R
>> exists it will be used and the one in HOME will not be.  (getwd() should
>> be the startup directory.)
>> 
>> 
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>> 
>> 
>> On Sat, Apr 15, 2017 at 9:06 AM, BR_email  wrote:
>>> Hi R-helpers:
>>> Can you offer assistance in my getting .Rprofile and .Rprofile.site to run
>>> in RStudio?
>>> When I start RStudio nothing happens.
>>> I have put .Rprofile in [1] and [2], and .Rprofile.site in [2].
>>> 
>>> Below, the info I believe you need to know.
>>> Thanks, in advance, for any help.
>>> Bruce
>>> 
>>> The .Rprofile and .Rprofile.site are R-type files, which contain the two
>>> lines below.
>>> Also, I tried the profile files as text files.
>>> options(prompt="R> ")
>>> set.seed(12345)
>>> 
 Sys.getenv("HOME") [1] "C:/Users/BruceRatner/Documents"
 Sys.getenv("R_HOME") [2] "C:/PROGRA~1/R/R-33~1.3"
>>> 
>>> 
>>> --
>>> 
>>> __
>>> 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.

David Winsemius
Alameda, CA, USA

__
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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread BR_email

Bill:
Thanks for reply.
Sorry, I do not understand it.
For example, where do I put "file.path(getwd(), ".Rprofile")" ?

Bruce

 


William Dunlap wrote:

I think the site-specific R profile should be, using R syntax
file.path(R.home("etc"), "Rprofile.site") # no dot before the capital R
The personal R profile will be
file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot before capital R
but if a local R profile,
file.path(getwd(), ".Rprofile") # there is a dot before capital R
exists it will be used and the one in HOME will not be.  (getwd() should
be the startup directory.)


Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Sat, Apr 15, 2017 at 9:06 AM, BR_email  wrote:

Hi R-helpers:
Can you offer assistance in my getting .Rprofile and .Rprofile.site to run
in RStudio?
When I start RStudio nothing happens.
I have put .Rprofile in [1] and [2], and .Rprofile.site in [2].

Below, the info I believe you need to know.
Thanks, in advance, for any help.
Bruce

The .Rprofile and .Rprofile.site are R-type files, which contain the two
lines below.
Also, I tried the profile files as text files.
options(prompt="R> ")
set.seed(12345)


Sys.getenv("HOME") [1] "C:/Users/BruceRatner/Documents"
Sys.getenv("R_HOME") [2] "C:/PROGRA~1/R/R-33~1.3"



--

__
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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread William Dunlap via R-help
I think the site-specific R profile should be, using R syntax
   file.path(R.home("etc"), "Rprofile.site") # no dot before the capital R
The personal R profile will be
   file.path(Sys.getenv("HOME"), ".Rprofile") # there is a dot before capital R
but if a local R profile,
   file.path(getwd(), ".Rprofile") # there is a dot before capital R
exists it will be used and the one in HOME will not be.  (getwd() should
be the startup directory.)


Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Sat, Apr 15, 2017 at 9:06 AM, BR_email  wrote:
> Hi R-helpers:
> Can you offer assistance in my getting .Rprofile and .Rprofile.site to run
> in RStudio?
> When I start RStudio nothing happens.
> I have put .Rprofile in [1] and [2], and .Rprofile.site in [2].
>
> Below, the info I believe you need to know.
> Thanks, in advance, for any help.
> Bruce
>
> The .Rprofile and .Rprofile.site are R-type files, which contain the two
> lines below.
> Also, I tried the profile files as text files.
> options(prompt="R> ")
> set.seed(12345)
>
>> Sys.getenv("HOME") [1] "C:/Users/BruceRatner/Documents"
>> Sys.getenv("R_HOME") [2] "C:/PROGRA~1/R/R-33~1.3"
>
>
>
> --
>
> __
> 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] Setting .Rprofile for RStudio on a Windows 7 x64bit

2017-04-15 Thread BR_email

Hi R-helpers:
Can you offer assistance in my getting .Rprofile and .Rprofile.site to 
run in RStudio?

When I start RStudio nothing happens.
I have put .Rprofile in [1] and [2], and .Rprofile.site in [2].

Below, the info I believe you need to know.
Thanks, in advance, for any help.
Bruce

The .Rprofile and .Rprofile.site are R-type files, which contain the two 
lines below.

Also, I tried the profile files as text files.
options(prompt="R> ")
set.seed(12345)


Sys.getenv("HOME") [1] "C:/Users/BruceRatner/Documents"
Sys.getenv("R_HOME") [2] "C:/PROGRA~1/R/R-33~1.3"



--

__
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] Can this be done in ggplot?

2017-04-15 Thread Axel Urbiz
Thanks Kenneth. That is the right idea for what I’m after. However,
creating a combined factor based on “g” and “f” is creating unwanted spaces
between the bars in the plot (I’d like to keep them adjacent within levels
of “g” as shown in my first plot).

I had the idea that ordering bars in ggplot with respect to a variable
within factor levels would be easier, but looks it is not.

Thanks again,
Axe.



On Apr 14, 2017, at 10:40 PM, Kenneth Roy Cabrera Torres <
krcab...@une.net.co> wrote:

A very dirty solution.

I hope someone can give a better solution:

library(ggplot2)
set.seed(1)
df <- expand.grid(g = factor(1:4), f = factor(c("a", "b", "c")))
df <- df[-1, ] # some factors are not present in certain groups
df$v <- runif(nrow(df))

library(dplyr)

df <- df %>% arrange(g, desc(v))
df$nv <- with(df, factor(paste(g,f)))
df$nv <- factor(df$nv, levels = df$nv)

ggplot(df, aes(x = nv , y = v, fill = f)) +
  geom_bar(position="dodge", stat = "identity")


El 14/04/17 a las 10:08, Axel Urbiz escribi�:


Hi,

I need to bars to display in order based on the values of "v" within each
group "g". Is this possible?

library(ggplot2)
set.seed(1)
df <- expand.grid(g = 1:4, f = factor(c("a", "b", "c")))
df <- df[-1, ] # some factors are not present in certain groups
df$v <- runif(nrow(df))

ggplot(df, aes(x = g, y = v, fill = f)) +
  geom_bar(position="dodge", stat = "identity")

Thanks,
Axel.

[[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] Non date value

2017-04-15 Thread Ashta
Jeff,

I am sorry for that.


On Sat, Apr 15, 2017 at 12:04 AM, Jeff Newmiller
 wrote:
> You don't follow instructions very well. Read the Posting Guide more 
> carefully.
> --
> Sent from my phone. Please excuse my brevity.
>
> On April 14, 2017 9:39:30 PM PDT, Ashta  wrote:
>>DF1 is a data frame.   I am suspecting there might be non date value
>>in that column. My question is how to  remove  a non date values  from
>> that field.
>>example if Alex152 has  12253,. This value is not a date format.
>>
>>
>>On Fri, Apr 14, 2017 at 11:24 PM, Bert Gunter 
>>wrote:
>>> Show us str(DF1) . It is not a data frame.
>>>
>>> -- Bert
>>>
>>>
>>>
>>>
>>> On Fri, Apr 14, 2017 at 9:02 PM, Ashta  wrote:
 Hi all,
 I am reading  a field data that contains several variables. The
>>sample
 of the data with the first two variables is shown below.  I wanted
>>to
 know the minimum  and maximum recording date   However, I have some
 problem.


 Name  Rdate V1 to  V20
 Alex101/03/2015
 Alex201/03/2014
 Alex331/12/2012
 Alex415/01/2011
 Alex150  22/01/2010
 Alex151  15/02/2011



 DF1=DF1[!is.na(DF1$Rdate),]
 range(DF1$Rdate, na.rm=TRUE)

 Warning message:
 In is.na(DF1$Rdate) :
   is.na() applied to non-(list or vector) of type 'NULL'
 Error in DF1$Rdate : $ operator is invalid for atomic vectors
 Execution halted

 I am expecting the Rdate field should contain  recording dates. I
>>am
 suspecting there might be a non date  value in that columns. How do
>>I
 remove that row if it is not a date format?


 Thank you.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
>>
>>__
>>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] Can this be done in ggplot?

2017-04-15 Thread Axel Urbiz
Thanks Kenneth. That is the right idea for what I’m after. However, creating a 
combined factor based on “g” and “f” is creating unwanted spaces between the 
bars in the plot (I’d like to keep them adjacent within levels of “g” as shown 
in my first plot). 

I had the idea that ordering bars in ggplot with respect to a variable within 
factor levels would be easier, but looks it is not.

Thanks again,
Axe. 



> On Apr 14, 2017, at 10:40 PM, Kenneth Roy Cabrera Torres 
>  wrote:
> 
> A very dirty solution.
> 
> I hope someone can give a better solution:
> 
> library(ggplot2)
> set.seed(1)
> df <- expand.grid(g = factor(1:4), f = factor(c("a", "b", "c")))
> df <- df[-1, ] # some factors are not present in certain groups
> df$v <- runif(nrow(df))
> 
> library(dplyr)
> 
> df <- df %>% arrange(g, desc(v))
> df$nv <- with(df, factor(paste(g,f)))
> df$nv <- factor(df$nv, levels = df$nv)
> 
> ggplot(df, aes(x = nv , y = v, fill = f)) +
>   geom_bar(position="dodge", stat = "identity")
> 
> 
> El 14/04/17 a las 10:08, Axel Urbiz escribi�:
>> Hi,
>> 
>> I need to bars to display in order based on the values of "v" within each
>> group "g". Is this possible?
>> 
>> library(ggplot2)
>> set.seed(1)
>> df <- expand.grid(g = 1:4, f = factor(c("a", "b", "c")))
>> df <- df[-1, ] # some factors are not present in certain groups
>> df$v <- runif(nrow(df))
>> 
>> ggplot(df, aes(x = g, y = v, fill = f)) +
>>   geom_bar(position="dodge", stat = "identity")
>> 
>> Thanks,
>> Axel.
>> 
>>  [[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.

__
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] seq argument along.with

2017-04-15 Thread Rui Barradas

Hello,

A good example of a use case of seq_along is to avoid constructs such as 
1:length(x) that don't make sense and are a source for bugs whenever x 
is of length zero. See for instance loops where careless coders do


for(i in 1:length(x)){
x[i] <- some computation
}

If x is of length zero the loop above will execute 2 times but the 
second time through it will throw an error because it will refer to 
x[0], which is illegal.

To avoid this, use

for(i in seq_along(x)){
[...]
}

With a zero-length x, the loop will execute zero times, the intended 
behaviour.
If it's the first time you've came across this function, I can guarantee 
you that it is really, really usefull.


Hope this helps,

Rui Barradas

Em 15-04-2017 00:58, Carl Sutton via R-help escreveu:

Hi Jeff
I have seen the seq_along function but never knew the what or why of it.  Your 
response is much appreciated and just shows how brilliant the creators of R 
were/are.
Thank you for enlightening me. Carl Sutton

 On Friday, April 14, 2017 3:54 PM, Jeff Newmiller 
 wrote:


  Have you ever used the seq_along() function?

If you want to delegate the decision of how many elements you want to process 
to some earlier point in your (or someone else's) code, then the most logical 
way to create a result vector that is the same size as some input vector, even 
if that vector is of zero length, is to show that vector to the seq function as 
an example of how long to make the result.



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