[R] R function stopped working

2017-04-04 Thread DANIEL PRECIADO
The following function is supposed to search the workspace and save
plots  (i.e. listing all objects in the workspace named "Figs", which
are all ggplot2 plots, and saving them as png files)

SaveFigs <- function()
{
for (i in ls(pattern="_Figs_"))
{
filename = paste(Plots_Path, i, ".png", sep="")
png(filename)
print(eval(as.name(i)))
dev.off()
}
}


It was working perfectly until some days ago, but now nothing happens
when the function is called. No error, no output, no result, no files,
nothing at all. Completely useless.

If I run the for loop inside alone, without the function, it works
perfectly and produces the expected result (png files in the defined
folder). But running it as a function doesn't do anything at all.

Can anyone explain why did this function simply and suddenly stopped
working?

(using R version 3.3.3 on an ubuntu 16.10, if that is of any help)
__
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 function stopped working

2017-04-04 Thread peter dalgaard
How about inserting print() statements on the output of "ls()" and the value of 
"filename". In particular, is the value of Plots_path the same as last week?

-pd


> On 4 Apr 2017, at 10:50 , DANIEL PRECIADO  wrote:
> 
> The following function is supposed to search the workspace and save
> plots  (i.e. listing all objects in the workspace named "Figs", which
> are all ggplot2 plots, and saving them as png files)
> 
> SaveFigs <- function()
> {
>   for (i in ls(pattern="_Figs_"))
>   {
>   filename = paste(Plots_Path, i, ".png", sep="")
>   png(filename)
>   print(eval(as.name(i)))
>   dev.off()
>   }
> }
> 
> 
> It was working perfectly until some days ago, but now nothing happens
> when the function is called. No error, no output, no result, no files,
> nothing at all. Completely useless.
> 
> If I run the for loop inside alone, without the function, it works
> perfectly and produces the expected result (png files in the defined
> folder). But running it as a function doesn't do anything at all.
> 
> Can anyone explain why did this function simply and suddenly stopped
> working?
> 
> (using R version 3.3.3 on an ubuntu 16.10, if that is of any help)
> __
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


Re: [R] R function stopped working

2017-04-04 Thread DANIEL PRECIADO
Thanks, but printing doesn't work within the function either. (i.e, no
result or output, or error). Also, like I said, the loop is working
fine on its own (so the path, name, filename, and all other variables
called from the function exist, are available and are recognized just
fine). It just doesn't do anything (anymore) if the loop is inside a
function.


On Tue, 2017-04-04 at 11:21 +0200, peter dalgaard wrote:
> How about inserting print() statements on the output of "ls()" and
> the value of "filename". In particular, is the value of Plots_path
> the same as last week?
> 
> -pd
> 
> 
> > On 4 Apr 2017, at 10:50 , DANIEL PRECIADO 
> > wrote:
> > 
> > The following function is supposed to search the workspace and save
> > plots  (i.e. listing all objects in the workspace named "Figs",
> > which
> > are all ggplot2 plots, and saving them as png files)
> > 
> > SaveFigs <- function()
> > {
> > for (i in ls(pattern="_Figs_"))
> > {
> > filename = paste(Plots_Path, i, ".png", sep="")
> > png(filename)
> > print(eval(as.name(i)))
> > dev.off()
> > }
> > }
> > 
> > 
> > It was working perfectly until some days ago, but now nothing
> > happens
> > when the function is called. No error, no output, no result, no
> > files,
> > nothing at all. Completely useless.
> > 
> > If I run the for loop inside alone, without the function, it works
> > perfectly and produces the expected result (png files in the
> > defined
> > folder). But running it as a function doesn't do anything at all.
> > 
> > Can anyone explain why did this function simply and suddenly
> > stopped
> > working?
> > 
> > (using R version 3.3.3 on an ubuntu 16.10, if that is of any help)
> > __
> > 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-g
> > uide.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] R function stopped working

2017-04-04 Thread peter dalgaard
Given the following little experiment

> foobar <- 1
> f <- function() ls()
> f()
character(0)
> f <- function(x) ls()
> f(2)
[1] "x"
> 

... I am pretty sure that your code _never_ actually worked. 

It probably helps if you tell ls() which environment to list, as in:

> f <- function() ls(.GlobalEnv)
> f()
[1] "f"  "foobar"


> On 4 Apr 2017, at 12:27 , DANIEL PRECIADO  wrote:
> 
> Thanks, but printing doesn't work within the function either. (i.e, no
> result or output, or error). Also, like I said, the loop is working
> fine on its own (so the path, name, filename, and all other variables
> called from the function exist, are available and are recognized just
> fine). It just doesn't do anything (anymore) if the loop is inside a
> function.
> 
> 
> On Tue, 2017-04-04 at 11:21 +0200, peter dalgaard wrote:
>> How about inserting print() statements on the output of "ls()" and
>> the value of "filename". In particular, is the value of Plots_path
>> the same as last week?
>> 
>> -pd
>> 
>> 
>>> On 4 Apr 2017, at 10:50 , DANIEL PRECIADO 
>>> wrote:
>>> 
>>> The following function is supposed to search the workspace and save
>>> plots  (i.e. listing all objects in the workspace named "Figs",
>>> which
>>> are all ggplot2 plots, and saving them as png files)
>>> 
>>> SaveFigs <- function()
>>> {
>>> for (i in ls(pattern="_Figs_"))
>>> {
>>> filename = paste(Plots_Path, i, ".png", sep="")
>>> png(filename)
>>> print(eval(as.name(i)))
>>> dev.off()
>>> }
>>> }
>>> 
>>> 
>>> It was working perfectly until some days ago, but now nothing
>>> happens
>>> when the function is called. No error, no output, no result, no
>>> files,
>>> nothing at all. Completely useless.
>>> 
>>> If I run the for loop inside alone, without the function, it works
>>> perfectly and produces the expected result (png files in the
>>> defined
>>> folder). But running it as a function doesn't do anything at all.
>>> 
>>> Can anyone explain why did this function simply and suddenly
>>> stopped
>>> working?
>>> 
>>> (using R version 3.3.3 on an ubuntu 16.10, if that is of any help)
>>> __
>>> 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-g
>>> uide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

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


