Re: [R] Kosaraju's SCC Algorithm Running

2016-11-06 Thread Jeff Newmiller
Please read the Posting Guide mentioned at the bottom of this and every post, which warns you that homework is off topic on this mailing list. Use the support provided by your institution of learning (Coursera in this case). -- Sent from my phone. Please excuse my brevity. On November 6, 2016

Re: [R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread William Dunlap via R-help
Perhaps the C function Rf_logspace_sum(double *x, int n) would help in computing log(b). It computes log(sum(exp(x_i))) for i in 1..n, avoiding unnecessary under- and overflow. Bill Dunlap TIBCO Software wdunlap tibco.com On Sun, Nov 6, 2016 at 5:25 PM, Rolf Turner

[R] Kosaraju's SCC Algorithm Running

2016-11-06 Thread Megan
To whom it may concerns, We encountered stack overflow issues when we implemented DFS(depth first search) algorithm on a directed graph having 800,000+ vertices and millions of edges. The purpose of running DFS is to use Kosaraju Algorithm to calculate the size of SCC(strongly connected

Re: [R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread Rolf Turner
On 07/11/16 15:46, Charles C. Berry wrote: On Mon, 7 Nov 2016, Rolf Turner wrote: On 07/11/16 13:07, William Dunlap wrote: Have you tried reparameterizing, using logb (=log(b)) instead of b? Uh, no. I don't think that that makes any sense in my context. The "b" values are probabilities

Re: [R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread Charles C. Berry
On Mon, 7 Nov 2016, Rolf Turner wrote: On 07/11/16 13:07, William Dunlap wrote: Have you tried reparameterizing, using logb (=log(b)) instead of b? Uh, no. I don't think that that makes any sense in my context. The "b" values are probabilities and must satisfy a "sum-to-1" constraint. To

Re: [R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread Rolf Turner
On 07/11/16 14:14, ProfJCNash wrote: Rolf, What optimizers did you try? There are a few in the optimrx package on R-forge that handle bounds, and it may be useful to set bounds in this case. Transformations using log or exp can be helpful if done carefully, but as you note, they can make the

Re: [R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread Rolf Turner
On 07/11/16 13:07, William Dunlap wrote: Have you tried reparameterizing, using logb (=log(b)) instead of b? Uh, no. I don't think that that makes any sense in my context. The "b" values are probabilities and must satisfy a "sum-to-1" constraint. To accommodate this constraint I

Re: [R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread ProfJCNash
Rolf, What optimizers did you try? There are a few in the optimrx package on R-forge that handle bounds, and it may be useful to set bounds in this case. Transformations using log or exp can be helpful if done carefully, but as you note, they can make the function more difficult to optimize. Be

Re: [R] Pesky file encoding problem

2016-11-06 Thread Duncan Murdoch
On 06/11/2016 12:25 PM, Joshua Banta wrote: Dear everyone, Please consider the following code, which I am using to make a custom text file. (I need to build the text file line-by-line like this for some idiosyncratic reasons that I will not get into here. But basically the real text file I

Re: [R] Pesky file encoding problem

2016-11-06 Thread Jim Lemon
Hi Joshua, Use Notepad++. It will also convert the linefeed EOLs to CR/LF. Jim On Mon, Nov 7, 2016 at 4:25 AM, Joshua Banta wrote: > Dear everyone, > > Please consider the following code, which I am using to make a custom text > file. (I need to build the text file

[R] Pesky file encoding problem

2016-11-06 Thread Joshua Banta
Dear everyone, Please consider the following code, which I am using to make a custom text file. (I need to build the text file line-by-line like this for some idiosyncratic reasons that I will not get into here. But basically the real text file I am making is longer and more complicated than

Re: [R] How to pre-process fwf or csv files to remove unexpected characters in R?

2016-11-06 Thread Lucas Ferreira Mation
Thank you Bert, Jeff and David for great answers. Let me provide more context to clarify the question: - I am running this on a large server (512GB), so the data still fits into memory (and I also know how to process in chunks if necessary) - I agree that DBMS and other software would me better

Re: [R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread William Dunlap via R-help
Have you tried reparameterizing, using logb (=log(b)) instead of b? Bill Dunlap TIBCO Software wdunlap tibco.com On Sun, Nov 6, 2016 at 1:17 PM, Rolf Turner wrote: > > I am trying to deal with a maximisation problem in which it is possible > for the objective function

Re: [R] Is this foreach behaviour correct?

2016-11-06 Thread William Dunlap via R-help
Note that in the OP's example c.Date is never invoked. c.Date is called if .combine calls c rather than if .combine is c: > library(zoo) > trace(c.Date, quote(print(sys.call( Tracing function "c.Date" in package "base" [1] "c.Date" > foreach(i=1:10003, .combine=c) %do% { as.Date(i) } [1]

Re: [R] Is this foreach behaviour correct?

2016-11-06 Thread Duncan Murdoch
On 06/11/2016 5:02 PM, Jim Lemon wrote: hi James, I think you have to have a starting date ("origin") for as.Date to convert numbers to dates. That's true with the function in the base package, but the zoo package also has an as.Date() function, which defaults the origin to "1970-01-01". If

Re: [R] Is this foreach behaviour correct?

2016-11-06 Thread Jim Lemon
hi James, I think you have to have a starting date ("origin") for as.Date to convert numbers to dates. Jim On Sun, Nov 6, 2016 at 12:10 PM, James Hirschorn wrote: > This seemed odd so I wanted to check: > > > x <- foreach(i=1:10100, .combine='c') %do% {

Re: [R] How to pre-process fwf or csv files to remove unexpected characters in R?

2016-11-06 Thread Jim Lemon
Hi Lucas, This is a rough outline of something I programmed years ago for data cleaning (that was programmed in C). The basic idea is to read the file line by line and check for a problem (in the initial application this was a discrepancy between two lines that were supposed to be identical).

[R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread Rolf Turner
I am trying to deal with a maximisation problem in which it is possible for the objective function to (quite legitimately) return the value -Inf, which causes the numerical optimisers that I have tried to fall over. The -Inf values arise from expressions of the form "a * log(b)", with b =

[R] [R-pkgs] Package BatchGetSymbols

2016-11-06 Thread Marcelo Perlin
Dear R users, If you use quantmod::GetSymbols to download financial data from yahoo or google finance, you might find my new package *BatchGetSymbols* very useful. It no only downloads data for multiple tickers but also organizes it in an efficient way, making it easy to use dplyr and ggplot2 in

Re: [R] How to pre-process fwf or csv files to remove unexpected characters in R?

2016-11-06 Thread David Winsemius
> On Nov 6, 2016, at 5:36 AM, Lucas Ferreira Mation > wrote: > > I have some large .txt files about ~100GB containing a dataset in fixed > width file. This contains some errors: > - character characters in column that are supposed to be numeric, > - invalid characters >

Re: [R] How to pre-process fwf or csv files to remove unexpected characters in R?

2016-11-06 Thread Jeff Newmiller
?readLines ... given the large size of file you may need to process chunks by specifying a file connection rather than a character string file name and using the "n" argument. ?grepl ?Extract ?tools::showNonASCII There are many ways for data to be corrupted... in particular when invalid

[R] tcl('tk::fontchooser', 'show') : How to use? R-devel Tcl 8.6

2016-11-06 Thread Cleber N.Borges
Hello, Somebody would indicate the correct way to use the option the fontchooser widget into tcltk package (in R-devel, Tcl 8.6) ? I tried to use as other traditional widgets but no success. (code below) Thanks Cleber > tt <- tktoplevel(); but <- ttkbutton( tt, text='Test'); tcl('pack', but )

[R] How to pre-process fwf or csv files to remove unexpected characters in R?

2016-11-06 Thread Lucas Ferreira Mation
I have some large .txt files about ~100GB containing a dataset in fixed width file. This contains some errors: - character characters in column that are supposed to be numeric, - invalid characters - rows with too many characters, possibly due to invalid characters or some missing end of line

Re: [R] Problem with downloading library(Rcmdr)

2016-11-06 Thread David Winsemius
> On Nov 6, 2016, at 6:10 AM, Jeff Newmiller wrote: > > I am not aware of a "-1" option for R CMD INSTALL [1]. Nor do I have a > Macintosh. It compiles from the MacGUI console using an ordinary call (no extra environment variables need be set) to install.packages,

Re: [R] Problem with downloading library(Rcmdr)

2016-11-06 Thread Jeff Newmiller
I am not aware of a "-1" option for R CMD INSTALL [1]. Nor do I have a Macintosh. Do be prepared to keep reading the documentation once you get past this point, as the whole reason you are doing this is that the original maintainer chose to not fix whatever problems existed in that package,

Re: [R] Problem with downloading library(Rcmdr)

2016-11-06 Thread varin sacha via R-help
Hi Jeff, Many thanks for your reply.I know that R packages can be downloaded as "tar.gz" file for Mac OS X from CRAN sources. I have found on Internet that the command is the following : R CMD INSTALL -1 rlme_0.4.tar.gz When I run that command on my R console, I get an error as you can read