Re: [R] Help modifying "aheatmap" or find a new heatmap package

2016-09-17 Thread Ulrik Stervbo
I am a huge fan of pheatmap and use it for all my heatmaps.

Alternatively you can use ggplot2 and geom_tile

Hth
Ulrik

Jim Lemon  schrieb am So., 18. Sep. 2016 01:35:

> Hi Michael,
> Maybe color2D.matplot (plotrix). Have a look at the examples.
>
> Jim
>
>
> On Sat, Sep 17, 2016 at 4:10 AM, Michael Young 
> wrote:
> > I am currently using "aheatmap" which is generating heatmaps based on
> > Pearson correlation.  My data consists of RPKM values for genes from 2
> > groups.  Each group has about 70 samples.
> >
> > Is there anyway that I can modify "aheatmap" so that it generates heat
> maps
> > based on the actual input values (RPKM) and not Pearson correlation?  I
> > want the heatmap to show high heat for higher RPKM and cold heat for
> lower
> > RPKM.
> > If not, is there a package out there that can do this?
> >
> > Michael
> >
> > [[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.
>

[[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] Help modifying "aheatmap" or find a new heatmap package

2016-09-17 Thread Jim Lemon
Hi Michael,
Maybe color2D.matplot (plotrix). Have a look at the examples.

Jim


On Sat, Sep 17, 2016 at 4:10 AM, Michael Young  wrote:
> I am currently using "aheatmap" which is generating heatmaps based on
> Pearson correlation.  My data consists of RPKM values for genes from 2
> groups.  Each group has about 70 samples.
>
> Is there anyway that I can modify "aheatmap" so that it generates heat maps
> based on the actual input values (RPKM) and not Pearson correlation?  I
> want the heatmap to show high heat for higher RPKM and cold heat for lower
> RPKM.
> If not, is there a package out there that can do this?
>
> Michael
>
> [[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] separate commands by semicolon

2016-09-17 Thread Peter Langfelder
On Sat, Sep 17, 2016 at 2:12 PM, David Winsemius  wrote:
>
>
> Not entirely clear. If you were intending to just get character output then 
> you could just use:
>
> strsplit(txt, ";")
>
> If you wanted parsing to an R expression to occur you could pass through 
> sapply and get a full accounting of the syntactic deficit using `try`:
>
> sapply(strsplit( "print(2); ls(" , ";")[[1]] , function(t) 
> {try(parse(text=t))})
> Error in parse(text = t) : :2:0: unexpected end of input
> 1:  ls(
>^
> expression(`print(2)` = print(2), ` ls(` = "Error in parse(text = t) : 
> :2:0: unexpected end of input\n1:  ls(\n   ^\n")
>

You would want to avoid splitting within character strings
(print(";")) and in comments (print(2); ls() # This prints 2; then
lists...) The comment char could also appear in a character string,
where it does not mean the start of a comment...

Not sure how to accomplish that using strsplit (or in general using
just regular expressions).

Peter

__
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] separate commands by semicolon

2016-09-17 Thread David Winsemius

> On Sep 17, 2016, at 8:28 AM, Adrian Dușa  wrote:
> 
> There is one minor problem with parse(): if any of the individual commands
> has an error, the entire text will be parsed in a single error.
> 
> For example, in a normal R console:
> 
>> print(2); ls(
> [1] 2
> +
> 
> So first print(2) is executed, and only after the console expects the user
> to continue the command from ls(
> Parsing the same text:
> 
>> parse(text = "print(2); ls(")
> Error in parse(text = "print(2); ls(") :
>  :2:0: unexpected end of input
> 1: print(2); ls(
>   ^
> 
> What I would need is something to separate the two commands, irrespective
> of their syntactical correctness:
> 
> [1] "print(2)" "ls("
> 
> I hope this explains the situation,

Not entirely clear. If you were intending to just get character output then you 
could just use:

strsplit(txt, ";")

If you wanted parsing to an R expression to occur you could pass through sapply 
and get a full accounting of the syntactic deficit using `try`:

sapply(strsplit( "print(2); ls(" , ";")[[1]] , function(t) {try(parse(text=t))})
Error in parse(text = t) : :2:0: unexpected end of input
1:  ls(
   ^
expression(`print(2)` = print(2), ` ls(` = "Error in parse(text = t) : 
:2:0: unexpected end of input\n1:  ls(\n   ^\n")


> Adrian
> 
> On Thu, Sep 15, 2016 at 11:02 PM, Adrian Dușa  wrote:
> 
>> On Thu, Sep 15, 2016 at 10:28 PM, William Dunlap 
>> wrote:
>> 
>>> The most reliable way to split such lines is with parse(text=x).
>>> Regular expressions don't do well with context-free grammars.
>>> 
>> 
>> Oh, that's right of course.
>>> as.character(parse(text = x))
>> [1] "foo <- \"3;4\"""bar <- \"don't ; use semicolons\""
>> 
>> That was simple enough, thanks very much,
>> Adrian
>> 
>> --
>> Adrian Dusa
>> University of Bucharest
>> Romanian Social Data Archive
>> Soseaua Panduri nr.90
>> 050663 Bucharest sector 5
>> Romania
>> 
> 
> 
> 
> -- 
> Adrian Dusa
> University of Bucharest
> Romanian Social Data Archive
> Soseaua Panduri nr.90
> 050663 Bucharest sector 5
> Romania
> 
>   [[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.

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] Accelerating binRead

2016-09-17 Thread jim holtman
Here is an example of how to do it:

x <- 1:10  # integer values
xf <- seq(1.0, 2, by = 0.1)  # floating point

setwd("d:/temp")

# create file to write to
output <- file('integer.bin', 'wb')
writeBin(x, output)  # write integer
writeBin(xf, output)  # write reals
close(output)


library(pack)
library(readr)

# read all the data at once
allbin <- read_file_raw('integer.bin')

# decode the data into a list
(result <- unpack("V V V V V V V V V V d d d d d d d d d d", allbin))




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 Sat, Sep 17, 2016 at 11:04 AM, Ismail SEZEN 
wrote:

> I noticed same issue but didnt care much :)
>
> On Sat, Sep 17, 2016, 18:01 jim holtman  wrote:
>
>> Your example was not reproducible.  Also how do you "break" out of the
>> "while" loop?
>>
>>
>> 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 Sat, Sep 17, 2016 at 8:05 AM, Philippe de Rochambeau 
>> wrote:
>>
>> > Hello,
>> > the following function, which stores numeric values extracted from a
>> > binary file, into an R matrix, is very slow, especially when the said
>> file
>> > is several MB in size.
>> > Should I rewrite the function in inline C or in C/C++ using Rcpp? If the
>> > latter case is true, how do you « readBin »  in Rcpp (I’m a total Rcpp
>> > newbie)?
>> > Many thanks.
>> > Best regards,
>> > phiroc
>> >
>> >
>> > -
>> >
>> > # inputPath is something like http://myintranet/getData?
>> > pathToFile=/usr/lib/xxx/yyy/data.bin > > pathToFile=/usr/lib/xxx/yyy/data.bin>
>> >
>> > PLTreader <- function(inputPath){
>> > URL <- file(inputPath, "rb")
>> > PLT <- matrix(nrow=0, ncol=6)
>> > compteurDePrints = 0
>> > compteurDeLignes <- 0
>> > maxiPrints = 5
>> > displayData <- FALSE
>> > while (TRUE) {
>> > periodIndex <- readBin(URL, integer(), size=4, n=1,
>> > endian="little") # int (4 bytes)
>> > eventId <- readBin(URL, integer(), size=4, n=1,
>> > endian="little") # int (4 bytes)
>> > dword1 <- readBin(URL, integer(), size=4, signed=FALSE,
>> > n=1, endian="little") # int
>> > dword2 <- readBin(URL, integer(), size=4, signed=FALSE,
>> > n=1, endian="little") # int
>> > if (dword1 < 0) {
>> > dword1 = dword1 + 2^32-1;
>> > }
>> > eventDate = (dword2*2^32 + dword1)/1000
>> > repNum <- readBin(URL, integer(), size=2, n=1,
>> > endian="little") # short (2 bytes)
>> > exp <- readBin(URL, numeric(), size=4, n=1,
>> > endian="little") # float (4 bytes, strangely enough, would expect 8)
>> > loss <- readBin(URL, numeric(), size=4, n=1,
>> > endian="little") # float (4 bytes)
>> > PLT <- rbind(PLT, c(periodIndex, eventId, eventDate,
>> > repNum, exp, loss))
>> > } # end while
>> > return(PLT)
>> > close(URL)
>> > }
>> >
>> > 
>> > [[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] Accelerating binRead

2016-09-17 Thread jim holtman
I would also suggest that you take a look at the 'pack' package which can
convert the binary input to the value you want.  Part of your performance
problems might be all the short reads that you are doing.


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 Sat, Sep 17, 2016 at 11:04 AM, Ismail SEZEN 
wrote:

> I noticed same issue but didnt care much :)
>
> On Sat, Sep 17, 2016, 18:01 jim holtman  wrote:
>
>> Your example was not reproducible.  Also how do you "break" out of the
>> "while" loop?
>>
>>
>> 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 Sat, Sep 17, 2016 at 8:05 AM, Philippe de Rochambeau 
>> wrote:
>>
>> > Hello,
>> > the following function, which stores numeric values extracted from a
>> > binary file, into an R matrix, is very slow, especially when the said
>> file
>> > is several MB in size.
>> > Should I rewrite the function in inline C or in C/C++ using Rcpp? If the
>> > latter case is true, how do you « readBin »  in Rcpp (I’m a total Rcpp
>> > newbie)?
>> > Many thanks.
>> > Best regards,
>> > phiroc
>> >
>> >
>> > -
>> >
>> > # inputPath is something like http://myintranet/getData?
>> > pathToFile=/usr/lib/xxx/yyy/data.bin > > pathToFile=/usr/lib/xxx/yyy/data.bin>
>> >
>> > PLTreader <- function(inputPath){
>> > URL <- file(inputPath, "rb")
>> > PLT <- matrix(nrow=0, ncol=6)
>> > compteurDePrints = 0
>> > compteurDeLignes <- 0
>> > maxiPrints = 5
>> > displayData <- FALSE
>> > while (TRUE) {
>> > periodIndex <- readBin(URL, integer(), size=4, n=1,
>> > endian="little") # int (4 bytes)
>> > eventId <- readBin(URL, integer(), size=4, n=1,
>> > endian="little") # int (4 bytes)
>> > dword1 <- readBin(URL, integer(), size=4, signed=FALSE,
>> > n=1, endian="little") # int
>> > dword2 <- readBin(URL, integer(), size=4, signed=FALSE,
>> > n=1, endian="little") # int
>> > if (dword1 < 0) {
>> > dword1 = dword1 + 2^32-1;
>> > }
>> > eventDate = (dword2*2^32 + dword1)/1000
>> > repNum <- readBin(URL, integer(), size=2, n=1,
>> > endian="little") # short (2 bytes)
>> > exp <- readBin(URL, numeric(), size=4, n=1,
>> > endian="little") # float (4 bytes, strangely enough, would expect 8)
>> > loss <- readBin(URL, numeric(), size=4, n=1,
>> > endian="little") # float (4 bytes)
>> > PLT <- rbind(PLT, c(periodIndex, eventId, eventDate,
>> > repNum, exp, loss))
>> > } # end while
>> > return(PLT)
>> > close(URL)
>> > }
>> >
>> > 
>> > [[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] separate commands by semicolon

2016-09-17 Thread Adrian Dușa
There is one minor problem with parse(): if any of the individual commands
has an error, the entire text will be parsed in a single error.

For example, in a normal R console:

> print(2); ls(
[1] 2
+

So first print(2) is executed, and only after the console expects the user
to continue the command from ls(
Parsing the same text:

> parse(text = "print(2); ls(")
Error in parse(text = "print(2); ls(") :
  :2:0: unexpected end of input
1: print(2); ls(
   ^

What I would need is something to separate the two commands, irrespective
of their syntactical correctness:

[1] "print(2)" "ls("

I hope this explains the situation,
Adrian

On Thu, Sep 15, 2016 at 11:02 PM, Adrian Dușa  wrote:

> On Thu, Sep 15, 2016 at 10:28 PM, William Dunlap 
> wrote:
>
>> The most reliable way to split such lines is with parse(text=x).
>> Regular expressions don't do well with context-free grammars.
>>
>
> Oh, that's right of course.
> > as.character(parse(text = x))
> [1] "foo <- \"3;4\"""bar <- \"don't ; use semicolons\""
>
> That was simple enough, thanks very much,
> Adrian
>
> --
> Adrian Dusa
> University of Bucharest
> Romanian Social Data Archive
> Soseaua Panduri nr.90
> 050663 Bucharest sector 5
> Romania
>



-- 
Adrian Dusa
University of Bucharest
Romanian Social Data Archive
Soseaua Panduri nr.90
050663 Bucharest sector 5
Romania

[[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] Accelerating binRead

2016-09-17 Thread Bob Rudis
You should probably pick a forum — here or SO :
http://stackoverflow.com/questions/39547398/faster-reading-of-binary-files-in-r
: - vs cross-post to all of them.

On Sat, Sep 17, 2016 at 11:04 AM, Ismail SEZEN 
wrote:

> I noticed same issue but didnt care much :)
>
> On Sat, Sep 17, 2016, 18:01 jim holtman  wrote:
>
> > Your example was not reproducible.  Also how do you "break" out of the
> > "while" loop?
> >
> >
> > 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 Sat, Sep 17, 2016 at 8:05 AM, Philippe de Rochambeau 
> > wrote:
> >
> > > Hello,
> > > the following function, which stores numeric values extracted from a
> > > binary file, into an R matrix, is very slow, especially when the said
> > file
> > > is several MB in size.
> > > Should I rewrite the function in inline C or in C/C++ using Rcpp? If
> the
> > > latter case is true, how do you « readBin »  in Rcpp (I’m a total Rcpp
> > > newbie)?
> > > Many thanks.
> > > Best regards,
> > > phiroc
> > >
> > >
> > > -
> > >
> > > # inputPath is something like http://myintranet/getData?
> > > pathToFile=/usr/lib/xxx/yyy/data.bin  > > pathToFile=/usr/lib/xxx/yyy/data.bin>
> > >
> > > PLTreader <- function(inputPath){
> > > URL <- file(inputPath, "rb")
> > > PLT <- matrix(nrow=0, ncol=6)
> > > compteurDePrints = 0
> > > compteurDeLignes <- 0
> > > maxiPrints = 5
> > > displayData <- FALSE
> > > while (TRUE) {
> > > periodIndex <- readBin(URL, integer(), size=4, n=1,
> > > endian="little") # int (4 bytes)
> > > eventId <- readBin(URL, integer(), size=4, n=1,
> > > endian="little") # int (4 bytes)
> > > dword1 <- readBin(URL, integer(), size=4, signed=FALSE,
> > > n=1, endian="little") # int
> > > dword2 <- readBin(URL, integer(), size=4, signed=FALSE,
> > > n=1, endian="little") # int
> > > if (dword1 < 0) {
> > > dword1 = dword1 + 2^32-1;
> > > }
> > > eventDate = (dword2*2^32 + dword1)/1000
> > > repNum <- readBin(URL, integer(), size=2, n=1,
> > > endian="little") # short (2 bytes)
> > > exp <- readBin(URL, numeric(), size=4, n=1,
> > > endian="little") # float (4 bytes, strangely enough, would expect 8)
> > > loss <- readBin(URL, numeric(), size=4, n=1,
> > > endian="little") # float (4 bytes)
> > > PLT <- rbind(PLT, c(periodIndex, eventId, eventDate,
> > > repNum, exp, loss))
> > > } # end while
> > > return(PLT)
> > > close(URL)
> > > }
> > >
> > > 
> > > [[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.
>

[[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] Accelerating binRead

2016-09-17 Thread Ismail SEZEN
I noticed same issue but didnt care much :)

On Sat, Sep 17, 2016, 18:01 jim holtman  wrote:

> Your example was not reproducible.  Also how do you "break" out of the
> "while" loop?
>
>
> 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 Sat, Sep 17, 2016 at 8:05 AM, Philippe de Rochambeau 
> wrote:
>
> > Hello,
> > the following function, which stores numeric values extracted from a
> > binary file, into an R matrix, is very slow, especially when the said
> file
> > is several MB in size.
> > Should I rewrite the function in inline C or in C/C++ using Rcpp? If the
> > latter case is true, how do you « readBin »  in Rcpp (I’m a total Rcpp
> > newbie)?
> > Many thanks.
> > Best regards,
> > phiroc
> >
> >
> > -
> >
> > # inputPath is something like http://myintranet/getData?
> > pathToFile=/usr/lib/xxx/yyy/data.bin  > pathToFile=/usr/lib/xxx/yyy/data.bin>
> >
> > PLTreader <- function(inputPath){
> > URL <- file(inputPath, "rb")
> > PLT <- matrix(nrow=0, ncol=6)
> > compteurDePrints = 0
> > compteurDeLignes <- 0
> > maxiPrints = 5
> > displayData <- FALSE
> > while (TRUE) {
> > periodIndex <- readBin(URL, integer(), size=4, n=1,
> > endian="little") # int (4 bytes)
> > eventId <- readBin(URL, integer(), size=4, n=1,
> > endian="little") # int (4 bytes)
> > dword1 <- readBin(URL, integer(), size=4, signed=FALSE,
> > n=1, endian="little") # int
> > dword2 <- readBin(URL, integer(), size=4, signed=FALSE,
> > n=1, endian="little") # int
> > if (dword1 < 0) {
> > dword1 = dword1 + 2^32-1;
> > }
> > eventDate = (dword2*2^32 + dword1)/1000
> > repNum <- readBin(URL, integer(), size=2, n=1,
> > endian="little") # short (2 bytes)
> > exp <- readBin(URL, numeric(), size=4, n=1,
> > endian="little") # float (4 bytes, strangely enough, would expect 8)
> > loss <- readBin(URL, numeric(), size=4, n=1,
> > endian="little") # float (4 bytes)
> > PLT <- rbind(PLT, c(periodIndex, eventId, eventDate,
> > repNum, exp, loss))
> > } # end while
> > return(PLT)
> > close(URL)
> > }
> >
> > 
> > [[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] Accelerating binRead

2016-09-17 Thread jim holtman
Your example was not reproducible.  Also how do you "break" out of the
"while" loop?


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 Sat, Sep 17, 2016 at 8:05 AM, Philippe de Rochambeau 
wrote:

> Hello,
> the following function, which stores numeric values extracted from a
> binary file, into an R matrix, is very slow, especially when the said file
> is several MB in size.
> Should I rewrite the function in inline C or in C/C++ using Rcpp? If the
> latter case is true, how do you « readBin »  in Rcpp (I’m a total Rcpp
> newbie)?
> Many thanks.
> Best regards,
> phiroc
>
>
> -
>
> # inputPath is something like http://myintranet/getData?
> pathToFile=/usr/lib/xxx/yyy/data.bin  pathToFile=/usr/lib/xxx/yyy/data.bin>
>
> PLTreader <- function(inputPath){
> URL <- file(inputPath, "rb")
> PLT <- matrix(nrow=0, ncol=6)
> compteurDePrints = 0
> compteurDeLignes <- 0
> maxiPrints = 5
> displayData <- FALSE
> while (TRUE) {
> periodIndex <- readBin(URL, integer(), size=4, n=1,
> endian="little") # int (4 bytes)
> eventId <- readBin(URL, integer(), size=4, n=1,
> endian="little") # int (4 bytes)
> dword1 <- readBin(URL, integer(), size=4, signed=FALSE,
> n=1, endian="little") # int
> dword2 <- readBin(URL, integer(), size=4, signed=FALSE,
> n=1, endian="little") # int
> if (dword1 < 0) {
> dword1 = dword1 + 2^32-1;
> }
> eventDate = (dword2*2^32 + dword1)/1000
> repNum <- readBin(URL, integer(), size=2, n=1,
> endian="little") # short (2 bytes)
> exp <- readBin(URL, numeric(), size=4, n=1,
> endian="little") # float (4 bytes, strangely enough, would expect 8)
> loss <- readBin(URL, numeric(), size=4, n=1,
> endian="little") # float (4 bytes)
> PLT <- rbind(PLT, c(periodIndex, eventId, eventDate,
> repNum, exp, loss))
> } # end while
> return(PLT)
> close(URL)
> }
>
> 
> [[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] Accelerating binRead

2016-09-17 Thread Jeff Newmiller
Appending to lists is only very slightly more efficient than incremental 
rbinding. Ideally you can figure out an upper bound for number of records, 
preallocate a data frame of that size, modify each element as you go in-place, 
and shrink the data frame once at the end as needed. If you cannot do that, you 
can append fixed size data frames and follow the same strategy in chunks with a 
single do.call/rbind at the end. 

Note that reproducible examples including example data often yield working 
code, while incomplete examples tend to yield handwaving descriptions like the 
above. 

I will note that any code placed after a return function is useless. I highly 
recommend avoiding the return function like the plague... use the 
expression-at-the-end-of-the-function method of returning.
-- 
Sent from my phone. Please excuse my brevity.

On September 17, 2016 7:10:05 AM PDT, Ismail SEZEN  
wrote:
>I suspect that rbind is responsible. Use list and append instead of
>rbind. At the end, combine elements of list by do.call(“rbind”, list).
>
>> On 17 Sep 2016, at 15:05, Philippe de Rochambeau 
>wrote:
>> 
>> Hello,
>> the following function, which stores numeric values extracted from a
>binary file, into an R matrix, is very slow, especially when the said
>file is several MB in size.
>> Should I rewrite the function in inline C or in C/C++ using Rcpp? If
>the latter case is true, how do you « readBin »  in Rcpp (I’m a total
>Rcpp newbie)?
>> Many thanks.
>> Best regards,
>> phiroc
>> 
>> 
>> -
>> 
>> # inputPath is something like
>http://myintranet/getData?pathToFile=/usr/lib/xxx/yyy/data.bin
>
>> 
>> PLTreader <- function(inputPath){
>>  URL <- file(inputPath, "rb")
>>  PLT <- matrix(nrow=0, ncol=6)
>>  compteurDePrints = 0
>>  compteurDeLignes <- 0
>>  maxiPrints = 5
>>  displayData <- FALSE
>>  while (TRUE) {
>>  periodIndex <- readBin(URL, integer(), size=4, n=1,
>endian="little") # int (4 bytes)
>>  eventId <- readBin(URL, integer(), size=4, n=1, 
>> endian="little") #
>int (4 bytes)
>>  dword1 <- readBin(URL, integer(), size=4, signed=FALSE, n=1,
>endian="little") # int
>>  dword2 <- readBin(URL, integer(), size=4, signed=FALSE, n=1,
>endian="little") # int
>>  if (dword1 < 0) {
>>  dword1 = dword1 + 2^32-1;
>>  }
>>  eventDate = (dword2*2^32 + dword1)/1000
>>  repNum <- readBin(URL, integer(), size=2, n=1, endian="little") 
>> #
>short (2 bytes)
>>  exp <- readBin(URL, numeric(), size=4, n=1, endian="little") #
>float (4 bytes, strangely enough, would expect 8)
>>  loss <- readBin(URL, numeric(), size=4, n=1, endian="little") #
>float (4 bytes)
>>  PLT <- rbind(PLT, c(periodIndex, eventId, eventDate, repNum, 
>> exp,
>loss))
>>  } # end while
>>  return(PLT)
>>  close(URL)
>> }
>> 
>> 
>>  [[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-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] glmnet vignette question

2016-09-17 Thread Bert Gunter
You seem to be mainly asking for help with statistical methodology,
which is generally off topic for this list, which is about help with R
programming. I suggest you study the references given in the
vignette/package and/or post to a statistical list like
stats.stackexchange.com instead.

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 Fri, Sep 16, 2016 at 9:33 AM, Dominik Schneider
 wrote:
>> Is there a way to extract MSE for a lambda, e.g. lambda.1se?
> nevermind this specific question. it's now obvious. However my overall
> question stands.
>
> On Fri, Sep 16, 2016 at 10:10 AM, Dominik Schneider <
> dominik.schnei...@colorado.edu> wrote:
>
>> I'm doing some linear modeling and am new to the ridge/lasso/elasticnet
>> procedures. In my case I have N>>p (p=15 based on variables used in past
>> literature and some physical reasoning) so my understanding is that I
>> should be interested in ridge regression to avoid the issue of
>> multicollinearity of predictors.  Lasso is useful when p>>N.
>>
>> In the past I have performed step-wise regression with stepAIC in both
>> directions to choose my variables and then used VIF to determine if any of
>> these variables are correlated. My understanding is that ridge regression
>> is a more robust approach for this workflow.
>>
>> Reading the glmnet_beta vignette, it describes the alpha parameter where
>> alpha=1 is a lasso regression and alpha=0 is a ridge regression. Farther
>> down the authors suggest a 10 fold validation to determine an alpha value
>> and based on the plots shown, say that alpha=1 does the best here. However,
>> all the models look like they approach the same MSE and alpha=0 is the
>> lowest curve for all lambda (but maybe this second point doesn't matter?).
>> With my data I get a very similar looking set of curves so I'm trying to
>> decide if I should stick with alpha=1 instead of alpha=0. Is there a way to
>> extract MSE for a lambda, e.g. lambda.1se?
>>
>> Any advice or clarification is appreciated. Thanks.
>> Dominik
>>
>>
>
> [[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] Portfolio Optimization

2016-09-17 Thread Abhinaba Roy
Hi,

Has anybody worked on portfolio optimization using Genetic Algorithm in R?

Could you please share the code and some references on this topic?

Really appreciate your help.

Thanks,
Abhinaba

[[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] Accelerating binRead

2016-09-17 Thread Ismail SEZEN
I suspect that rbind is responsible. Use list and append instead of rbind. At 
the end, combine elements of list by do.call(“rbind”, list).

> On 17 Sep 2016, at 15:05, Philippe de Rochambeau  wrote:
> 
> Hello,
> the following function, which stores numeric values extracted from a binary 
> file, into an R matrix, is very slow, especially when the said file is 
> several MB in size.
> Should I rewrite the function in inline C or in C/C++ using Rcpp? If the 
> latter case is true, how do you « readBin »  in Rcpp (I’m a total Rcpp 
> newbie)?
> Many thanks.
> Best regards,
> phiroc
> 
> 
> -
> 
> # inputPath is something like 
> http://myintranet/getData?pathToFile=/usr/lib/xxx/yyy/data.bin 
> 
> 
> PLTreader <- function(inputPath){
>   URL <- file(inputPath, "rb")
>   PLT <- matrix(nrow=0, ncol=6)
>   compteurDePrints = 0
>   compteurDeLignes <- 0
>   maxiPrints = 5
>   displayData <- FALSE
>   while (TRUE) {
>   periodIndex <- readBin(URL, integer(), size=4, n=1, 
> endian="little") # int (4 bytes)
>   eventId <- readBin(URL, integer(), size=4, n=1, 
> endian="little") # int (4 bytes)
>   dword1 <- readBin(URL, integer(), size=4, signed=FALSE, n=1, 
> endian="little") # int
>   dword2 <- readBin(URL, integer(), size=4, signed=FALSE, n=1, 
> endian="little") # int
>   if (dword1 < 0) {
>   dword1 = dword1 + 2^32-1;
>   }
>   eventDate = (dword2*2^32 + dword1)/1000
>   repNum <- readBin(URL, integer(), size=2, n=1, endian="little") 
> # short (2 bytes)
>   exp <- readBin(URL, numeric(), size=4, n=1, endian="little") # 
> float (4 bytes, strangely enough, would expect 8)
>   loss <- readBin(URL, numeric(), size=4, n=1, endian="little") # 
> float (4 bytes)
>   PLT <- rbind(PLT, c(periodIndex, eventId, eventDate, repNum, 
> exp, loss))
>   } # end while
>   return(PLT)
>   close(URL)
> }
> 
> 
>   [[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] Accelerating binRead

2016-09-17 Thread Philippe de Rochambeau
Hello,
the following function, which stores numeric values extracted from a binary 
file, into an R matrix, is very slow, especially when the said file is several 
MB in size.
Should I rewrite the function in inline C or in C/C++ using Rcpp? If the latter 
case is true, how do you « readBin »  in Rcpp (I’m a total Rcpp newbie)?
Many thanks.
Best regards,
phiroc


-

# inputPath is something like 
http://myintranet/getData?pathToFile=/usr/lib/xxx/yyy/data.bin 


PLTreader <- function(inputPath){
URL <- file(inputPath, "rb")
PLT <- matrix(nrow=0, ncol=6)
compteurDePrints = 0
compteurDeLignes <- 0
maxiPrints = 5
displayData <- FALSE
while (TRUE) {
periodIndex <- readBin(URL, integer(), size=4, n=1, 
endian="little") # int (4 bytes)
eventId <- readBin(URL, integer(), size=4, n=1, 
endian="little") # int (4 bytes)
dword1 <- readBin(URL, integer(), size=4, signed=FALSE, n=1, 
endian="little") # int
dword2 <- readBin(URL, integer(), size=4, signed=FALSE, n=1, 
endian="little") # int
if (dword1 < 0) {
dword1 = dword1 + 2^32-1;
}
eventDate = (dword2*2^32 + dword1)/1000
repNum <- readBin(URL, integer(), size=2, n=1, endian="little") 
# short (2 bytes)
exp <- readBin(URL, numeric(), size=4, n=1, endian="little") # 
float (4 bytes, strangely enough, would expect 8)
loss <- readBin(URL, numeric(), size=4, n=1, endian="little") # 
float (4 bytes)
PLT <- rbind(PLT, c(periodIndex, eventId, eventDate, repNum, 
exp, loss))
} # end while
return(PLT)
close(URL)
}


[[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] ggplot2: geom_segment does not produce the color I desire?

2016-09-17 Thread Dominik Schneider
ggplot will assign, or map if you will, the color based on the default
color scale when color is specified with the mapping argument such as
mapping = aes(color=...). You have two options:

1. if you want the color of your arrow to be based on a column in your
data, then manually scale the color with
scale_colour_manual(values=c('green')):
ggplot()+
geom_segment(mapping = aes(x = as.Date(test[,"date"]), y = y1, xend =
as.Date(test[,"date"]), yend = y2, color=co), data=test, arrow=arrow())+
scale_colour_manual(values=c('green'))

2. If the color doesn't need to be "mapped" based on your data, then you
can simply specify colour *outside* the aes() like this:
ggplot()+
geom_segment(mapping = aes(x = as.Date(test[,"date"]), y = y1, xend =
as.Date(test[,"date"]), yend = y2), color='green', data=test, arrow=arrow())

keep in mind that only the first option will produce a legend, if you need
that.



On Friday, September 16, 2016, John  wrote:

> Hi,
>
>I have a dataset "test". I try to produce a "green" arrow but it gives a
> "red" arrow (as attached). Could someone tell me how I can fix it? Thanks,
>
> > test
> dateco   y1   y2
> 5 2011-11-28 green 196.6559 1.600267
> > dput(test)
> structure(list(date = structure(15306, class = "Date"), co = "green",
> y1 = 196.655872, y2 = 1.600267), .Names = c("date", "co",
> "y1", "y2"), class = "data.frame", row.names = 5L)
> > ggplot()+geom_segment(mapping = aes(x = as.Date(test[,"date"]), y =
> y1, xend = as.Date(test[,"date"]), yend = y2, color=co), data=test,
> arrow=arrow())
> >
>

[[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 modifying "aheatmap" or find a new heatmap package

2016-09-17 Thread Michael Young
I am currently using "aheatmap" which is generating heatmaps based on
Pearson correlation.  My data consists of RPKM values for genes from 2
groups.  Each group has about 70 samples.

Is there anyway that I can modify "aheatmap" so that it generates heat maps
based on the actual input values (RPKM) and not Pearson correlation?  I
want the heatmap to show high heat for higher RPKM and cold heat for lower
RPKM.
If not, is there a package out there that can do this?

Michael

[[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 modifying "aheatmap" or find a new heatmap package

2016-09-17 Thread Michael Young
I am currently using "aheatmap" which is generating heatmaps based on
Pearson correlation.  My data consists of RPKM values for genes from 2
groups.  Each group has about 70 samples.

Is there anyway that I can modify "aheatmap" so that it generates heat maps
based on the actual input values (RPKM) and not Pearson correlation?  I
want the heatmap to show high heat for higher RPKM and cold heat for lower
RPKM.

If not, is there a package out there that can do this?

Michael

[[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] glmnet vignette question

2016-09-17 Thread Dominik Schneider
> Is there a way to extract MSE for a lambda, e.g. lambda.1se?
nevermind this specific question. it's now obvious. However my overall
question stands.

On Fri, Sep 16, 2016 at 10:10 AM, Dominik Schneider <
dominik.schnei...@colorado.edu> wrote:

> I'm doing some linear modeling and am new to the ridge/lasso/elasticnet
> procedures. In my case I have N>>p (p=15 based on variables used in past
> literature and some physical reasoning) so my understanding is that I
> should be interested in ridge regression to avoid the issue of
> multicollinearity of predictors.  Lasso is useful when p>>N.
>
> In the past I have performed step-wise regression with stepAIC in both
> directions to choose my variables and then used VIF to determine if any of
> these variables are correlated. My understanding is that ridge regression
> is a more robust approach for this workflow.
>
> Reading the glmnet_beta vignette, it describes the alpha parameter where
> alpha=1 is a lasso regression and alpha=0 is a ridge regression. Farther
> down the authors suggest a 10 fold validation to determine an alpha value
> and based on the plots shown, say that alpha=1 does the best here. However,
> all the models look like they approach the same MSE and alpha=0 is the
> lowest curve for all lambda (but maybe this second point doesn't matter?).
> With my data I get a very similar looking set of curves so I'm trying to
> decide if I should stick with alpha=1 instead of alpha=0. Is there a way to
> extract MSE for a lambda, e.g. lambda.1se?
>
> Any advice or clarification is appreciated. Thanks.
> Dominik
>
>

[[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] glmnet vignette question

2016-09-17 Thread Dominik Schneider
I'm doing some linear modeling and am new to the ridge/lasso/elasticnet
procedures. In my case I have N>>p (p=15 based on variables used in past
literature and some physical reasoning) so my understanding is that I
should be interested in ridge regression to avoid the issue of
multicollinearity of predictors.  Lasso is useful when p>>N.

In the past I have performed step-wise regression with stepAIC in both
directions to choose my variables and then used VIF to determine if any of
these variables are correlated. My understanding is that ridge regression
is a more robust approach for this workflow.

Reading the glmnet_beta vignette, it describes the alpha parameter where
alpha=1 is a lasso regression and alpha=0 is a ridge regression. Farther
down the authors suggest a 10 fold validation to determine an alpha value
and based on the plots shown, say that alpha=1 does the best here. However,
all the models look like they approach the same MSE and alpha=0 is the
lowest curve for all lambda (but maybe this second point doesn't matter?).
With my data I get a very similar looking set of curves so I'm trying to
decide if I should stick with alpha=1 instead of alpha=0. Is there a way to
extract MSE for a lambda, e.g. lambda.1se?

Any advice or clarification is appreciated. Thanks.
Dominik

[[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] brms error

2016-09-17 Thread farzana.akbari
 

“IN THE NAME OF GOD”   

  HI DEAR 

 I AM A M.SC. STUDENT OF ACCOUNTING IN FERDOWSI UNIVERSITY OF MASHHAD
AND I WANT TO USE BRMS PACKAGE FOR BAYSIAN MULTILEVEL ANALYSIS FOR MY
RESEARCH 

 I INSTALL RSTAN AND RTOOLS AND BRMS BUT I CANNOT SOLVE THIS PROBLEM OF
(ERROR). 

 I AM SOMEWHAT NEW IN R AND I DO NOT KNOW WHAT SHOULD I DO?! 

data("kidney") 

fit1 <- brm(formula = time | cens(censored) ~ age * sex + disease + (1 +
age|patient), data = kidney, family = lognormal(), prior =
c(set_prior("normal(0,5)", class = "b"), set_prior("cauchy(0,2)", class
= "sd"), set_prior("lkj(2)", class = "cor")), warmup = 1000, iter =
2000, chains = 4, control = list(adapt_delta = 0.95)) 

 Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created!
C:/Rtools/mingw_64/lib/gcc/x86_64-w64-mingw32/4.9.3/include/tmmintrin.h:
In function
'run':C:/Rtools/mingw_64/lib/gcc/x86_64-w64-mingw32/4.9.3/include/tmmintrin.h:188:32:
error: '__builtin_ia32_palignr128' needs isa option -m32 -mssse3
(__v2di)__Y, __N * 8);
^C:/Rtools/mingw_64/lib/gcc/x86_64-w64-mingw32/4.9.3/include/tmmintrin.h:188:32:
error: '__builtin_ia32_palignr128' needs isa option -m32 -mssse3
(__v2di)__Y, __N * 8); ^lto-wrapper: C:\Rtools\mingw_64\bin\g++.exe
returned 1 exit
statusC:/Rtools/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.3/../../../../x86_64-w64-mingw32/bin/ld.exe:
lto-wrapper failedcollect2.exe: error: ld returned 1 exit status 

I HAVE SENT YOU DETAILS IN ATTACH FILE. IF YOU HELP ME, I WILL BE VERY
TANKFUL  

 BEST REGARDS 

FARZANA AKBARI > local({pkg <- select.list(sort(.packages(all.availab__
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] Request for R code

2016-09-17 Thread ANURAG SHARMA
Heyy I want to apply LASSO method in AFT model. So can you guys please help
me by sending R code for that.

Regards
Anurag Sharma
Mphil Statistics
Faculty of Mathematical Science
Ph no-+91-8285468733

[[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-es] Saltar filas no numericas al importar csv

2016-09-17 Thread Fernando Arce via R-help-es
Hola Jesus, si aun no lo has arreglado, prueba esto. Si dices que todos los 
valores de las filas de datos son numericas, deberia hacerte el apaño
    ## informacion del nombre del archivo y separacion de columnas
    archivo <- 'mi archivo.csv'       # con las comillas, y con la ruta al 
archivo si no esta en el directorio
    sep <-  '\t'     # en mi caso, pero comprueba tu archivo    

    ## codigo
    dat <- readLines(archivo)    dat <- as.list(dat)    dat <- sapply(dat, 
strsplit,split=sep)    encabezado <- dat[[1]]    dat <- lapply(dat, as.numeric) 
   filas <- which(!is.na(sapply(dat,sum)))    datos <- dat[filas]    datos <- 
data.frame(t(sapply(datos, cbind)))    names(datos) <- encabezado
Te deberia lanzar unos mensajes de error  cuando hagas el lapply (dat, 
as.numeric) ya que fuerza a las filas no numericas a ser de NA's. 
Concretamente, un mensaje de error por cada encabezado. Lo 'coj...' es que si 
eso mismo lo meto en una funcion no funciona, pero las lineas que te pego las 
he probado con un fichero falso y el resultado era correcto.
A ver si esto te sirve
SaludosFer 

El Miércoles 14 de septiembre de 2016 19:52, Jesús Para Fernández 
 escribió:
 

 Buenas


Quiero saltar las filas no numericas al importar un csv. Saltar las primeras 
filas es facil, con el


read.csv("datos.csv",skip=30)


El problema es que el csv tiene cada x filas un encabezado, y quiero que excel 
solo pille los datos.

��o podr� hacerlo?

Gracias

Jes�

    [[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

   
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R] ggplot2: geom_segment does not produce the color I desire?

2016-09-17 Thread Erich Neuwirth
Here are 2 solutions to you problem:

If you only want to use one color (for possibly many arrows),
this will work:

ggplot()+geom_segment(mapping = aes(x = as.Date(test[,"date"]),
y =y1,
xend = as.Date(test[,"date"]),
yend = y2), color="green", data=testdf,
  arrow=arrow())


if you use a variable to colors different items differently,
you are using a mapping.
If you want to override ggplot’s default mapping, you set the palette 
explicitly:

ggplot()+geom_segment(mapping = aes(x = as.Date(test[,"date"]),
y =y1,
xend = as.Date(test[,"date"]),
yend = y2, color=co), data=testdf,
arrow=arrow()) +
  scale_color_manual(values=list(green="green"))


> On Sep 17, 2016, at 00:43, John  wrote:
> 
>> 
>> test
>dateco   y1   y2
> 5 2011-11-28 green 196.6559 1.600267
>> dput(test)
> structure(list(date = structure(15306, class = "Date"), co = "green",
>y1 = 196.655872, y2 = 1.600267), .Names = c("date", "co",
> "y1", "y2"), class = "data.frame", row.names = 5L)
>> ggplot()+geom_segment(mapping = aes(x = as.Date(test[,"date"]), y =
> y1, xend = as.Date(test[,"date"]), yend = y2, color=co), data=test,
> arrow=arrow())
> 



signature.asc
Description: Message signed with OpenPGP using GPGMail
__
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.