[R] Converting date vector into a serial date number

2017-04-04 Thread Tunga Kantarcı
I have a data frame. One column (call this column a) contains years,
like 1871, and another column (call this column b) contains months,
like 2. I need to convert these year-month combinations, stored in
these two date vectors, into a single serial date number. E.g. year
1871 and month 2, stored in different vectors, should return 683429.
Meanwhile, when I check the class type of columns a and b, they are
both integer.

In MATLAB this can easily be done using the syntax

output = datenum(a,b,1)

In R, I have tried the as.POSIXct function but did not succeed. I also
tried the ISOdatetime function but that returned NA for all entries.
It should be a simple operation but I cannot seem to figure it out.

__
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 function stopped working

2017-04-04 Thread DANIEL PRECIADO
To your first comment: Yes, the function used to work, and the loop inside it 
still does (as indicated in my first email). I wouldn't bother asking otherwise.
To your second, no, specifying the environment in the ls() call doesn't help, 
the problem persist.


On Tue, 2017-04-04 at 15:26 +0200, peter dalgaard wrote:

Given the following little experiment



foobar <- 1
f <- function() ls()
f()


character(0)


f <- function(x) ls()
f(2)


[1] "x"






... I am pretty sure that your code _never_ actually worked.

It probably helps if you tell ls() which environment to list, as in:



f <- function() ls(.GlobalEnv)
f()


[1] "f"  "foobar"




On 4 Apr 2017, at 12:27 , DANIEL PRECIADO 
mailto:danp...@hotmail.com>> wrote:

Thanks, but printing doesn't work within the function either. (i.e, no
result or output, or error). Also, like I said, the loop is working
fine on its own (so the path, name, filename, and all other variables
called from the function exist, are available and are recognized just
fine). It just doesn't do anything (anymore) if the loop is inside a
function.


On Tue, 2017-04-04 at 11:21 +0200, peter dalgaard wrote:


How about inserting print() statements on the output of "ls()" and
the value of "filename". In particular, is the value of Plots_path
the same as last week?

-pd




On 4 Apr 2017, at 10:50 , DANIEL PRECIADO 
mailto:danp...@hotmail.com>>
wrote:

The following function is supposed to search the workspace and save
plots  (i.e. listing all objects in the workspace named "Figs",
which
are all ggplot2 plots, and saving them as png files)

SaveFigs <- function()
{
for (i in ls(pattern="_Figs_"))
{
filename = paste(Plots_Path, i, ".png", sep="")
png(filename)
print(eval(as.name(i)))
dev.off()
}
}


It was working perfectly until some days ago, but now nothing
happens
when the function is called. No error, no output, no result, no
files,
nothing at all. Completely useless.

If I run the for loop inside alone, without the function, it works
perfectly and produces the expected result (png files in the
defined
folder). But running it as a function doesn't do anything at all.

Can anyone explain why did this function simply and suddenly
stopped
working?

(using R version 3.3.3 on an ubuntu 16.10, if that is of any help)
__
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-g
uide.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 function stopped working

2017-04-04 Thread Boris Steipe
I discourage the use of print() for debugging.
Put a browser() statement into your loop and when execution takes you to the 
debugger interface, examine your variables and expressions one by one.


B.




> On Apr 4, 2017, at 10:09 AM, DANIEL PRECIADO  wrote:
> 
> To your first comment: Yes, the function used to work, and the loop inside it 
> still does (as indicated in my first email). I wouldn't bother asking 
> otherwise.
> To your second, no, specifying the environment in the ls() call doesn't help, 
> the problem persist.
> 
> 
> On Tue, 2017-04-04 at 15:26 +0200, peter dalgaard wrote:
> 
> Given the following little experiment
> 
> 
> 
> foobar <- 1
> f <- function() ls()
> f()
> 
> 
> character(0)
> 
> 
> f <- function(x) ls()
> f(2)
> 
> 
> [1] "x"
> 
> 
> 
> 
> 
> 
> ... I am pretty sure that your code _never_ actually worked.
> 
> It probably helps if you tell ls() which environment to list, as in:
> 
> 
> 
> f <- function() ls(.GlobalEnv)
> f()
> 
> 
> [1] "f"  "foobar"
> 
> 
> 
> 
> On 4 Apr 2017, at 12:27 , DANIEL PRECIADO 
> mailto:danp...@hotmail.com>> wrote:
> 
> Thanks, but printing doesn't work within the function either. (i.e, no
> result or output, or error). Also, like I said, the loop is working
> fine on its own (so the path, name, filename, and all other variables
> called from the function exist, are available and are recognized just
> fine). It just doesn't do anything (anymore) if the loop is inside a
> function.
> 
> 
> On Tue, 2017-04-04 at 11:21 +0200, peter dalgaard wrote:
> 
> 
> How about inserting print() statements on the output of "ls()" and
> the value of "filename". In particular, is the value of Plots_path
> the same as last week?
> 
> -pd
> 
> 
> 
> 
> On 4 Apr 2017, at 10:50 , DANIEL PRECIADO 
> mailto:danp...@hotmail.com>>
> wrote:
> 
> The following function is supposed to search the workspace and save
> plots  (i.e. listing all objects in the workspace named "Figs",
> which
> are all ggplot2 plots, and saving them as png files)
> 
> SaveFigs <- function()
> {
>for (i in ls(pattern="_Figs_"))
>{
>filename = paste(Plots_Path, i, ".png", sep="")
>png(filename)
>print(eval(as.name(i)))
>dev.off()
>}
> }
> 
> 
> It was working perfectly until some days ago, but now nothing
> happens
> when the function is called. No error, no output, no result, no
> files,
> nothing at all. Completely useless.
> 
> If I run the for loop inside alone, without the function, it works
> perfectly and produces the expected result (png files in the
> defined
> folder). But running it as a function doesn't do anything at all.
> 
> Can anyone explain why did this function simply and suddenly
> stopped
> working?
> 
> (using R version 3.3.3 on an ubuntu 16.10, if that is of any help)
> __
> 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-g
> uide.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] R function stopped working

2017-04-04 Thread S Ellison
Maybe a daft question arising from lack of reproducible example, but have you 
run ls() manually to make sure there are objects that _exactly_ match "_Figs_" ?
The simplest explanation for a loop doing nothing is that there are no cases.

S Ellison

> The following function is supposed to search the workspace and save plots
> (i.e. listing all objects in the workspace named "Figs", which are all ggplot2
> plots, and saving them as png files)
> 
> SaveFigs <- function()
> {
> for (i in ls(pattern="_Figs_"))
> {
> filename = paste(Plots_Path, i, ".png", sep="")
> png(filename)
> print(eval(as.name(i)))
> dev.off()
> }
> }
> 
> 


***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Converting date vector into a serial date number

2017-04-04 Thread Marc Schwartz

> On Apr 4, 2017, at 8:51 AM, Tunga Kantarcı  wrote:
> 
> I have a data frame. One column (call this column a) contains years,
> like 1871, and another column (call this column b) contains months,
> like 2. I need to convert these year-month combinations, stored in
> these two date vectors, into a single serial date number. E.g. year
> 1871 and month 2, stored in different vectors, should return 683429.
> Meanwhile, when I check the class type of columns a and b, they are
> both integer.
> 
> In MATLAB this can easily be done using the syntax
> 
> output = datenum(a,b,1)
> 
> In R, I have tried the as.POSIXct function but did not succeed. I also
> tried the ISOdatetime function but that returned NA for all entries.
> It should be a simple operation but I cannot seem to figure it out.

Hi,

The standard date classes in R require the full date (day, month, year) and the 
date/time classes require a correct time as well.

Looking at the help page for ?as.Date, there is information pertaining to 
MATLAB's date origin of -01-01, as compared to R's of 1970-01-01. The 
difference is an offset of 719529.

Taking your number above of 683429, that would yield:

 > as.Date(683429, origin = "1970-01-01") - 719529
[1] "1871-03-01"

So your 'b' should be 3, not 2, presuming the first of the month is inferred. 
Otherwise:

> as.Date(683401, origin = "1970-01-01") - 719529
[1] "1871-02-01"

So, to reverse it, would be:

a <- 1871
b <- 3

> paste(a, b, 1, sep = "-")
[1] "1871-3-1"

> as.Date(paste(a, b, 1, sep = "-"))
[1] "1871-03-01"

> as.numeric(as.Date(paste(a, b, 1, sep = "-"))) + 719529
[1] 683429
  
The last step takes the date and coerces it to a numeric value in the number of 
days since the origin.

More generally, if you Google for R MATLAB, there are some online references 
that provide varying levels of function mappings between the two languages that 
you may find helpful.

Regards,

Marc Schwartz

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

Re: [R] Converting date vector into a serial date number

2017-04-04 Thread Bert Gunter
?strptime  and ?paste (to combine your 2 date vector pieces)

Cheers,

Bert
Bert Gunter

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


On Tue, Apr 4, 2017 at 6:51 AM, Tunga Kantarcı  wrote:
> I have a data frame. One column (call this column a) contains years,
> like 1871, and another column (call this column b) contains months,
> like 2. I need to convert these year-month combinations, stored in
> these two date vectors, into a single serial date number. E.g. year
> 1871 and month 2, stored in different vectors, should return 683429.
> Meanwhile, when I check the class type of columns a and b, they are
> both integer.
>
> In MATLAB this can easily be done using the syntax
>
> output = datenum(a,b,1)
>
> In R, I have tried the as.POSIXct function but did not succeed. I also
> tried the ISOdatetime function but that returned NA for all entries.
> It should be a simple operation but I cannot seem to figure it out.
>
> __
> 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] Converting date vector into a serial date number

2017-04-04 Thread Tunga Kantarcı
Marc, thank you for this excellent answer.

__
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] Converting date vector into a serial date number

2017-04-04 Thread Jeff Newmiller
I think it is important to point out that treating dates or times as serial 
numbers should only be done for importing or exporting data. Rather, once the 
conversion to one of the ?DateTimeClasses has occurred you are better off 
leaving it as such to reduce the brittleness of your code. For one thing, you 
should not be writing code that makes assumptions about the epoch (zero offset) 
everywhere in your code. 
-- 
Sent from my phone. Please excuse my brevity.

On April 4, 2017 8:00:25 AM PDT, Marc Schwartz  wrote:
>
>> On Apr 4, 2017, at 8:51 AM, Tunga Kantarcı 
>wrote:
>> 
>> I have a data frame. One column (call this column a) contains years,
>> like 1871, and another column (call this column b) contains months,
>> like 2. I need to convert these year-month combinations, stored in
>> these two date vectors, into a single serial date number. E.g. year
>> 1871 and month 2, stored in different vectors, should return 683429.
>> Meanwhile, when I check the class type of columns a and b, they are
>> both integer.
>> 
>> In MATLAB this can easily be done using the syntax
>> 
>> output = datenum(a,b,1)
>> 
>> In R, I have tried the as.POSIXct function but did not succeed. I
>also
>> tried the ISOdatetime function but that returned NA for all entries.
>> It should be a simple operation but I cannot seem to figure it out.
>
>Hi,
>
>The standard date classes in R require the full date (day, month, year)
>and the date/time classes require a correct time as well.
>
>Looking at the help page for ?as.Date, there is information pertaining
>to MATLAB's date origin of -01-01, as compared to R's of
>1970-01-01. The difference is an offset of 719529.
>
>Taking your number above of 683429, that would yield:
>
> > as.Date(683429, origin = "1970-01-01") - 719529
>[1] "1871-03-01"
>
>So your 'b' should be 3, not 2, presuming the first of the month is
>inferred. Otherwise:
>
>> as.Date(683401, origin = "1970-01-01") - 719529
>[1] "1871-02-01"
>
>So, to reverse it, would be:
>
>a <- 1871
>b <- 3
>
>> paste(a, b, 1, sep = "-")
>[1] "1871-3-1"
>
>> as.Date(paste(a, b, 1, sep = "-"))
>[1] "1871-03-01"
>
>> as.numeric(as.Date(paste(a, b, 1, sep = "-"))) + 719529
>[1] 683429
>  
>The last step takes the date and coerces it to a numeric value in the
>number of days since the origin.
>
>More generally, if you Google for R MATLAB, there are some online
>references that provide varying levels of function mappings between the
>two languages that you may find helpful.
>
>Regards,
>
>Marc Schwartz
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
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 function stopped working

2017-04-04 Thread DANIEL PRECIADO
Thanks! I was not aware of the browser() function, seems pretty useful for 
debugging.
However, for this particular case, adding it to the mentioned function doesn't 
do much: Again I get no errors, no output in the terminal and no files are 
created.

If I include browser() within the for-loop (not defining it as a function, but 
running it directly), I do get to examine every step of the way, and it runs 
fine (as expected). But if the exact same for-loop is sitting inside a 
function, it doesn't do anything at all, with or without browser().

D.

On Tue, 2017-04-04 at 10:19 -0400, Boris Steipe wrote:

I discourage the use of print() for debugging.
Put a browser() statement into your loop and when execution takes you to the 
debugger interface, examine your variables and expressions one by one.


B.






On Apr 4, 2017, at 10:09 AM, DANIEL PRECIADO 
mailto:danp...@hotmail.com>> wrote:

To your first comment: Yes, the function used to work, and the loop inside it 
still does (as indicated in my first email). I wouldn't bother asking otherwise.
To your second, no, specifying the environment in the ls() call doesn't help, 
the problem persist.


On Tue, 2017-04-04 at 15:26 +0200, peter dalgaard wrote:

Given the following little experiment



foobar <- 1
f <- function() ls()
f()


character(0)


f <- function(x) ls()
f(2)


[1] "x"






... I am pretty sure that your code _never_ actually worked.

It probably helps if you tell ls() which environment to list, as in:



f <- function() ls(.GlobalEnv)
f()


[1] "f"  "foobar"




On 4 Apr 2017, at 12:27 , DANIEL PRECIADO 
mailto:danp...@hotmail.com>> 
wrote:

Thanks, but printing doesn't work within the function either. (i.e, no
result or output, or error). Also, like I said, the loop is working
fine on its own (so the path, name, filename, and all other variables
called from the function exist, are available and are recognized just
fine). It just doesn't do anything (anymore) if the loop is inside a
function.


On Tue, 2017-04-04 at 11:21 +0200, peter dalgaard wrote:


How about inserting print() statements on the output of "ls()" and
the value of "filename". In particular, is the value of Plots_path
the same as last week?

-pd




On 4 Apr 2017, at 10:50 , DANIEL PRECIADO 
mailto:danp...@hotmail.com>>
wrote:

The following function is supposed to search the workspace and save
plots  (i.e. listing all objects in the workspace named "Figs",
which
are all ggplot2 plots, and saving them as png files)

SaveFigs <- function()
{
   for (i in ls(pattern="_Figs_"))
   {
   filename = paste(Plots_Path, i, ".png", sep="")
   png(filename)
   print(eval(as.name(i)))
   dev.off()
   }
}


It was working perfectly until some days ago, but now nothing
happens
when the function is called. No error, no output, no result, no
files,
nothing at all. Completely useless.

If I run the for loop inside alone, without the function, it works
perfectly and produces the expected result (png files in the
defined
folder). But running it as a function doesn't do anything at all.

Can anyone explain why did this function simply and suddenly
stopped
working?

(using R version 3.3.3 on an ubuntu 16.10, if that is of any help)
__
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-g
uide.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] R function stopped working

2017-04-04 Thread Jeff Newmiller
Daniel, if you wish to learn from your mistakes them you must listen. Peter is 
not someone whose input you should dismiss. The function you have showed us 
never worked as you have described it. However, if you give .GlobalEnv as the 
first argument in the call to ls() then it should work.

You will find it helpful to remember that "workspace" is not a precise 
description of how variables are stored in R... there are chains of 
"environments".  Invocation of a function creates a new environment that the ls 
function looks in by default, and ls does not follow the search path up to the 
global environment automatically. So, the code AS YOU PRESENTED IT could not 
have worked in spite of your assertions. Perhaps you had a fixed version 
somewhere that you lost? 
-- 
Sent from my phone. Please excuse my brevity.

On April 4, 2017 7:09:24 AM PDT, DANIEL PRECIADO  wrote:
>To your first comment: Yes, the function used to work, and the loop
>inside it still does (as indicated in my first email). I wouldn't
>bother asking otherwise.
>To your second, no, specifying the environment in the ls() call doesn't
>help, the problem persist.
>
>
>On Tue, 2017-04-04 at 15:26 +0200, peter dalgaard wrote:
>
>Given the following little experiment
>
>
>
>foobar <- 1
>f <- function() ls()
>f()
>
>
>character(0)
>
>
>f <- function(x) ls()
>f(2)
>
>
>[1] "x"
>
>
>
>
>
>
>... I am pretty sure that your code _never_ actually worked.
>
>It probably helps if you tell ls() which environment to list, as in:
>
>
>
>f <- function() ls(.GlobalEnv)
>f()
>
>
>[1] "f"  "foobar"
>
>
>
>
>On 4 Apr 2017, at 12:27 , DANIEL PRECIADO
>mailto:danp...@hotmail.com>> wrote:
>
>Thanks, but printing doesn't work within the function either. (i.e, no
>result or output, or error). Also, like I said, the loop is working
>fine on its own (so the path, name, filename, and all other variables
>called from the function exist, are available and are recognized just
>fine). It just doesn't do anything (anymore) if the loop is inside a
>function.
>
>
>On Tue, 2017-04-04 at 11:21 +0200, peter dalgaard wrote:
>
>
>How about inserting print() statements on the output of "ls()" and
>the value of "filename". In particular, is the value of Plots_path
>the same as last week?
>
>-pd
>
>
>
>
>On 4 Apr 2017, at 10:50 , DANIEL PRECIADO
>mailto:danp...@hotmail.com>>
>wrote:
>
>The following function is supposed to search the workspace and save
>plots  (i.e. listing all objects in the workspace named "Figs",
>which
>are all ggplot2 plots, and saving them as png files)
>
>SaveFigs <- function()
>{
>for (i in ls(pattern="_Figs_"))
>{
>filename = paste(Plots_Path, i, ".png", sep="")
>png(filename)
>print(eval(as.name(i)))
>dev.off()
>}
>}
>
>
>It was working perfectly until some days ago, but now nothing
>happens
>when the function is called. No error, no output, no result, no
>files,
>nothing at all. Completely useless.
>
>If I run the for loop inside alone, without the function, it works
>perfectly and produces the expected result (png files in the
>defined
>folder). But running it as a function doesn't do anything at all.
>
>Can anyone explain why did this function simply and suddenly
>stopped
>working?
>
>(using R version 3.3.3 on an ubuntu 16.10, if that is of any help)
>__
>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-g
>uide.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] system call removes special characters from text output

2017-04-04 Thread Boris Steipe
The "whatever information" would be the usual minimal reproducible example.

Since you think your code works at the shell level, make up an example with a 
system call to "echo".
Then state what you expect to happen and what happens instead.

B.



> On Apr 4, 2017, at 12:44 AM, stephen sefick  wrote:
> 
> Hi Jeff,
> 
> My apologies for not providing enough information. The perl code works as
> expected at the shell (without calling it from R). I have tried the system
> call inside of an ESS R session and at a the shell. Both of these produce
> the unexpected result. I can provide whatever information that is needed.
> kindest regards,
> 
> Stephen
> 
> On Mon, Apr 3, 2017 at 11:23 PM, Jeff Newmiller 
> wrote:
> 
>> Sorry, RPsychic package not found. Please install package reprex, apply it
>> to your problem and try again. Note that if this problem can only be
>> produced from within a package then there is an R-package-devel mailing
>> list that would be a more appropriate place to ask. Also, if the problem is
>> actually in the perl code or in the shell (this seems likely to me) then
>> you probably need to look even further afield for help.
>> --
>> Sent from my phone. Please excuse my brevity.
>> 
>> On April 3, 2017 8:57:07 PM PDT, stephen sefick  wrote:
>>> Hello,
>>> 
>>> I am writing an R package, and I am using system() to call a perl
>>> script.
>>> The output of the perl script is correct except for "[A/B]" is output
>>> as
>>> "AB". Can someone explain this behavior. I would like to try and fix
>>> this.
>>> many thanks,
>>> 
>>> Stephen Sefick
>> 
> 
> 
> 
> -- 
> Let's not spend our time and resources thinking about things that are so
> little or so large that all they really do for us is puff us up and make us
> feel like gods.  We are mammals, and have not exhausted the annoying little
> problems of being mammals.
> 
>-K. Mullis
> 
> "A big computer, a complex algorithm and a long time does not equal
> science."
> 
>  -Robert Gentleman
> 
>   [[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] system call removes special characters from text output

2017-04-04 Thread stephen sefick
Hello everyone,

Again, I apologize for not providing a reproducible example. There was a
small (but important) bug in my R code having nothing to do with system(),
this is now fixed, and everything is working as expected this morning. The
lesson for me is time to stop coding after 10 PM. Thank you for all of the
help.
kindest regards,

Stephen

On Tue, Apr 4, 2017 at 11:01 AM, Boris Steipe 
wrote:

> The "whatever information" would be the usual minimal reproducible example.
>
> Since you think your code works at the shell level, make up an example
> with a system call to "echo".
> Then state what you expect to happen and what happens instead.
>
> B.
>
>
>
> > On Apr 4, 2017, at 12:44 AM, stephen sefick  wrote:
> >
> > Hi Jeff,
> >
> > My apologies for not providing enough information. The perl code works as
> > expected at the shell (without calling it from R). I have tried the
> system
> > call inside of an ESS R session and at a the shell. Both of these produce
> > the unexpected result. I can provide whatever information that is needed.
> > kindest regards,
> >
> > Stephen
> >
> > On Mon, Apr 3, 2017 at 11:23 PM, Jeff Newmiller <
> jdnew...@dcn.davis.ca.us>
> > wrote:
> >
> >> Sorry, RPsychic package not found. Please install package reprex, apply
> it
> >> to your problem and try again. Note that if this problem can only be
> >> produced from within a package then there is an R-package-devel mailing
> >> list that would be a more appropriate place to ask. Also, if the
> problem is
> >> actually in the perl code or in the shell (this seems likely to me) then
> >> you probably need to look even further afield for help.
> >> --
> >> Sent from my phone. Please excuse my brevity.
> >>
> >> On April 3, 2017 8:57:07 PM PDT, stephen sefick 
> wrote:
> >>> Hello,
> >>>
> >>> I am writing an R package, and I am using system() to call a perl
> >>> script.
> >>> The output of the perl script is correct except for "[A/B]" is output
> >>> as
> >>> "AB". Can someone explain this behavior. I would like to try and fix
> >>> this.
> >>> many thanks,
> >>>
> >>> Stephen Sefick
> >>
> >
> >
> >
> > --
> > Let's not spend our time and resources thinking about things that are so
> > little or so large that all they really do for us is puff us up and make
> us
> > feel like gods.  We are mammals, and have not exhausted the annoying
> little
> > problems of being mammals.
> >
> >-K. Mullis
> >
> > "A big computer, a complex algorithm and a long time does not equal
> > science."
> >
> >  -Robert Gentleman
> >
> >   [[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.
>
>


-- 
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods.  We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

"A big computer, a complex algorithm and a long time does not equal
science."

  -Robert Gentleman

[[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] system call removes special characters from text output

2017-04-04 Thread Bert Gunter
... and perhaps worth noting (again) is that one of the benefits of
producing a repro ex is that it often reveals such bugs to the
prospective poster, thus obviating the need to post.

-- Bert



Bert Gunter

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


On Tue, Apr 4, 2017 at 9:28 AM, stephen sefick  wrote:
> Hello everyone,
>
> Again, I apologize for not providing a reproducible example. There was a
> small (but important) bug in my R code having nothing to do with system(),
> this is now fixed, and everything is working as expected this morning. The
> lesson for me is time to stop coding after 10 PM. Thank you for all of the
> help.
> kindest regards,
>
> Stephen
>
> On Tue, Apr 4, 2017 at 11:01 AM, Boris Steipe 
> wrote:
>
>> The "whatever information" would be the usual minimal reproducible example.
>>
>> Since you think your code works at the shell level, make up an example
>> with a system call to "echo".
>> Then state what you expect to happen and what happens instead.
>>
>> B.
>>
>>
>>
>> > On Apr 4, 2017, at 12:44 AM, stephen sefick  wrote:
>> >
>> > Hi Jeff,
>> >
>> > My apologies for not providing enough information. The perl code works as
>> > expected at the shell (without calling it from R). I have tried the
>> system
>> > call inside of an ESS R session and at a the shell. Both of these produce
>> > the unexpected result. I can provide whatever information that is needed.
>> > kindest regards,
>> >
>> > Stephen
>> >
>> > On Mon, Apr 3, 2017 at 11:23 PM, Jeff Newmiller <
>> jdnew...@dcn.davis.ca.us>
>> > wrote:
>> >
>> >> Sorry, RPsychic package not found. Please install package reprex, apply
>> it
>> >> to your problem and try again. Note that if this problem can only be
>> >> produced from within a package then there is an R-package-devel mailing
>> >> list that would be a more appropriate place to ask. Also, if the
>> problem is
>> >> actually in the perl code or in the shell (this seems likely to me) then
>> >> you probably need to look even further afield for help.
>> >> --
>> >> Sent from my phone. Please excuse my brevity.
>> >>
>> >> On April 3, 2017 8:57:07 PM PDT, stephen sefick 
>> wrote:
>> >>> Hello,
>> >>>
>> >>> I am writing an R package, and I am using system() to call a perl
>> >>> script.
>> >>> The output of the perl script is correct except for "[A/B]" is output
>> >>> as
>> >>> "AB". Can someone explain this behavior. I would like to try and fix
>> >>> this.
>> >>> many thanks,
>> >>>
>> >>> Stephen Sefick
>> >>
>> >
>> >
>> >
>> > --
>> > Let's not spend our time and resources thinking about things that are so
>> > little or so large that all they really do for us is puff us up and make
>> us
>> > feel like gods.  We are mammals, and have not exhausted the annoying
>> little
>> > problems of being mammals.
>> >
>> >-K. Mullis
>> >
>> > "A big computer, a complex algorithm and a long time does not equal
>> > science."
>> >
>> >  -Robert Gentleman
>> >
>> >   [[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.
>>
>>
>
>
> --
> Let's not spend our time and resources thinking about things that are so
> little or so large that all they really do for us is puff us up and make us
> feel like gods.  We are mammals, and have not exhausted the annoying little
> problems of being mammals.
>
> -K. Mullis
>
> "A big computer, a complex algorithm and a long time does not equal
> science."
>
>   -Robert Gentleman
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] taking a small piece of large tiff

2017-04-04 Thread Louisa Reynolds via R-help
Dear Forum 
I am trying to cut out a small section of a very large 2-dimensional grayscale 
image as a tiff in R, but it is having difficulty handling such large files.  I 
have looked at bigmemory and ff packages but it is unclear how I can use these 
packages with tiffs. Can anyone please suggest something? I have tried tiff and 
rtiff libraries.
Thanks in advance.
[[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] taking a small piece of large tiff

2017-04-04 Thread jim holtman
How big is 'large'?

Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.


On Tue, Apr 4, 2017 at 7:47 AM, Louisa Reynolds via R-help
 wrote:
> Dear Forum
> I am trying to cut out a small section of a very large 2-dimensional 
> grayscale image as a tiff in R, but it is having difficulty handling such 
> large files.  I have looked at bigmemory and ff packages but it is unclear 
> how I can use these packages with tiffs. Can anyone please suggest something? 
> I have tried tiff and rtiff libraries.
> Thanks in advance.
> [[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] Using R and Python together

2017-04-04 Thread Kankana Shukla
Installation of pyper gives me error code 1.  I used pip install on my
ubuntu machine.  How to install Pyper correctly?

Here is the debug log file:


/usr/bin/pip run on Tue Apr  4 15:07:58 2017
Downloading/unpacking pyper
  Getting page https://pypi.python.org/simple/pyper/
  URLs to search for versions for pyper:
  * https://pypi.python.org/simple/pyper/
YV  Analyzing links from page https://pypi.python.org/simple/pyper/
Found link
https://pypi.python.org/packages/0f/46/47a5ebf039d1982a5cf7ed4f53ef1dcfccf57358566da973732cfc2ac31d/PypeR-1.1.1.tar.gz#md5=8f1708b06e1cdd73d3f03b4342c7c948
(from https://pypi.python.org/sim$
Found link
https://pypi.python.org/packages/4f/c2/957c9eb9ced95cedd04e6330ac446485d6e48f2d198f21f30aba0fe637cc/PypeR-1.0.1.tar.gz#md5=fc05ad098ef370deb7fffee34497fa82
(from https://pypi.python.org/sim$
Found link
https://pypi.python.org/packages/56/fa/d6d58ace212c2dac27c08fe03c603eede4f1190a46d11917946db74bd1e8/PypeR-1.1.0.tar.gz#md5=6a186b5399d75f32f0eb29275c7e01b3
(from https://pypi.python.org/sim$
Found link
https://pypi.python.org/packages/6c/87/a19361e922311aa86697edcbd95f3af85c69240350836136c629b7b29b38/PypeR-1.0.2.tar.gz#md5=73dd5f4b5dac2bd0a29425853c8de125
(from https://pypi.python.org/sim$
Found link
https://pypi.python.org/packages/7e/4d/8167a3f7b3897b15ac5c2424886579cefa852705ac4c925dbdb8740f8838/PypeR-1.0.tar.gz#md5=eb05aa5ccee55e5175ea8f36e2d42591
(from https://pypi.python.org/simpl$
Found link
https://pypi.python.org/packages/7f/44/4c063481bed01a9f18e34b823c796af7b8f59f458a8e67fd171263a96488/PypeR-1.0.3.tar.gz#md5=b8b9535e825d88dc6f15aff13c6e180c
(from https://pypi.python.org/sim$
Found link
https://pypi.python.org/packages/e6/3e/4ed8b7c2f7a1d3b18ecb37b09b4867fee95151a3a59c43c20376678e/PypeR-1.1.2.tar.gz#md5=d056a481a13d07300a5ffc6848b34d1e
(from https://pypi.python.org/sim$
Found link
https://pypi.python.org/packages/eb/5a/2991b67ad276c5523404b77eeb9c30e01cbda9920c9da9b20d656dc2/PypeR-1.0.4.tar.gz#md5=40b0ccaa645c7b936cc25ce86527aba6
(from https://pypi.python.org/sim$
  Using version 1.1.2 (newest of versions: 1.1.2, 1.1.1, 1.1.0, 1.0.4,
1.0.3, 1.0.2, 1.0.1, 1.0)
  Downloading PypeR-1.1.2.tar.gz
  Downloading from URL
https://pypi.python.org/packages/e6/3e/4ed8b7c2f7a1d3b18ecb37b09b4867fee95151a3a59c43c20376678e/PypeR-1.1.2.tar.gz#md5=d056a481a13d07300a5ffc6848b34d1e
(from https://pypi.python$
  Running setup.py (path:/tmp/pip_build_root/pyper/setup.py) egg_info for
package pyper
Traceback (most recent call last):
  File "", line 17, in 
  File "/tmp/pip_build_root/pyper/setup.py", line 13, in 
py_modules=['pyper'], # copy to site-packages
  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py",
line 320, in __init__
_Distribution.__init__(self, attrs)
  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py",
line 386, in finalize_options
ep.require(installer=self.fetch_build_egg)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2100,
in require
working_set.resolve(self.dist.requires(self.extras),env,installer)))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 620,
in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 858,
in best_match
return self.obtain(req, installer) # try and download/install
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 870,
in obtain
return installer(requirement)
  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py",
line 416, in fetch_build_egg
from setuptools.command.easy_install import easy_install
  File
"/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py",
line 51, in 
from setuptools.archive_util import unpack_archive
  File
"/usr/local/lib/python2.7/dist-packages/setuptools/archive_util.py", line
11, in 
from pkg_resources import ensure_directory, ContextualZipFile
ImportError: cannot import name ContextualZipFile
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

  File "", line 17, in 

  File "/tmp/pip_build_root/pyper/setup.py", line 13, in 
py_modules=['pyper'], # copy to site-packages

  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup

_setup_distribution = dist = klass(attrs)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line
320, in __init__

_Distribution.__init__(self, attrs)

  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__

self.finalize_options()

  File "/usr/local/lib/py

Re: [R] R hangs on startup

2017-04-04 Thread John
On Mon, 3 Apr 2017 18:06:06 +0100
"Vineet Gupta"  wrote:

> John,
> 
> R does not work properly, outside of RStudio.
> 
> Vineet
> 
That is what I thought you might be saying.  Does it work outside
if RStudio is not loaded?  Windows can occasionally be flaky
about multiple instances of a single program. 

John

__
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 hangs on startup

2017-04-04 Thread William Dunlap via R-help
Does R work if started with the --vanilla flag?
(Add it after ...\Rgui.exe in the Target line of
the Windows shortcut or on the command line.)
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Tue, Apr 4, 2017 at 1:53 PM, John  wrote:
> On Mon, 3 Apr 2017 18:06:06 +0100
> "Vineet Gupta"  wrote:
>
>> John,
>>
>> R does not work properly, outside of RStudio.
>>
>> Vineet
>>
> That is what I thought you might be saying.  Does it work outside
> if RStudio is not loaded?  Windows can occasionally be flaky
> about multiple instances of a single program.
>
> John
>
> __
> 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] R hangs on startup

2017-04-04 Thread Jeff Newmiller
> Windows can occasionally be flaky
> about multiple instances of a single
> program. 

John... I run multiple instances of R and RStudio on Win7 regularly. About the 
only poor behaviour I encounter has to do with updating packages used by those 
other instances.

However, I would never run R as Administrator under Windows. Too many bad 
things can happen if you do that. 

Vineet... please be specific about what command line you are using that leads 
to trouble. Look in the shortcut properties to figure this out if that is how 
you are starting it. Using the command line directly will let you try out 
different options such as --vanilla more easily. You may also need to look at 
your PATH environment variable (Sys.getenv("PATH")) to make sure of which 
version you are invoking. 
-- 
Sent from my phone. Please excuse my brevity.

On April 4, 2017 1:53:25 PM PDT, John  wrote:
>On Mon, 3 Apr 2017 18:06:06 +0100
>"Vineet Gupta"  wrote:
>
>> John,
>> 
>> R does not work properly, outside of RStudio.
>> 
>> Vineet
>> 
>That is what I thought you might be saying.  Does it work outside
>if RStudio is not loaded?  Windows can occasionally be flaky
>about multiple instances of a single program. 
>
>John
>
>__
>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] differential use of R version

2017-04-04 Thread Bogdan Tanasa
Dear all,

please could you advise me on the following :

on a server, in a folder "x86_64-redhat-linux-gnu-library", i have 2
versions of R (below), with the corresponding BioC libraries :

> 3.2
> 3.3

how could i preferentially use an R version or the other (with the related
BioC libraries) ?

thank you,

-- bogdan

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