Re: [R] Transform a list of multiple to a data.frame which I want

2015-02-02 Thread Jim Lemon
Hi Yao,
Messy, but this is the closest I can get:

yhlist<-list(K=matrix(0,ncol=2,nrow=0),
 GSEGTCSCSSK=matrix(c(6,8),nrow=2,ncol=2),
 GFSTTCPAHVDDLTPEQVLDGDVNELMDVVLHHVPEAK=matrix(6,ncol=2,nrow=1),
 LVECIGQELIFLLPNK=matrix(6,ncol=2,nrow=1),
 NFK=matrix(0,ncol=2,nrow=0),
 HR=matrix(0,ncol=2,nrow=0),
 AYASLFR=matrix(0,ncol=2,nrow=0))

colnames(yhlist$K)<-c("start","end")
colnames(yhlist$GSEGTCSCSSK)<-c("start","end")
colnames(yhlist$GFSTTCPAHVDDLTPEQVLDGDVNELMDVVLHHVPEAK)<-c("start","end")
colnames(yhlist$LVECIGQELIFLLPNK)<-c("start","end")
colnames(yhlist$NFK)<-c("start","end")
colnames(yhlist$HR)<-c("start","end")
colnames(yhlist$AYASLFR)<-c("start","end")


crunch<-function(x) {
 start.1<-ifelse(dim(x)[1],x[1,1],NA)
 start.2<-ifelse(dim(x)[1]>1,x[2,1],NA)
 return(list(start.1,start.2))
}

crunchlist<-sapply(yhlist,crunch,simplify=TRUE)

ID<-colnames(crunchlist)
colnames(crunchlist)<-NULL

data.frame(ID,
 start.1=unlist(crunchlist[1,]),
 start.2=unlist(crunchlist[2,]))

Jim


On Sun, Feb 1, 2015 at 11:53 PM, Yao He  wrote:
> Dear all:
>
> I have a list like that,which is a standard str_locate_all() function 
> (stringr package) output:
> $K
>start end
> $GSEGTCSCSSK
>start end
> [1,] 6   6
> [2,] 8   8
> $GFSTTCPAHVDDLTPEQVLDGDVNELMDVVLHHVPEAK
>start end
> [1,] 6   6
> $LVECIGQELIFLLPNK
>start end
> [1,] 4   4
> $NFK
>start end
> $HR
>start end
> $AYASLFR
>start end
>
> I want to transform this list like that:
>
> ID   start.1  start.2
> K   NA  NA
> GSEGTCSCSSK 6 8
> GFSTTCPAHVDDLTPEQVLDGDVNELMDVVLHHVPEAK 6 NA
> LVECIGQELIFLLPNK 4 NA
> NFK NA NA
> HR NA NA
> AYASLFR NA NA
>
> I have already tried to use t() , lapply() but I think it is hard to handle 
> the NA value and different rows in every matrix
>
> Thanks in advance
>
> __
> 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] Boundaries and deldir

2015-02-02 Thread Duncan Murdoch
On 01/02/2015 10:26 PM, p_connolly wrote:
> Just what is meant by dummy points as referred to by the help for the
> deldir() function?  I understood they indicated the boundary beyond
> which triangulation would cease.

You should say what package you're asking about.  deldir() is not a base
R function.

Duncan Murdoch

> 
> I thought I would need the x/y elements (as described in the help file
> at the end of the description of the use of the dpl argument) to
> describe ad hoc dummy points as way to define a polygon or two as a
> boundary.  However, it gives this error:
> 
> Error in xd[-drop] : only 0's may be mixed with negative subscripts
> 
> Something internal is doing the negative subscripting.
> I tried ndx/ndy instead of x/y but it evidently refers only to a
> rectangle so not what I need.
> 
> Am I barking up the wrong tree altogether?  Is the boundary defined
> somewhere else entirely?  I need to get that clear before I am able to 
> provide
> useful example code.
> 
> TIA
> Patrick
> 
> __
> 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] Cross compiling R

2015-02-02 Thread Vivek Rangi
Hi!

  I am cross compiling R-3.1.2 for Galileo board with the source code. I am 
able to configure R-3.1.2 without any errors with the following command :

./configure --host=i586-poky-linux-uclibc CC=i586-poky-linux-uclibc-gcc 
CXX=i586-poky-linux-uclibc-g++ F77=i586-poky-linux-uclibc-gfortran 
CPPFLAGS=-I/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr/include/ 
LDFLAGS="-L/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr/lib/ 
--sysroot=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc" 
--prefix=/home/vivek/Smart_Tracker/R/R-3.1.2/vivek --with-readline=no 
--with-x=no


But when I am cross compiling R, I am getting following error :

i586-poky-linux-uclibc-gcc -std=gnu99 -I../../../../include -DNDEBUG 
-I../../../include -I../../../../src/include -DHAVE_CONFIG_H 
-I../../../../src/main 
-I/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr/include/   
-fvisibility=hidden -fpic  -O2 -pipe -g -feliminate-unused-debug-types  -c 
gramRd.c -o gramRd.o
i586-poky-linux-uclibc-gcc -std=gnu99 -shared 
-L/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr/lib/ 
--sysroot=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc -o tools.so 
text.o init.o Rmd5.o md5.o signals.o install.o getfmts.o http.o gramLatex.o 
gramRd.o
make[6]: Entering directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools/src'
mkdir -p -- ../../../../library/tools/libs
make[6]: Leaving directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools/src'
make[5]: Leaving directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools/src'
make[4]: Leaving directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools'
../../../bin/R: line 259: /home/vivek/Smart_Tracker/R/R-3.1.2/bin/exec/R: No 
such file or directory
make[3]: *** [all] Error 127
make[3]: Leaving directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/home/vivek/Smart_Tracker/R/R-3.1.2/src/library'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/vivek/Smart_Tracker/R/R-3.1.2/src'
make: *** [R] Error 1


"/home/vivek/Smart_Tracker/R/R-3.1.2/bin/exec/R" exits in the system. It seems 
it generates the "R" executable for the Galileo board and also, it tries to run 
the executable to generate the base packages for R. Since the "R" executable 
(/home/vivek/Smart_Tracker/R/R-3.1.2/bin/exec/R) is not for x86 system but for 
Galileo board, it is not able to execute it and hence the error.  Can somebody 
guide me as how to cross compile R?

Regards,
Vivek


::DISCLAIMER::


The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information 
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in 
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on 
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the 
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written 
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please 
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and 
other defects.



[[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] the less-than-minus gotcha

2015-02-02 Thread Jim Lemon
"Moral of story, computers do what you tell them, not what you meant."

Not only a fortune, but profound wisdom.

Jim


On Mon, Feb 2, 2015 at 12:38 PM, Kevin E. Thorpe
 wrote:
> Using = has it's problems too.
>
> For example,
>
> print(fit <- lm(...))
>
> Assigns the result of the lm call to fit and prints the results. This is
> quite a useful trick actually.
>
> print(fit = lm(...))
>
> Throws an error.
>
> Moral of story, computers do what you tell them, not what you meant.
>
> Kevin
>
> On 02/01/2015 08:26 PM, Steve Taylor wrote:
>>
>> All the more reason to use = instead of <-
>>
>>
>> -Original Message-
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ben Bolker
>> Sent: Monday, 2 February 2015 2:07p
>> To: r-h...@stat.math.ethz.ch
>> Subject: Re: [R] the less-than-minus gotcha
>>
>> Mike Miller  gmail.com> writes:
>>
>>>
>>> I've got to remember to use more spaces.  Here's the basic problem:
>>>
>>> These are the same:
>>>
>>> v< 1
>>> v<1
>>>
>>> But these are extremely different:
>>>
>>> v< -1
>>> v<-1
>>>
>>
>> This is indeed documented, in passing, in one of the pages you listed:
>>
>> http://tim-smith.us/arrgh/syntax.html
>>
>> Whitespace is meaningless, unless it isn't. Some parsing ambiguities
>> are resolved by considering whitespace around operators. See and
>> despair: x<-y (assignment) is parsed differently than x < -y (comparison)!
>>
>
>
> --
> Kevin E. Thorpe
> Head of Biostatistics,  Applied Health Research Centre (AHRC)
> Li Ka Shing Knowledge Institute of St. Michael's
> Assistant Professor, Dalla Lana School of Public Health
> University of Toronto
> email: kevin.tho...@utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016
>
>
> __
> 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] save program results and graphs to one file

2015-02-02 Thread Jim Lemon
Hi Ragia,
There are also the R2HTML and prettyR (see htmlize) packages that will
output an R session in HTML format.

Jim


On Mon, Feb 2, 2015 at 10:51 AM, Henrik Bengtsson  wrote:
> If you're happy with outputting to a multi-page PDF, then you can just
> set the default graphics device to pdf(), i.e.
>
>> options(device=pdf)
>
> and the start plotting:
>
>> plot(1:10, col=0)
>> plot(10:1, col=1)
>> plot((1:10)^2, col=2)
>> plot((10:1)^2, col=3)
>
> and at the end make sure to close the device:
>
>> dev.off()
>
> (The PDF device was automatically opened with the first plot call -
> all other figures are appended to this one.)
>
>
> This is what happens implicitly when you run a script in a
> non-interactive session, e.g.
>
> Rscript -f myscript.R
>
> That is, in that case you don't have to set the 'device' options (it's
> done for you by default) and you don't have to close it at the end,
> because that is also done for you by default.
>
> /Henrik
>
>
>
> On Sun, Feb 1, 2015 at 2:53 PM, Bert Gunter  wrote:
>> But in addition to what Jeff noted, see ?save and ?save.image
>>
>> (noting that that the resulting .Rdata file can only be read by R).
>>
>> Cheers,
>> Bert
>>
>> Bert Gunter
>> Genentech Nonclinical Biostatistics
>> (650) 467-7374
>>
>> "Data is not information. Information is not knowledge. And knowledge
>> is certainly not wisdom."
>> Clifford Stoll
>>
>>
>>
>>
>> On Sun, Feb 1, 2015 at 12:26 PM, Jeff Newmiller
>>  wrote:
>>> In general this depends what you plan to do with those results. I suspect 
>>> you are looking for something like knitr with rmarkdown (.Rmd files to 
>>> create HTML or Word) or LaTeX (.Rnw files to create PDF).
>>> ---
>>> Jeff NewmillerThe .   .  Go Live...
>>> DCN:Basics: ##.#.   ##.#.  Live Go...
>>>   Live:   OO#.. Dead: OO#..  Playing
>>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>>> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
>>> ---
>>> Sent from my phone. Please excuse my brevity.
>>>
>>> On February 1, 2015 12:05:47 PM PST, Ragia Ibrahim  
>>> wrote:

Dear group,

I have many plots and numeric results in my R program,  kindly how can
I save them all sequently on one file.
thanks in advance
RAI

   [[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.
>
> __
> 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] save program results and graphs to one file

2015-02-02 Thread Sergio Fonda
With a little effort you could implement Rstudio and try RMD (R Markdown)
it is very proficient, look at
https://support.rstudio.com/hc/en-us/articles/200552086-Using-R-Markdown
Il 01/feb/2015 21:07 "Ragia Ibrahim"  ha scritto:

>
> Dear group,
>
> I have many plots and numeric results in my R program,  kindly how can I
> save them all sequently on one file.
> thanks in advance
> RAI
>
> [[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] Cross compiling R

2015-02-02 Thread Prof Brian Ripley
Cross-building is not supported (building R is more than just compiling 
and needs a working R executable).


And (see the posting guide) this was not the right list for such a question.

On 02/02/2015 07:16, Vivek Rangi wrote:

Hi!

   I am cross compiling R-3.1.2 for Galileo board with the source code. I 
am able to configure R-3.1.2 without any errors with the following command :

./configure --host=i586-poky-linux-uclibc CC=i586-poky-linux-uclibc-gcc 
CXX=i586-poky-linux-uclibc-g++ F77=i586-poky-linux-uclibc-gfortran 
CPPFLAGS=-I/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr/include/ 
LDFLAGS="-L/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr/lib/ 
--sysroot=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc" 
--prefix=/home/vivek/Smart_Tracker/R/R-3.1.2/vivek --with-readline=no --with-x=no


But when I am cross compiling R, I am getting following error :

i586-poky-linux-uclibc-gcc -std=gnu99 -I../../../../include -DNDEBUG 
-I../../../include -I../../../../src/include -DHAVE_CONFIG_H 
-I../../../../src/main 
-I/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr/include/   
-fvisibility=hidden -fpic  -O2 -pipe -g -feliminate-unused-debug-types  -c 
gramRd.c -o gramRd.o
i586-poky-linux-uclibc-gcc -std=gnu99 -shared 
-L/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc/usr/lib/ 
--sysroot=/opt/clanton-tiny/1.4.2/sysroots/i586-poky-linux-uclibc -o tools.so 
text.o init.o Rmd5.o md5.o signals.o install.o getfmts.o http.o gramLatex.o 
gramRd.o
make[6]: Entering directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools/src'
mkdir -p -- ../../../../library/tools/libs
make[6]: Leaving directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools/src'
make[5]: Leaving directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools/src'
make[4]: Leaving directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools'
../../../bin/R: line 259: /home/vivek/Smart_Tracker/R/R-3.1.2/bin/exec/R: No 
such file or directory
make[3]: *** [all] Error 127
make[3]: Leaving directory 
`/home/vivek/Smart_Tracker/R/R-3.1.2/src/library/tools'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/home/vivek/Smart_Tracker/R/R-3.1.2/src/library'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/vivek/Smart_Tracker/R/R-3.1.2/src'
make: *** [R] Error 1


"/home/vivek/Smart_Tracker/R/R-3.1.2/bin/exec/R" exits in the system. It seems it generates the 
"R" executable for the Galileo board and also, it tries to run the executable to generate the base 
packages for R. Since the "R" executable (/home/vivek/Smart_Tracker/R/R-3.1.2/bin/exec/R) is not 
for x86 system but for Galileo board, it is not able to execute it and hence the error.  Can somebody guide 
me as how to cross compile R?

Regards,
Vivek



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

__
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] Boundaries and deldir

2015-02-02 Thread Rolf Turner


On 02/02/15 16:26, p_connolly wrote:


Just what is meant by dummy points as referred to by the help for the
deldir() function?  I understood they indicated the boundary beyond
which triangulation would cease.

I thought I would need the x/y elements (as described in the help file
at the end of the description of the use of the dpl argument) to
describe ad hoc dummy points as way to define a polygon or two as a
boundary.  However, it gives this error:

Error in xd[-drop] : only 0's may be mixed with negative subscripts

Something internal is doing the negative subscripting.
I tried ndx/ndy instead of x/y but it evidently refers only to a
rectangle so not what I need.

Am I barking up the wrong tree altogether?  Is the boundary defined
somewhere else entirely?  I need to get that clear before I am able to
provide
useful example code.


The dummy points have nothing to do with any "boundary".  In fact they 
have nothing much to do with anything, really! :-)  They are a hangover 
from the original purpose of deldir which was to assist in a numerical 
integration needed for the maximum likelihood estimation of the 
intensity function of an inhomogeneous Poisson process.  I really should 
get rid of them, but that would require a bit of work and re-writing of 
code and help files, and they do no real harm so I have decided to apply 
the "If it ain't broke don't fix it." principle.


The deldir function creates a Delaunay triangulation/Dirichlet 
tessellation inside a "rectangular window" (denoted by "rw" in the 
argument list).  This is the only boundary invoked or involved.


The function plot.tile.list() will *plot* the Dirichlet tessellation 
"clipped" to a specified polygon.  But that is just for *plotting*.  I 
am not sure that I really understand the idea of a "boundary beyond 
which the triangulation ceases".  The Delaunay triangulation is a finite
structure; its outer boundary is the convex hull of the set of points 
being triangulated.  You cannot confine it to a smaller region without 
losing some of those points.


If you can explain what you really want to do, perhaps I can help.

cheers,

Rolf

--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

__
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] the less-than-minus gotcha

2015-02-02 Thread Rolf Turner


On 02/02/15 14:26, Steve Taylor wrote:


All the more reason to use = instead of <-


Couldn't agree less, Steve. The "<-" should be used for assignment. The 
"=" sign should be reserved for handling function arguments in the 
"name=value" form.  Doing anything else invites confusion and 
occasionally chaos.


Lots of examples have been given in the past involving syntax of the 
form foo(x = y) and foo(x <- y).


cheers,

Rolf

--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

__
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] aov and Error function

2015-02-02 Thread S Ellison

> > aovsubj <- aov(value~group+time+Error(subject),data=dataRMANOVA)
> > and
> > aovsubjgroup <- aov(value~group+time+Error(subject/group),data=dataRMANOVA)
> >
> Since no-one else seems to have answered you let me point out that your first
> formulation treats subject 1 in the "int" group as being the same as subject 
> 1 in
> the "cont" group, and similarly for subject 2 and so on.
> 
> The second formulation (subject nested within group) treats subject 1 in the
> "int" group as being *different* from subject 1 in the "cont" group.

Yes, but that isn't all, is it? 

subject/group

means group nested in subject, expanding to 
~subject+subject:group.

so Error(subject/group) asks for a subject effect across groups _as well as_ 
one within groups.

S Ellison


***
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] the less-than-minus gotcha

2015-02-02 Thread peter dalgaard
I'd rather say that it is good reason to use spaces around operators. Makes the 
code easier to read too. (_Possible_ to read for some.)

We've probably all done it. I did, once upon a time in S-Plus, on the results 
of a multi-day simulation study:

> <>$statistic
[1] -1.28
> sim <- sapply(1:1, <>$statistic)
.
. leave running
.
> mean(sim<-1.28) # get empirical p-value
[1] 1.28

??!?...  Uh-oh.

On 02 Feb 2015, at 02:26 , Steve Taylor  wrote:

> All the more reason to use = instead of <-
> 
> 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
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] aov and Error function

2015-02-02 Thread peter dalgaard

On 02 Feb 2015, at 13:09 , S Ellison  wrote:

> 
>>> aovsubj <- aov(value~group+time+Error(subject),data=dataRMANOVA)
>>> and
>>> aovsubjgroup <- aov(value~group+time+Error(subject/group),data=dataRMANOVA)
>>> 
>> Since no-one else seems to have answered you let me point out that your first
>> formulation treats subject 1 in the "int" group as being the same as subject 
>> 1 in
>> the "cont" group, and similarly for subject 2 and so on.
>> 
>> The second formulation (subject nested within group) treats subject 1 in the
>> "int" group as being *different* from subject 1 in the "cont" group.
> 
> Yes, but that isn't all, is it? 
> 
> subject/group
> 
> means group nested in subject, expanding to 
> ~subject+subject:group.
> 
> so Error(subject/group) asks for a subject effect across groups _as well as_ 
> one within groups.
> 


Or maybe more usefully stated, a group effect within subjects. This could be 
relevant if each individual goes to two different groups labeled say 1 and 2, 
but the groups are not related between different subjects (subj.1 attends AA 
and Boy Scouts, subj 2 School Board and Church, etc.) so there is no main 
effect of group. In statistics, it is usually the other way around: subjects 
arbitrarily numbered 1-20 within each group, but no relation between "subj.1" 
in one group and "subj.2" of the other, in which case ~group + 
Error(group:subject) makes sense. 


> S Ellison
> 
> 
> ***
> This email and any attachments are confidential. Any =...{{dropped:24}}

__
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] the less-than-minus gotcha

2015-02-02 Thread Ted Harding
On 02-Feb-2015 11:58:10 Rolf Turner wrote:
> 
> On 02/02/15 14:26, Steve Taylor wrote:
> 
>> All the more reason to use = instead of <-
> 
> Couldn't agree less, Steve. The "<-" should be used for assignment. The 
> "=" sign should be reserved for handling function arguments in the 
> "name=value" form.  Doing anything else invites confusion and 
> occasionally chaos.
> 
> Lots of examples have been given in the past involving syntax of the 
> form foo(x = y) and foo(x <- y).
> 
> cheers,
> Rolf
> -- 
> Rolf Turner

As well as agreering with Rolf, it should also be said that Steve's
advice "All the more reason to use = instead of <-" is not applicable
in this context, which was:

  which( frame$var>4 )   # no problem
  which( frame$var<-4 )  # huge problem: frame$var is destroyed

There is no place for an "=" here!

What does not seems to have been mentioned so far is that this
kind of thing can be safely wrapped in parentheses:

  which( frame$var>4 )# no problem oper
  which( frame$var<(-4) ) # [again no problem]

Personally, I'm prone to using parentheses if I have any feeling
that a "gotcha" may be lurking -- not only in the distinction
between "var<-4" and "var< -4", but also to be confident that,
for instance, my intentions are not being over-ridden by operator
precedence rules.

Some people object to code "clutter" from parentheses that could
be more simply replaced (e.g. "var< -4" instead of "var<(-4)"),
but parentheses ensure that it's right and also make it clear
when one reads it.

Best wishes to all,
Ted.

-
E-Mail: (Ted Harding) 
Date: 02-Feb-2015  Time: 12:43:51
This message was sent by XFMail

__
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] the less-than-minus gotcha

2015-02-02 Thread Robert Douglas Kinley

Rolf Turner is right on the money about not mixing-up '=' and '<-'

Though this 'gotcha' will always a threat while  '<-'  is the assignment 
operator.

The old Algol60 syntax of ':=' was less error-prone, but I guess '<-' is too 
firmly bedded-in to ever change.

Meanwhile, spaces around the assignment operator gives less error-prone and 
more readable code.

cheers  Bob Kinley  

_

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rolf Turner
Sent: 02 February 2015 11:58
To: Steve Taylor; r-h...@stat.math.ethz.ch
Subject: Re: [R] the less-than-minus gotcha


On 02/02/15 14:26, Steve Taylor wrote:

> All the more reason to use = instead of <-

Couldn't agree less, Steve. The "<-" should be used for assignment. The "=" 
sign should be reserved for handling function arguments in the "name=value" 
form.  Doing anything else invites confusion and occasionally chaos.

Lots of examples have been given in the past involving syntax of the form foo(x 
= y) and foo(x <- y).

cheers,

Rolf

--
Rolf Turner
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

__
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] Error: OutOfMemoryError (Java): GC overhead limit exceeded

2015-02-02 Thread Yuan, Rebecca
Hello all,

When I met this following error message:

Error: OutOfMemoryError (Java): GC overhead limit exceeded

I usually use the following options to overcome the memory limit:

options(java.parameters = "-Xmx1024m") # to reduce the error message "Error: 
OutOfMemoryError (Java): GC overhead limit exceeded"

However, this seems not working any more, is there any other way to help 
avoiding the memory error issue in R?

Thanks very much!

Cheers,

Rebecca



20

--
This message, and any attachments, is for the intended r...{{dropped:5}}

__
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] naming rows/columns in 'array of matrices'

2015-02-02 Thread Adams, Jean
In your example, P is a three dimensional array.  You can assign names to
the three dimensions using the dimnames() function.  For example, this
command assigns names to the first two dimensions, but leaves the third
dimension without names.

dimnames(P) <- list(c("live", "dead"), c("live", "dead"), NULL)

Jean

On Fri, Jan 30, 2015 at 1:07 PM, Evan Cooch  wrote:

> Suppose I have the following situation:
>
> I have an array of 2 matrices, where each matrix is (2x2):
>
> P <- array(0, c(2,2,2))
>
> P[,,1] <- matrix(c(1,2,3,4),2,2,byrow=T);
> P[,,2] <- matrix(c(5,6,7,8),2,2,byrow=T);
>
> I want to label rows and columns of each matrix in the array, such that P
> would look like
>
>
> live dead
> live  12
> dead  34
>
> , , 2
>
> live  dead
>  live 56
>  dead 78
>
> I've tried 'direct, brute force" approaches like
>
> rownames(P[,,1]) <- c("live","dead")
> colnames(P[,,1]) <- c("live","dead")
>
> (repeated for the second matrix), but this doesn't work.
>
> Since all of the matrices are of the same dimension(s), and since I want
> the same rownames and colnames for each matrix, I'm hoping there is some
> simply magical permutation of lapply (I'm guessing) which will do the trick.
>
>  I'd also be interested in why the 'direct, brute force' approach (above)
> doesn't work, and what does, since I might need to manipulate row/col names
> for individual matrices in the array (if, say, dimensions of the matrices
> were not the same over the array).
>
> Thanks in advance!
>
> __
> 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] Error: OutOfMemoryError (Java): GC overhead limit exceeded

2015-02-02 Thread Jeff Newmiller
The memory issue is in Java, not R.

You can either be more parsimonious in your use of Java memory (we have no idea 
what you are doing with it here, so how you do that is up to you), or you can 
allocate more memory to Java (you may be able to guess how to do that, or read 
the Java documentation on the X parameter).
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 2, 2015 5:43:50 AM PST, "Yuan, Rebecca" 
 wrote:
>Hello all,
>
>When I met this following error message:
>
>Error: OutOfMemoryError (Java): GC overhead limit exceeded
>
>I usually use the following options to overcome the memory limit:
>
>options(java.parameters = "-Xmx1024m") # to reduce the error message
>"Error: OutOfMemoryError (Java): GC overhead limit exceeded"
>
>However, this seems not working any more, is there any other way to
>help avoiding the memory error issue in R?
>
>Thanks very much!
>
>Cheers,
>
>Rebecca
>
>
>
>20
>
>--
>This message, and any attachments, is for the intended
>r...{{dropped:5}}
>
>__
>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] Error: OutOfMemoryError (Java): GC overhead limit exceeded

2015-02-02 Thread jim holtman
On the off-chance, are you using XLConnect or xlsx packages that are using
Java to access the spreadsheets?  If it is XLConnect, are you access the
'.xlsx' style workbooks?  If so, can you try using '.xls' workbooks?  This
is a problem that I have had; the '.xlsx' workbooks take a lot more
resources (CPU and memory) to process.

A little more information like what your sessionInfo is would help a lot in
responding to your problem.


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 Mon, Feb 2, 2015 at 9:27 AM, Jeff Newmiller 
wrote:

> The memory issue is in Java, not R.
>
> You can either be more parsimonious in your use of Java memory (we have no
> idea what you are doing with it here, so how you do that is up to you), or
> you can allocate more memory to Java (you may be able to guess how to do
> that, or read the Java documentation on the X parameter).
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live
> Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
> Sent from my phone. Please excuse my brevity.
>
> On February 2, 2015 5:43:50 AM PST, "Yuan, Rebecca" <
> rebecca.y...@bankofamerica.com> wrote:
> >Hello all,
> >
> >When I met this following error message:
> >
> >Error: OutOfMemoryError (Java): GC overhead limit exceeded
> >
> >I usually use the following options to overcome the memory limit:
> >
> >options(java.parameters = "-Xmx1024m") # to reduce the error message
> >"Error: OutOfMemoryError (Java): GC overhead limit exceeded"
> >
> >However, this seems not working any more, is there any other way to
> >help avoiding the memory error issue in R?
> >
> >Thanks very much!
> >
> >Cheers,
> >
> >Rebecca
> >
> >
> >
> >20
> >
> >--
> >This message, and any attachments, is for the intended
> >r...{{dropped:5}}
> >
> >__
> >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] naming rows/columns in 'array of matrices'

2015-02-02 Thread S Ellison
> >  I'd also be interested in why the 'direct, brute force' approach
> > (above) doesn't work,
Your example was a 3-dimensional array, so 
> rownames(P) <- colnames(P) <- c(live', 'dead') 
would have worked; rownames() and colnames() work on dimnames[1] and 
dimnames[2].

But 
rownames(P[,,1])
could not have worked, because you were not assigning to the names of P; you 
were assigning to something (P[,,1]) extracted from P. In effect, you were 
doing the equivalent of
{P1 <- P[,,1]
rownames(P1) <- c('live', 'dead')
rm(P1)}


> > ... since I might need to manipulate
> > row/col names for individual matrices in the array (if, say,
> > dimensions of the matrices were not the same over the array).
If the dimension are different you will not have an array; you'd have to have a 
list of matrices. 
You could then use lapply for the one constant dimension size; for example, 

lp <- list(P22 = matrix(ncol=2, nrow=2), P32= matrix(ncol=2, nrow=3))

lapply(lp, function(x, cn=c('live', 'dead')) {colnames(x)<-cn; x})

Other than that, you'd either have to do some careful conditional coding or 
apply names manually.

S


***
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] the less-than-minus gotcha

2015-02-02 Thread Martin Maechler

> All the more reason to use = instead of <-

Definitely not!

(As you were told, there are other drawbacks).

R does not have to look like C, it *is* different in many ways.
If you use a decent IDE for R, you get spaces around ' <- ' for
free: Both in ESS and in Rstudio, you can use   "[Alt] -"  
to produce the 4 characters ' <- '

{ [Alt] + "-") is called 'M--' in ESS / emacs which has even
  more options for " <- " and is fully configurable in its key
  bindings anyway. }

The '=' character has many uses in R  and using  ' <- '
for assignment makes the code "more expressive": It makes sense
to highlight the assignment op, but is a bit stupid to
highlight all "=" signs.  Further it can be nicely marked up by
a real "left arrow" by e.g. the listings LaTeX 
'listings' package, or the (oldish) 'a2ps'  GNU software.

Further, assignment is not commutative, and hence, 
there is a corresponding ` -> `  operator,
whereas the '=' is a commutative operator in mathematics, but
not when used as assignment op.

[ yes: "Flame war is on.  I'll stop reading R-help for a while.."
  ;-) ;-) ]


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ben Bolker
> Sent: Monday, 2 February 2015 2:07p
> To: r-h...@stat.math.ethz.ch
> Subject: Re: [R] the less-than-minus gotcha

> Mike Miller  gmail.com> writes:

> > 
> > I've got to remember to use more spaces.  Here's the basic problem:
> > 
> > These are the same:
> > 
> > v< 1
> > v<1
> > 
> > But these are extremely different:
> > 
> > v< -1
> > v<-1
> > 

> This is indeed documented, in passing, in one of the pages you listed:

> http://tim-smith.us/arrgh/syntax.html

> Whitespace is meaningless, unless it isn't. Some parsing ambiguities 
> are resolved by considering whitespace around operators. See and
> despair: x<-y (assignment) is parsed differently than x < -y (comparison)!

__
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] (Cross-)validating GLM including factors

2015-02-02 Thread Roland Pape
Dear list,

I would like to validate various GLMs, all of them containing (among others) 
several factors as predictors. I thought about using cv.glm from the boot 
package, but necessarily got the error "factor xy has new level z". Is there 
any function to easily cross validate LMs or GLMs containing factors that I 
have missed, or any other work around?
- Having in mind that using cross validation on a small data set is not the 
best solution (I have 50-600 samples, but also three factors with up to 15 
levels): Are there any other approaches?

Any help is greatly appreciated!

Roland

[[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] (Cross-)validating GLM including factors

2015-02-02 Thread Bert Gunter
This is not an r-help issue. Post on a statistics list like
stats.stackexchange.com instead for a variety of opinions.*

Cheers,
Bert

*Which will probably be useless given your paucity of data. But that's
just *my* useless opinion.

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll




On Mon, Feb 2, 2015 at 6:36 AM, Roland Pape
 wrote:
> Dear list,
>
> I would like to validate various GLMs, all of them containing (among others) 
> several factors as predictors. I thought about using cv.glm from the boot 
> package, but necessarily got the error "factor xy has new level z". Is there 
> any function to easily cross validate LMs or GLMs containing factors that I 
> have missed, or any other work around?
> - Having in mind that using cross validation on a small data set is not the 
> best solution (I have 50-600 samples, but also three factors with up to 15 
> levels): Are there any other approaches?
>
> Any help is greatly appreciated!
>
> Roland
>
> [[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] Transform a list of multiple to a data.frame which I want

2015-02-02 Thread William Dunlap
Does the following work for you.  The only trick is working around the fact
that matrix subscripting does not allow out-of-bounds subscripts but vector
subscripting does.  We do the subscripting in two steps, relying on the
drop=TRUE default in the matrix subscripting operator that converts the
single-
column matrix output to a vector.

> txt <- c("abc", "abcade", "xyz", "abacad")
> sTxt <- str_locate_all(txt, "a")
> lTxt <- lapply(sTxt, function(st)structure(st[,1][1:2],
names=c("start.1", "start.2")))
> names(lTxt) <- txt
> str(lTxt)
List of 4
 $ abc   : Named int [1:2] 1 NA
  ..- attr(*, "names")= chr [1:2] "start.1" "start.2"
 $ abcade: Named int [1:2] 1 4
  ..- attr(*, "names")= chr [1:2] "start.1" "start.2"
 $ xyz   : Named num [1:2] NA NA
  ..- attr(*, "names")= chr [1:2] "start.1" "start.2"
 $ abacad: Named int [1:2] 1 3
  ..- attr(*, "names")= chr [1:2] "start.1" "start.2"


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Sun, Feb 1, 2015 at 4:53 AM, Yao He  wrote:

> Dear all:
>
> I have a list like that,which is a standard str_locate_all()
> function (stringr package) output:
> $K
>start end
> $GSEGTCSCSSK
>start end
> [1,] 6   6
> [2,] 8   8
> $GFSTTCPAHVDDLTPEQVLDGDVNELMDVVLHHVPEAK
>start end
> [1,] 6   6
> $LVECIGQELIFLLPNK
>start end
> [1,] 4   4
> $NFK
>start end
> $HR
>start end
> $AYASLFR
>start end
>
> I want to transform this list like that:
>
> ID   start.1  start.2
> K   NA  NA
> GSEGTCSCSSK 6 8
> GFSTTCPAHVDDLTPEQVLDGDVNELMDVVLHHVPEAK 6 NA
> LVECIGQELIFLLPNK 4 NA
> NFK NA NA
> HR NA NA
> AYASLFR NA NA
>
> I have already tried to use t() , lapply() but I think it is hard to
> handle the NA value and different rows in every matrix
>
> Thanks in advance
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


[R] Multiple Line Widths denextend

2015-02-02 Thread Worthington, Thomas A
Dear All 

We are using the dendextend package to modify the plot output from a pvclust 
clustering 

The model is created with 

result <- pvclust(chord.1, method.dist="euclidian", 
method.hclust="average",nboot=10)

The plot is then formatted as following 

dend <- as.dendrogram(result)
dend %>%
pvclust_show_signif(result, signif_type = c("au"),alpha=0.05, signif_value = 
c(4, 1)) %>% set("labels_cex", c(1.5)) %>% set("labels_col", sp_col) %>% 
plot(horiz=TRUE, sub="", xlab="", ylab="",xlim=c(0.31, -0.17), ylim= c(3.5,93))

We are using the pvclust_show_signif function to set the line weight to '4' of 
pvclust branches with an alpha of less than 0.05. Is it possible to set 
multiple line weights for different alpha values e.g. lwd = 8 when alpha = 0.05 
and lwd = 4 when alpha = 0.1?

Best wishes
Tom 

__
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] FFT Normalization Documentation

2015-02-02 Thread Eike Petersen
Hello everyone,

the docpage for the fft function states:

“Description: Performs the Fast Fourier Transform of an array.”

and

“Arguments – inverse: if ‘TRUE’, the unnormalized inverse transform is computed
(the inverse has a ‘+’ in the exponent of e, but here, we do _not_ divide by
‘1/length(x)’).”

Judging from this, I would expect ‘fft(x)’ to yield the correct FFT of x, and
‘fft(X, inverse = TRUE) / length(X)’ to yield the correct inverse FFT of X.

However, it seems to me that actually the result of ‘fft(x)’ should be scaled by
‘1/length(x)’, while ‘fft(X, inverse=TRUE)’ seems to yield a correct result by
default:

t <- seq(0.001, 1, 0.001)
y <- 1 + sin(2*pi*20*t) + 1.5 * sin(2*pi*30*t)
Y <- fft(y)
dev.new()
plot(abs(Y)) ## Shows peaks at amplitudes 1000, 500 and 750, while they should
be at amplitude 1, 0.5 and 0.75.
y2 <- Re(fft(Y / length(Y), inverse = TRUE))
max(abs(y-y2)) ## The IFFT yields a correctly scaled result by default, if
applied to a correctly scaled FFT.

Did I get something wrong? If not, having spent quite some time figuring this
out, I would like to see the documentation clearly pointing this out. I find the
current text rather confusing.

On another note: I have spent some time working on demo files that showcase some
of the properties of the FFT and their implementation in R. I have done this
primarily for myself, as I keep forgetting how these things work, but I thought
that it might be helpful to others as well. Any hints on where/how I should
publish such a thing?

Kind regards and many thanks in advance,

Eike

__
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 plotting my data

2015-02-02 Thread JS Huang
Hi,

   I hope the following works for you.  The plot is:  Rplot.png
  

> data <- read.table("rHelp_20150202.txt",header=TRUE)
> order.data <- order(data$counts,decreasing=TRUE)
> order.data
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29
> plot(data$counts ~ factor(data$role,levels=data$role[order.data]))





--
View this message in context: 
http://r.789695.n4.nabble.com/help-plotting-my-data-tp4702583p4702679.html
Sent from the R help mailing list archive at Nabble.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] Dropping time series observations

2015-02-02 Thread JS Huang
Hi,

I have a data frame named data and with the statement
data[5:length(data[[1]]),] I can get row 5 to the end of the data.

> data
   role counts
1 Agent220
2 Theme169
3   Patient 67
4  Location 41
5   Destination 32
6 Recipient 31
7Result 29
8Instrument 27
9Source 25
10  Experiencer 22
11Topic 22
12 Stimulus 18
13Attribute 15
14  Beneficiary 12
15 Initial_Location 12
16 Co-Agent 11
17   Co-Patient 11
18 Co-Theme  9
19 Goal  9
20Asset  7
21Cause  6
22 Material  5
23Value  5
24  Product  4
25Predicate  3
26   Trajectory  3
27   Extent  2
28 Time  2
29Reflexive  1
> data[5:length(data[[1]]),]
   role counts
5   Destination 32
6 Recipient 31
7Result 29
8Instrument 27
9Source 25
10  Experiencer 22
11Topic 22
12 Stimulus 18
13Attribute 15
14  Beneficiary 12
15 Initial_Location 12
16 Co-Agent 11
17   Co-Patient 11
18 Co-Theme  9
19 Goal  9
20Asset  7
21Cause  6
22 Material  5
23Value  5
24  Product  4
25Predicate  3
26   Trajectory  3
27   Extent  2
28 Time  2
29Reflexive  1



--
View this message in context: 
http://r.789695.n4.nabble.com/Dropping-time-series-observations-tp4702589p4702680.html
Sent from the R help mailing list archive at Nabble.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] using png and identify commands

2015-02-02 Thread Antonio Silva
Hi R users

I want to save a plot after using the command identify.

I use identify to place labels manually near the points in order to avoid
overlapping lines and numbers.

x<-c(1,2,3,4,5,6)
y<-c(20,30,15,7,25,40)
plot(x,y,type="b",ylim=c(0,45))
identify(x,y,labels=y)

But when I add

png(filename="test.png",width=20,height=20,units="cm",res=300)
x<-c(1,2,3,4,5,6)
y<-c(20,30,15,7,25,40)
plot(x,y,type="b",ylim=c(0,45))
identify(x,y,labels=y)
dev.off()

The plot is saved directly, without the identification of the points.My
question is: how to save the plot only after having labelled the points.

I use R integrated to gedit in UBUNTU Trusty Tahr 64 bits. I'd like to save
the plot using command lines and not GUIs

Thanks for any help. Best regards,

Antonio Olinto

[[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] Error: OutOfMemoryError (Java): GC overhead limit exceeded

2015-02-02 Thread Yuan, Rebecca
Hello Jim,

I already use “.xls” for the loading, but still have the memory issue….

Thanks,

Rebecca


From: jim holtman [mailto:jholt...@gmail.com]
Sent: Monday, February 02, 2015 10:21 AM
To: Jeff Newmiller
Cc: Yuan, Rebecca; R help (r-help@r-project.org)
Subject: Re: [R] Error: OutOfMemoryError (Java): GC overhead limit exceeded

On the off-chance, are you using XLConnect or xlsx packages that are using Java 
to access the spreadsheets?  If it is XLConnect, are you access the '.xlsx' 
style workbooks?  If so, can you try using '.xls' workbooks?  This is a problem 
that I have had; the '.xlsx' workbooks take a lot more resources (CPU and 
memory) to process.

A little more information like what your sessionInfo is would help a lot in 
responding to your problem.


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 Mon, Feb 2, 2015 at 9:27 AM, Jeff Newmiller 
mailto:jdnew...@dcn.davis.ca.us>> wrote:
The memory issue is in Java, not R.

You can either be more parsimonious in your use of Java memory (we have no idea 
what you are doing with it here, so how you do that is up to you), or you can 
allocate more memory to Java (you may be able to guess how to do that, or read 
the Java documentation on the X parameter).
---
Jeff NewmillerThe .   .  Go Live...
DCN:mailto:jdnew...@dcn.davis.ca.us>>Basics: 
##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.

On February 2, 2015 5:43:50 AM PST, "Yuan, Rebecca" 
mailto:rebecca.y...@bankofamerica.com>> wrote:
>Hello all,
>
>When I met this following error message:
>
>Error: OutOfMemoryError (Java): GC overhead limit exceeded
>
>I usually use the following options to overcome the memory limit:
>
>options(java.parameters = "-Xmx1024m") # to reduce the error message
>"Error: OutOfMemoryError (Java): GC overhead limit exceeded"
>
>However, this seems not working any more, is there any other way to
>help avoiding the memory error issue in R?
>
>Thanks very much!
>
>Cheers,
>
>Rebecca
>
>
>
>20
>
>--
>This message, and any attachments, is for the intended
>r...{{dropped:5}}
>
>__
>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.


--
This message, and any attachments, is for the intended recipient(s) only, may 
contain information that is privileged, confidential and/or proprietary and 
subject to important terms and conditions available at 
http://www.bankofamerica.com/emaildisclaimer.   If you are not the intended 
recipient, please delete this message.

[[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] Error: OutOfMemoryError (Java): GC overhead limit exceeded

2015-02-02 Thread jim holtman
How big are the worksheets that you are reading in?  Do you have multiple
ones open at the same time?  Have to tried to use 'xlcFreeMemory' to see if
this helps?  How much RAM to you have on your system?


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 Mon, Feb 2, 2015 at 1:11 PM, Yuan, Rebecca <
rebecca.y...@bankofamerica.com> wrote:

>  Hello Jim,
>
>
>
> I already use “.xls” for the loading, but still have the memory issue….
>
>
>
> Thanks,
>
>
>
> Rebecca
>
>
>
>
>
> *From:* jim holtman [mailto:jholt...@gmail.com]
> *Sent:* Monday, February 02, 2015 10:21 AM
> *To:* Jeff Newmiller
> *Cc:* Yuan, Rebecca; R help (r-help@r-project.org)
> *Subject:* Re: [R] Error: OutOfMemoryError (Java): GC overhead limit
> exceeded
>
>
>
> On the off-chance, are you using XLConnect or xlsx packages that are using
> Java to access the spreadsheets?  If it is XLConnect, are you access the
> '.xlsx' style workbooks?  If so, can you try using '.xls' workbooks?  This
> is a problem that I have had; the '.xlsx' workbooks take a lot more
> resources (CPU and memory) to process.
>
>
>
> A little more information like what your sessionInfo is would help a lot
> in responding to your problem.
>
>
>
> 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 Mon, Feb 2, 2015 at 9:27 AM, Jeff Newmiller 
> wrote:
>
> The memory issue is in Java, not R.
>
> You can either be more parsimonious in your use of Java memory (we have no
> idea what you are doing with it here, so how you do that is up to you), or
> you can allocate more memory to Java (you may be able to guess how to do
> that, or read the Java documentation on the X parameter).
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live
> Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
> Sent from my phone. Please excuse my brevity.
>
> On February 2, 2015 5:43:50 AM PST, "Yuan, Rebecca" <
> rebecca.y...@bankofamerica.com> wrote:
> >Hello all,
> >
> >When I met this following error message:
> >
> >Error: OutOfMemoryError (Java): GC overhead limit exceeded
> >
> >I usually use the following options to overcome the memory limit:
> >
> >options(java.parameters = "-Xmx1024m") # to reduce the error message
> >"Error: OutOfMemoryError (Java): GC overhead limit exceeded"
> >
> >However, this seems not working any more, is there any other way to
> >help avoiding the memory error issue in R?
> >
> >Thanks very much!
> >
> >Cheers,
> >
> >Rebecca
> >
> >
> >
> >20
> >
> >--
> >This message, and any attachments, is for the intended
> >r...{{dropped:5}}
> >
> >__
> >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.
>
>
>  --
> This message, and any attachments, is for the intended...{{dropped:11}}

__
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] rJava Scientific Linux 6.5 - Can not install

2015-02-02 Thread stephen sefick
Hello all,

I am having a problem with installing rJava on SL 6.5. I am having compile
errors when I try to from CRAN using install.packages("XLConnect", repos="
http://cran.rstudio.com/";). I can provide anything necessary, but I am
unsure what to provide. Thank you for your help in advance.

output of sessionInfo():
R version 3.1.0 Patched (2014-06-15 r65949)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.utf8   LC_NUMERIC=C
 [3] LC_TIME=en_US.utf8LC_COLLATE=en_US.utf8
 [5] LC_MONETARY=en_US.utf8LC_MESSAGES=en_US.utf8
 [7] LC_PAPER=en_US.utf8   LC_NAME=C
 [9] LC_ADDRESS=C  LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] graphics  grDevices utils datasets  stats methods   base

other attached packages:
[1] devtools_1.7.0 ggplot2_1.0.0

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.8 grid_3.1.0   gtable_0.1.2
 [5] MASS_7.3-37  munsell_0.4.2plyr_1.8.1   proto_0.3-10
 [9] Rcpp_0.11.4  reshape2_1.4.1   scales_0.2.4 stringr_0.6.2
[13] tools_3.1.0



-- 
Stephen Sefick
**
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**

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] How to enable https for R 3.1.2 on windows 8.1

2015-02-02 Thread Jeff Newmiller
Cc'd back to the list... I am a bad bet for one-on-one help.

Showing that your libcurl claims to support HTTPS is progress. I think that at 
this point you should read the last sentence in the curl FAQ 3.21, which I 
found by searching for "protocol https not supported or disabled in libcurl".

http://curl.haxx.se/docs/faq.html
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 2, 2015 9:21:05 AM PST, John Kalb  wrote:
>Honestly.  I ran the search you suggested and didn't find anything that
>helped.  I did come across the curlVersion function and ran it right
>after
>receiving the error message.  It seems to indicate that https is
>available.  I don't see a way forward.
>
>Error in function (type, msg, asError = TRUE)  :
>  Protocol " https" not supported or disabled in libcurl
>> curlVersion()$protocol
>[1] "dict"   "file"   "ftp""ftps"   "gopher" "http"   "https" 
>"imap"
>  "imaps"  "ldap"
>[11] "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp""sftp"   "smtp"  
>"smtps"
> "telnet" "tftp"
>
>On Sun, Feb 1, 2015 at 1:58 PM, Jeff Newmiller
>
>wrote:
>
>> Honestly? Did you try "rcurl https windows" (without the quotes)?
>>
>---
>> Jeff NewmillerThe .   .  Go
>Live...
>> DCN:Basics: ##.#.   ##.#.  Live
>> Go...
>>   Live:   OO#.. Dead: OO#.. 
>Playing
>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>> /Software/Embedded Controllers)   .OO#.   .OO#. 
>rocks...1k
>>
>---
>> Sent from my phone. Please excuse my brevity.
>>
>> On February 1, 2015 8:56:00 AM PST, John Kalb 
>wrote:
>> >I run the code below successfully on Mac and Ubuntu successfully.
>> >When I run on Windows, I get the results shown.  How do I get the
>code
>> >to work on Windows? I've googled extensively with no success. Thanks
>> >in advance.
>> >
>> >require(twitteR)
>> >
>> >Loading required package: twitteR
>> >Loading required package: ROAuth
>> >Loading required package: RCurl
>> >Loading required package: bitops
>> >Loading required package: rjson
>> >> cred <- OAuthFactory $ new( consumerKey = my.key, consumerSecret =
>> >my.secret, requestURL =' https:// api.twitter.com/ oauth/
>> >request_token', accessURL =' https:// api.twitter.com/ oauth/
>> >access_token', authURL =' https:// api.twitter.com/ oauth/
>authorize')
>> >> cred$handshake(cainfo =
>"C:/users/john/documents/twitter/cacert.pem")
>> >Error in function (type, msg, asError = TRUE)  :
>> >  Protocol " https" not supported or disabled in libcurl
>> >
>> >   [[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] rJava Scientific Linux 6.5 - Can not install

2015-02-02 Thread Ista Zahn
On Mon, Feb 2, 2015 at 1:39 PM, stephen sefick  wrote:
> Hello all,
>
> I am having a problem with installing rJava on SL 6.5. I am having compile
> errors when I try to from CRAN using install.packages("XLConnect", repos="
> http://cran.rstudio.com/";). I can provide anything necessary, but I am
> unsure what to provide.

The actual error would be a good start. You can probably solve your
problem by copying the error message into google, but if that doesn't
help you can post it back here.

Best,
Ista

Thank you for your help in advance.
>
> output of sessionInfo():
> R version 3.1.0 Patched (2014-06-15 r65949)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=en_US.utf8   LC_NUMERIC=C
>  [3] LC_TIME=en_US.utf8LC_COLLATE=en_US.utf8
>  [5] LC_MONETARY=en_US.utf8LC_MESSAGES=en_US.utf8
>  [7] LC_PAPER=en_US.utf8   LC_NAME=C
>  [9] LC_ADDRESS=C  LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] graphics  grDevices utils datasets  stats methods   base
>
> other attached packages:
> [1] devtools_1.7.0 ggplot2_1.0.0
>
> loaded via a namespace (and not attached):
>  [1] colorspace_1.2-4 digest_0.6.8 grid_3.1.0   gtable_0.1.2
>  [5] MASS_7.3-37  munsell_0.4.2plyr_1.8.1   proto_0.3-10
>  [9] Rcpp_0.11.4  reshape2_1.4.1   scales_0.2.4 stringr_0.6.2
> [13] tools_3.1.0
>
>
>
> --
> Stephen Sefick
> **
> Auburn University
> Biological Sciences
> 331 Funchess Hall
> Auburn, Alabama
> 36849
> **
> sas0...@auburn.edu
> http://www.auburn.edu/~sas0025
> **
>
> 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] rJava Scientific Linux 6.5 - Can not install

2015-02-02 Thread Jeff Newmiller
Don't know anything about SL but have you installed a Java run time independent 
of R?
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 2, 2015 10:39:14 AM PST, stephen sefick  wrote:
>Hello all,
>
>I am having a problem with installing rJava on SL 6.5. I am having
>compile
>errors when I try to from CRAN using install.packages("XLConnect",
>repos="
>http://cran.rstudio.com/";). I can provide anything necessary, but I am
>unsure what to provide. Thank you for your help in advance.
>
>output of sessionInfo():
>R version 3.1.0 Patched (2014-06-15 r65949)
>Platform: x86_64-unknown-linux-gnu (64-bit)
>
>locale:
> [1] LC_CTYPE=en_US.utf8   LC_NUMERIC=C
> [3] LC_TIME=en_US.utf8LC_COLLATE=en_US.utf8
> [5] LC_MONETARY=en_US.utf8LC_MESSAGES=en_US.utf8
> [7] LC_PAPER=en_US.utf8   LC_NAME=C
> [9] LC_ADDRESS=C  LC_TELEPHONE=C
>[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
>
>attached base packages:
>[1] graphics  grDevices utils datasets  stats methods   base
>
>other attached packages:
>[1] devtools_1.7.0 ggplot2_1.0.0
>
>loaded via a namespace (and not attached):
> [1] colorspace_1.2-4 digest_0.6.8 grid_3.1.0   gtable_0.1.2
> [5] MASS_7.3-37  munsell_0.4.2plyr_1.8.1   proto_0.3-10
> [9] Rcpp_0.11.4  reshape2_1.4.1   scales_0.2.4 stringr_0.6.2
>[13] tools_3.1.0

__
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 png and identify commands

2015-02-02 Thread Tom Wright
replacing png(...) and dev.off() with
dev2bitmap('test.png')
seems to work.

On Mon, 2015-02-02 at 15:56 -0200, Antonio Silva wrote:
> Hi R users
> 
> I want to save a plot after using the command identify.
> 
> I use identify to place labels manually near the points in order to avoid
> overlapping lines and numbers.
> 
> x<-c(1,2,3,4,5,6)
> y<-c(20,30,15,7,25,40)
> plot(x,y,type="b",ylim=c(0,45))
> identify(x,y,labels=y)
> 
> But when I add
> 
> png(filename="test.png",width=20,height=20,units="cm",res=300)
> x<-c(1,2,3,4,5,6)
> y<-c(20,30,15,7,25,40)
> plot(x,y,type="b",ylim=c(0,45))
> identify(x,y,labels=y)
> dev.off()
> 
> The plot is saved directly, without the identification of the points.My
> question is: how to save the plot only after having labelled the points.
> 
> I use R integrated to gedit in UBUNTU Trusty Tahr 64 bits. I'd like to save
> the plot using command lines and not GUIs
> 
> Thanks for any help. Best regards,
> 
> Antonio Olinto
> 
>   [[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] odbcConnectAccess2007 errors with Access databases on new PC

2015-02-02 Thread utz.ryan
Hello,

I've connected R to Microsoft Access databases for years now
using odbcConnectAccess2007. I recently got a new computer and R is
absolutely refusing to connect to any Access database with the following
error message:

Warning messages:
1: In odbcDriverConnect(con, ...) :
  [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified
2: In odbcDriverConnect(con, ...) : ODBC connection failed

It's definitely not a path name problem-I've checked a dozen times. A few
things online have mentioned something about 32-bit and 64-bit systems
causing problems. I've tried opening both the 64-bit and 32-bit versions of
R with zero luck. My Office is running a 32-bit system.

Is there anything else I can try? I really would hate to lose the ability
to connect R to my Access databases due to some intractable problem.

Thanks,
Ryan

-- 

Ryan Utz, Ph.D.
Aquatic Ecologist/STREON Scientist
National Ecological Observatory Network

Home/Cell: (724) 272-7769
Work: (720) 836-2488




--
View this message in context: 
http://r.789695.n4.nabble.com/odbcConnectAccess2007-errors-with-Access-databases-on-new-PC-tp4702686.html
Sent from the R help mailing list archive at Nabble.com.
[[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] A good way to debug a c++ library embedded to an R code

2015-02-02 Thread Charles Novaes de Santana
Dear all,

I am using R CMD SHLIB to compile a c++ code into a library (.so) and
dyn.load to load this library into a R code. I am facing some problems in
the c++ part that I can not figure out how to solve. Do you recomend any
good way to debug this R + C++ program? If I was programming only in C++ I
would use GDB.

I would much appreciate any help or suggestion!

Best regards,

Charles

-- 
Um axé! :)

--
Charles Novaes de Santana, PhD
http://www.imedea.uib-csic.es/~charles

[[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] odbcConnectAccess2007 errors with Access databases on new PC

2015-02-02 Thread Marc Schwartz
On Feb 2, 2015, at 12:00 PM, utz.ryan  wrote:
> 
> Hello,
> 
> I've connected R to Microsoft Access databases for years now
> using odbcConnectAccess2007. I recently got a new computer and R is
> absolutely refusing to connect to any Access database with the following
> error message:
> 
> Warning messages:
> 1: In odbcDriverConnect(con, ...) :
>  [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver
> Manager] Data source name not found and no default driver specified
> 2: In odbcDriverConnect(con, ...) : ODBC connection failed
> 
> It's definitely not a path name problem-I've checked a dozen times. A few
> things online have mentioned something about 32-bit and 64-bit systems
> causing problems. I've tried opening both the 64-bit and 32-bit versions of
> R with zero luck. My Office is running a 32-bit system.
> 
> Is there anything else I can try? I really would hate to lose the ability
> to connect R to my Access databases due to some intractable problem.
> 
> Thanks,
> Ryan


Take a look at the RODBC vignette:

  vignette("RODBC")

or

  http://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf

and see the footnote (16) at the bottom of page 22 regarding the creation of 32 
bit DSNs and the following from page 20:

"32-bit Windows drivers for Access 2007 and Excel 2007 are bundled with Office 
2007 but can be installed separately via the installer AccessDatabaseEngine.exe 
available from http://www.microsoft.com/en-us/download/details.aspx?id=23734.";


The entire tool chain needs to be of the same architecture. So 32 bit Office, 
32 bit ODBC drivers, 32 bit DSN and 32 bit R.

BTW, as you may be aware, there is a DB SIG list specifically for these types 
of questions:

  https://stat.ethz.ch/mailman/listinfo/r-sig-db

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] using png and identify commands

2015-02-02 Thread Henrik Bengtsson
On Mon, Feb 2, 2015 at 9:56 AM, Antonio Silva  wrote:
> Hi R users
>
> I want to save a plot after using the command identify.
>
> I use identify to place labels manually near the points in order to avoid
> overlapping lines and numbers.
>
> x<-c(1,2,3,4,5,6)
> y<-c(20,30,15,7,25,40)
> plot(x,y,type="b",ylim=c(0,45))
> identify(x,y,labels=y)
>
> But when I add
>
> png(filename="test.png",width=20,height=20,units="cm",res=300)
> x<-c(1,2,3,4,5,6)
> y<-c(20,30,15,7,25,40)
> plot(x,y,type="b",ylim=c(0,45))
> identify(x,y,labels=y)
> dev.off()
>
> The plot is saved directly, without the identification of the points.My
> question is: how to save the plot only after having labelled the points.

Not that surprising, because identify() needs an "interactive" /
screen device, e.g. From help("identify"): "identify is only supported
on screen devices such as X11, windows and quartz. On other devices
the call will do nothing."

You need to do it in two steps, e.g.

x<-c(1,2,3,4,5,6)
y<-c(20,30,15,7,25,40)
plot(x,y,type="b",ylim=c(0,45))
marks <- identify(x,y,labels=y,pos=TRUE)

png(filename="test.png",width=20,height=20,units="cm",res=300)
plot(x,y,type="b",ylim=c(0,45))
xym <- cbind(x=x[marks$ind], y=y[marks$ind])
points(xym)
text(xym, labels=xym[,"y"], pos=marks$pos)
dev.off()


To make sure you call the exact same plot commands in the two steps,
you can also do:

library("R.devices")

x<-c(1,2,3,4,5,6)
y<-c(20,30,15,7,25,40)

marks <- NULL
devEval(c("x11", "png"), name="test", {
  plot(x,y,type="b",ylim=c(0,45))
  if (is.null(marks)) {
marks <- identify(x,y,labels=y,pos=TRUE)
  } else {
xym <- cbind(x=x[marks$ind], y=y[marks$ind])
points(xym)
text(xym, labels=xym[,"y"], pos=marks$pos)
  }
})

/Henrik

>
> I use R integrated to gedit in UBUNTU Trusty Tahr 64 bits. I'd like to save
> the plot using command lines and not GUIs
>
> Thanks for any help. Best regards,
>
> Antonio Olinto
>
> [[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] How to enable https for R 3.1.2 on windows 8.1

2015-02-02 Thread David Winsemius

On Feb 2, 2015, at 10:50 AM, Jeff Newmiller wrote:

> Cc'd back to the list... I am a bad bet for one-on-one help.
> 
> Showing that your libcurl claims to support HTTPS is progress. I think that 
> at this point you should read the last sentence in the curl FAQ 3.21, which I 
> found by searching for "protocol https not supported or disabled in libcurl".

I have had success accessing https://... urls using the 'downloader' package's 
`download` function. The ?download page has system-specific details.

-- 
David.
> 
> http://curl.haxx.se/docs/faq.html
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live Go...
>  Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> --- 
> Sent from my phone. Please excuse my brevity.
> 
> On February 2, 2015 9:21:05 AM PST, John Kalb  wrote:
>> Honestly.  I ran the search you suggested and didn't find anything that
>> helped.  I did come across the curlVersion function and ran it right
>> after
>> receiving the error message.  It seems to indicate that https is
>> available.  I don't see a way forward.
>> 
>> Error in function (type, msg, asError = TRUE)  :
>> Protocol " https" not supported or disabled in libcurl
>>> curlVersion()$protocol
>> [1] "dict"   "file"   "ftp""ftps"   "gopher" "http"   "https" 
>> "imap"
>> "imaps"  "ldap"
>> [11] "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp""sftp"   "smtp"  
>> "smtps"
>> "telnet" "tftp"
>> 
>> On Sun, Feb 1, 2015 at 1:58 PM, Jeff Newmiller
>> 
>> wrote:
>> 
>>> Honestly? Did you try "rcurl https windows" (without the quotes)?
>>> 
>> ---
>>> Jeff NewmillerThe .   .  Go
>> Live...
>>> DCN:Basics: ##.#.   ##.#.  Live
>>> Go...
>>>  Live:   OO#.. Dead: OO#.. 
>> Playing
>>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>>> /Software/Embedded Controllers)   .OO#.   .OO#. 
>> rocks...1k
>>> 
>> ---
>>> Sent from my phone. Please excuse my brevity.
>>> 
>>> On February 1, 2015 8:56:00 AM PST, John Kalb 
>> wrote:
 I run the code below successfully on Mac and Ubuntu successfully.
 When I run on Windows, I get the results shown.  How do I get the
>> code
 to work on Windows? I've googled extensively with no success. Thanks
 in advance.
 
 require(twitteR)
 
 Loading required package: twitteR
 Loading required package: ROAuth
 Loading required package: RCurl
 Loading required package: bitops
 Loading required package: rjson
> cred <- OAuthFactory $ new( consumerKey = my.key, consumerSecret =
 my.secret, requestURL =' https:// api.twitter.com/ oauth/
 request_token', accessURL =' https:// api.twitter.com/ oauth/
 access_token', authURL =' https:// api.twitter.com/ oauth/
>> authorize')
> cred$handshake(cainfo =
>> "C:/users/john/documents/twitter/cacert.pem")
 Error in function (type, msg, asError = TRUE)  :
 Protocol " https" not supported or disabled in libcurl
 
  [[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.

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] How to enable https for R 3.1.2 on windows 8.1

2015-02-02 Thread David Winsemius

On Feb 2, 2015, at 10:50 AM, Jeff Newmiller wrote:

> Cc'd back to the list... I am a bad bet for one-on-one help.
> 
> Showing that your libcurl claims to support HTTPS is progress. I think that 
> at this point you should read the last sentence in the curl FAQ 3.21, which I 
> found by searching for "protocol https not supported or disabled in libcurl".

I have had success accessing https://... urls using the 'downloader' package's 
`download` function. The ?download page has system-specific details.

-- 
David.
> 
> http://curl.haxx.se/docs/faq.html
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live Go...
>  Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> --- 
> Sent from my phone. Please excuse my brevity.
> 
> On February 2, 2015 9:21:05 AM PST, John Kalb  wrote:
>> Honestly.  I ran the search you suggested and didn't find anything that
>> helped.  I did come across the curlVersion function and ran it right
>> after
>> receiving the error message.  It seems to indicate that https is
>> available.  I don't see a way forward.
>> 
>> Error in function (type, msg, asError = TRUE)  :
>> Protocol " https" not supported or disabled in libcurl
>>> curlVersion()$protocol
>> [1] "dict"   "file"   "ftp""ftps"   "gopher" "http"   "https" 
>> "imap"
>> "imaps"  "ldap"
>> [11] "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp""sftp"   "smtp"  
>> "smtps"
>> "telnet" "tftp"
>> 
>> On Sun, Feb 1, 2015 at 1:58 PM, Jeff Newmiller
>> 
>> wrote:
>> 
>>> Honestly? Did you try "rcurl https windows" (without the quotes)?
>>> 
>> ---
>>> Jeff NewmillerThe .   .  Go
>> Live...
>>> DCN:Basics: ##.#.   ##.#.  Live
>>> Go...
>>>  Live:   OO#.. Dead: OO#.. 
>> Playing
>>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>>> /Software/Embedded Controllers)   .OO#.   .OO#. 
>> rocks...1k
>>> 
>> ---
>>> Sent from my phone. Please excuse my brevity.
>>> 
>>> On February 1, 2015 8:56:00 AM PST, John Kalb 
>> wrote:
 I run the code below successfully on Mac and Ubuntu successfully.
 When I run on Windows, I get the results shown.  How do I get the
>> code
 to work on Windows? I've googled extensively with no success. Thanks
 in advance.
 
 require(twitteR)
 
 Loading required package: twitteR
 Loading required package: ROAuth
 Loading required package: RCurl
 Loading required package: bitops
 Loading required package: rjson
> cred <- OAuthFactory $ new( consumerKey = my.key, consumerSecret =
 my.secret, requestURL =' https:// api.twitter.com/ oauth/
 request_token', accessURL =' https:// api.twitter.com/ oauth/
 access_token', authURL =' https:// api.twitter.com/ oauth/
>> authorize')
> cred$handshake(cainfo =
>> "C:/users/john/documents/twitter/cacert.pem")
 Error in function (type, msg, asError = TRUE)  :
 Protocol " https" not supported or disabled in libcurl
 
  [[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.

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] How to enable https for R 3.1.2 on windows 8.1

2015-02-02 Thread John Kalb
Changing urls to remove spaces and replace single quotes with double quotes
resolved the issue.  Apparently windows demands double quotes.

Thanks for your help.

On Mon, Feb 2, 2015 at 1:50 PM, Jeff Newmiller 
wrote:

> Cc'd back to the list... I am a bad bet for one-on-one help.
>
> Showing that your libcurl claims to support HTTPS is progress. I think
> that at this point you should read the last sentence in the curl FAQ 3.21,
> which I found by searching for "protocol https not supported or disabled in
> libcurl".
>
> http://curl.haxx.se/docs/faq.html
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live
> Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
> Sent from my phone. Please excuse my brevity.
>
> On February 2, 2015 9:21:05 AM PST, John Kalb  wrote:
> >Honestly.  I ran the search you suggested and didn't find anything that
> >helped.  I did come across the curlVersion function and ran it right
> >after
> >receiving the error message.  It seems to indicate that https is
> >available.  I don't see a way forward.
> >
> >Error in function (type, msg, asError = TRUE)  :
> >  Protocol " https" not supported or disabled in libcurl
> >> curlVersion()$protocol
> >[1] "dict"   "file"   "ftp""ftps"   "gopher" "http"   "https"
> >"imap"
> >  "imaps"  "ldap"
> >[11] "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp""sftp"   "smtp"
> >"smtps"
> > "telnet" "tftp"
> >
> >On Sun, Feb 1, 2015 at 1:58 PM, Jeff Newmiller
> >
> >wrote:
> >
> >> Honestly? Did you try "rcurl https windows" (without the quotes)?
> >>
>
> >---
> >> Jeff NewmillerThe .   .  Go
> >Live...
> >> DCN:Basics: ##.#.   ##.#.  Live
> >> Go...
> >>   Live:   OO#.. Dead: OO#..
> >Playing
> >> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> >> /Software/Embedded Controllers)   .OO#.   .OO#.
> >rocks...1k
> >>
>
> >---
> >> Sent from my phone. Please excuse my brevity.
> >>
> >> On February 1, 2015 8:56:00 AM PST, John Kalb 
> >wrote:
> >> >I run the code below successfully on Mac and Ubuntu successfully.
> >> >When I run on Windows, I get the results shown.  How do I get the
> >code
> >> >to work on Windows? I've googled extensively with no success. Thanks
> >> >in advance.
> >> >
> >> >require(twitteR)
> >> >
> >> >Loading required package: twitteR
> >> >Loading required package: ROAuth
> >> >Loading required package: RCurl
> >> >Loading required package: bitops
> >> >Loading required package: rjson
> >> >> cred <- OAuthFactory $ new( consumerKey = my.key, consumerSecret =
> >> >my.secret, requestURL =' https:// api.twitter.com/ oauth/
> >> >request_token', accessURL =' https:// api.twitter.com/ oauth/
> >> >access_token', authURL =' https:// api.twitter.com/ oauth/
> >authorize')
> >> >> cred$handshake(cainfo =
> >"C:/users/john/documents/twitter/cacert.pem")
> >> >Error in function (type, msg, asError = TRUE)  :
> >> >  Protocol " https" not supported or disabled in libcurl
> >> >
> >> >   [[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] rJava Scientific Linux 6.5 - Can not install

2015-02-02 Thread stephen sefick
Included at the end of this message is the full compiler output. I have
installed jre-7 from Oracle; The java-1.7.0-jdk* packages and javacc are
installed. It looks like the archiver, header prep., and compiler are
missing. I can provide anything else that can help solve my problem. I
really appreciate all of the help. Kindest regards.

checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver: ''
compiler: ''
header prep.: ''
cpp flags   : '-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../include
-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../include/linux'
java libs   : 
'-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server
-ljvm'configure: error: Java Development Kit (JDK) is missing or not
registered in R
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e

to set all Java-related variables and then install rJava.



On Mon, Feb 2, 2015 at 12:54 PM, Jeff Newmiller 
wrote:

> Don't know anything about SL but have you installed a Java run time
> independent of R?
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live
> Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
> Sent from my phone. Please excuse my brevity.
>
> On February 2, 2015 10:39:14 AM PST, stephen sefick 
> wrote:
> >Hello all,
> >
> >I am having a problem with installing rJava on SL 6.5. I am having
> >compile
> >errors when I try to from CRAN using install.packages("XLConnect",
> >repos="
> >http://cran.rstudio.com/";). I can provide anything necessary, but I am
> >unsure what to provide. Thank you for your help in advance.
> >
> >output of sessionInfo():
> >R version 3.1.0 Patched (2014-06-15 r65949)
> >Platform: x86_64-unknown-linux-gnu (64-bit)
> >
> >locale:
> > [1] LC_CTYPE=en_US.utf8   LC_NUMERIC=C
> > [3] LC_TIME=en_US.utf8LC_COLLATE=en_US.utf8
> > [5] LC_MONETARY=en_US.utf8LC_MESSAGES=en_US.utf8
> > [7] LC_PAPER=en_US.utf8   LC_NAME=C
> > [9] LC_ADDRESS=C  LC_TELEPHONE=C
> >[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
> >
> >attached base packages:
> >[1] graphics  grDevices utils datasets  stats methods   base
> >
> >other attached packages:
> >[1] devtools_1.7.0 ggplot2_1.0.0
> >
> >loaded via a namespace (and not attached):
> > [1] colorspace_1.2-4 digest_0.6.8 grid_3.1.0   gtable_0.1.2
> > [5] MASS_7.3-37  munsell_0.4.2plyr_1.8.1   proto_0.3-10
> > [9] Rcpp_0.11.4  reshape2_1.4.1   scales_0.2.4 stringr_0.6.2
> >[13] tools_3.1.0
>
>


-- 
Stephen Sefick
**
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**

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 

[R] collapse a list of dataframes

2015-02-02 Thread Tom Wright
Hi all,

I'm trying to avoid loops (no real reason, just as an exercise).

Given a list:

list(data.frame(a=1:3,b=letters[1:3]),data.frame(x=1:5,b=LETTERS[1:5]))

Is there an easy way to collapse this to a single dataframe

result<-data.frame(a=c(1:3,1:5),b=c(letters[1:3],LETTERS[1:5]))


Thanks

__
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] collapse a list of dataframes

2015-02-02 Thread dan wang
How about this,

t <- lapply(a,function(x){colnames(x)=c("A","B");return(x)})
do.call(rbind,t)

On Mon, Feb 2, 2015 at 4:00 PM, Tom Wright  wrote:

> Hi all,
>
> I'm trying to avoid loops (no real reason, just as an exercise).
>
> Given a list:
>
> list(data.frame(a=1:3,b=letters[1:3]),data.frame(x=1:5,b=LETTERS[1:5]))
>
> Is there an easy way to collapse this to a single dataframe
>
> result<-data.frame(a=c(1:3,1:5),b=c(letters[1:3],LETTERS[1:5]))
>
>
> Thanks
>
> __
> 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] collapse a list of dataframes

2015-02-02 Thread Tom Wright
Thanks,
After posting I came across this page:
http://www.r-bloggers.com/concatenating-a-list-of-data-frames/

rbindlist seems to be a pretty good solution.

On Mon, 2015-02-02 at 16:09 -0500, dan wang wrote:
> How about this,
> 
> 
> t <- lapply(a,function(x){colnames(x)=c("A","B");return(x)})
> do.call(rbind,t)
> 
> 
> On Mon, Feb 2, 2015 at 4:00 PM, Tom Wright  wrote:
> Hi all,
> 
> I'm trying to avoid loops (no real reason, just as an
> exercise).
> 
> Given a list:
> 
> 
> list(data.frame(a=1:3,b=letters[1:3]),data.frame(x=1:5,b=LETTERS[1:5]))
> 
> Is there an easy way to collapse this to a single dataframe
> 
> result<-data.frame(a=c(1:3,1:5),b=c(letters[1:3],LETTERS[1:5]))
> 
> 
> Thanks
> 
> __
> 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 png and identify commands

2015-02-02 Thread Antonio Silva
Thanks Henrik and Tom, job done. Nice solutions.

All the best

Antonio Olinto

2015-02-02 17:31 GMT-02:00 Henrik Bengtsson :

> On Mon, Feb 2, 2015 at 9:56 AM, Antonio Silva 
> wrote:
> > Hi R users
> >
> > I want to save a plot after using the command identify.
> >
> > I use identify to place labels manually near the points in order to avoid
> > overlapping lines and numbers.
> >
> > x<-c(1,2,3,4,5,6)
> > y<-c(20,30,15,7,25,40)
> > plot(x,y,type="b",ylim=c(0,45))
> > identify(x,y,labels=y)
> >
> > But when I add
> >
> > png(filename="test.png",width=20,height=20,units="cm",res=300)
> > x<-c(1,2,3,4,5,6)
> > y<-c(20,30,15,7,25,40)
> > plot(x,y,type="b",ylim=c(0,45))
> > identify(x,y,labels=y)
> > dev.off()
> >
> > The plot is saved directly, without the identification of the points.My
> > question is: how to save the plot only after having labelled the points.
>
> Not that surprising, because identify() needs an "interactive" /
> screen device, e.g. From help("identify"): "identify is only supported
> on screen devices such as X11, windows and quartz. On other devices
> the call will do nothing."
>
> You need to do it in two steps, e.g.
>
> x<-c(1,2,3,4,5,6)
> y<-c(20,30,15,7,25,40)
> plot(x,y,type="b",ylim=c(0,45))
> marks <- identify(x,y,labels=y,pos=TRUE)
>
> png(filename="test.png",width=20,height=20,units="cm",res=300)
> plot(x,y,type="b",ylim=c(0,45))
> xym <- cbind(x=x[marks$ind], y=y[marks$ind])
> points(xym)
> text(xym, labels=xym[,"y"], pos=marks$pos)
> dev.off()
>
>
> To make sure you call the exact same plot commands in the two steps,
> you can also do:
>
> library("R.devices")
>
> x<-c(1,2,3,4,5,6)
> y<-c(20,30,15,7,25,40)
>
> marks <- NULL
> devEval(c("x11", "png"), name="test", {
>   plot(x,y,type="b",ylim=c(0,45))
>   if (is.null(marks)) {
> marks <- identify(x,y,labels=y,pos=TRUE)
>   } else {
> xym <- cbind(x=x[marks$ind], y=y[marks$ind])
> points(xym)
> text(xym, labels=xym[,"y"], pos=marks$pos)
>   }
> })
>
> /Henrik
>
> >
> > I use R integrated to gedit in UBUNTU Trusty Tahr 64 bits. I'd like to
> save
> > the plot using command lines and not GUIs
> >
> > Thanks for any help. Best regards,
> >
> > Antonio Olinto
> >
> > [[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.
>



-- 
Antônio Olinto Ávila da Silva
Biólogo / Oceanógrafo
Instituto de Pesca (Fisheries Institute)
São Paulo, Brasil

[[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] rtools fstream error

2015-02-02 Thread sunaga
Hi,

when writing a simple cpp function to be run in R I obtain a compilation error 
as soon as I include fstream. Any hints of what goes wrong and how to fix it? 
It's Windows 7 64-bit, R-3.1.2 and Rtools32. An example to recreate the error:

#include 
#include 
#include 
using namespace std;

extern "C" SEXP test(SEXP x) {
  SEXP result;
  
  PROTECT(result = allocVector(REALSXP,1));
  REAL(result)[0] = REAL(x)[0]*5;

  UNPROTECT(1);
  return result;
}

Output:

> R CMD SHLIB test.cpp
g++ -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG 
-I"d:/RCompile/CRANpkg/
extralibs64/local/include" -O2 -Wall  -mtune=core2 -c test.cpp -o test.o
In file included from 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/
../../../../include/c++/4.6.3/fstream:42:0,
 from test.cpp:3:

c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
+/4.6.3/bits/codecvt.h:216:45: error: macro "length" passed 4 arguments, 
but tak
es just 1
In file included from 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/
../../../../include/c++/4.6.3/fstream:921:0,
 from test.cpp:3:

c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
+/4.6.3/bits/fstream.tcc:826:60: error: macro "length" passed 4 arguments, 
but t
akes just 1

c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
+/4.6.3/bits/fstream.tcc:943:39: error: macro "length" passed 4 arguments, 
but t
akes just 1
In file included from 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/
../../../../include/c++/4.6.3/fstream:42:0,
 from test.cpp:3:

c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
+/4.6.3/bits/codecvt.h:215:7: error: expected ';' at end of member 
declaration

c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
+/4.6.3/bits/codecvt.h:217:7: error: expected unqualified-id before '{' 
token
make: *** [test.o] Error 1 

Thanks,
sunaga

__
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] How to enable https for R 3.1.2 on windows 8.1

2015-02-02 Thread Jeff Newmiller
I am not aware that Windows demands double quotes for anything in R. I think 
the spaces was the problem.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 2, 2015 11:29:20 AM PST, John Kalb  wrote:
>Changing urls to remove spaces and replace single quotes with double
>quotes
>resolved the issue.  Apparently windows demands double quotes.
>
>Thanks for your help.
>
>On Mon, Feb 2, 2015 at 1:50 PM, Jeff Newmiller
>
>wrote:
>
>> Cc'd back to the list... I am a bad bet for one-on-one help.
>>
>> Showing that your libcurl claims to support HTTPS is progress. I
>think
>> that at this point you should read the last sentence in the curl FAQ
>3.21,
>> which I found by searching for "protocol https not supported or
>disabled in
>> libcurl".
>>
>> http://curl.haxx.se/docs/faq.html
>>
>---
>> Jeff NewmillerThe .   .  Go
>Live...
>> DCN:Basics: ##.#.   ##.#.  Live
>> Go...
>>   Live:   OO#.. Dead: OO#.. 
>Playing
>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>> /Software/Embedded Controllers)   .OO#.   .OO#. 
>rocks...1k
>>
>---
>> Sent from my phone. Please excuse my brevity.
>>
>> On February 2, 2015 9:21:05 AM PST, John Kalb 
>wrote:
>> >Honestly.  I ran the search you suggested and didn't find anything
>that
>> >helped.  I did come across the curlVersion function and ran it right
>> >after
>> >receiving the error message.  It seems to indicate that https is
>> >available.  I don't see a way forward.
>> >
>> >Error in function (type, msg, asError = TRUE)  :
>> >  Protocol " https" not supported or disabled in libcurl
>> >> curlVersion()$protocol
>> >[1] "dict"   "file"   "ftp""ftps"   "gopher" "http"   "https"
>> >"imap"
>> >  "imaps"  "ldap"
>> >[11] "pop3"   "pop3s"  "rtmp"   "rtsp"   "scp""sftp"   "smtp"
>> >"smtps"
>> > "telnet" "tftp"
>> >
>> >On Sun, Feb 1, 2015 at 1:58 PM, Jeff Newmiller
>> >
>> >wrote:
>> >
>> >> Honestly? Did you try "rcurl https windows" (without the quotes)?
>> >>
>>
>>
>>---
>> >> Jeff NewmillerThe .   . 
>Go
>> >Live...
>> >> DCN:Basics: ##.#.   ##.#. 
>Live
>> >> Go...
>> >>   Live:   OO#.. Dead: OO#..
>> >Playing
>> >> Research Engineer (Solar/BatteriesO.O#.   #.O#. 
>with
>> >> /Software/Embedded Controllers)   .OO#.   .OO#.
>> >rocks...1k
>> >>
>>
>>
>>---
>> >> Sent from my phone. Please excuse my brevity.
>> >>
>> >> On February 1, 2015 8:56:00 AM PST, John Kalb
>
>> >wrote:
>> >> >I run the code below successfully on Mac and Ubuntu successfully.
>> >> >When I run on Windows, I get the results shown.  How do I get the
>> >code
>> >> >to work on Windows? I've googled extensively with no success.
>Thanks
>> >> >in advance.
>> >> >
>> >> >require(twitteR)
>> >> >
>> >> >Loading required package: twitteR
>> >> >Loading required package: ROAuth
>> >> >Loading required package: RCurl
>> >> >Loading required package: bitops
>> >> >Loading required package: rjson
>> >> >> cred <- OAuthFactory $ new( consumerKey = my.key,
>consumerSecret =
>> >> >my.secret, requestURL =' https:// api.twitter.com/ oauth/
>> >> >request_token', accessURL =' https:// api.twitter.com/ oauth/
>> >> >access_token', authURL =' https:// api.twitter.com/ oauth/
>> >authorize')
>> >> >> cred$handshake(cainfo =
>> >"C:/users/john/documents/twitter/cacert.pem")
>> >> >Error in function (type, msg, asError = TRUE)  :
>> >> >  Protocol " https" not supported or disabled in libcurl
>> >> >
>> >> >   [[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 

Re: [R] rtools fstream error

2015-02-02 Thread William Dunlap
Try adding the line
  #define R_NO_REMAP
to the top of your file (before any #include's) so the R
include files don't define length(x).

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Feb 2, 2015 at 1:11 PM,  wrote:

> Hi,
>
> when writing a simple cpp function to be run in R I obtain a compilation
> error as soon as I include fstream. Any hints of what goes wrong and how to
> fix it? It's Windows 7 64-bit, R-3.1.2 and Rtools32. An example to recreate
> the error:
>
> #include 
> #include 
> #include 
> using namespace std;
>
> extern "C" SEXP test(SEXP x) {
>   SEXP result;
>
>   PROTECT(result = allocVector(REALSXP,1));
>   REAL(result)[0] = REAL(x)[0]*5;
>
>   UNPROTECT(1);
>   return result;
> }
>
> Output:
>
> > R CMD SHLIB test.cpp
> g++ -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG
>  -I"d:/RCompile/CRANpkg/
> extralibs64/local/include" -O2 -Wall  -mtune=core2 -c test.cpp -o
> test.o
> In file included from
> c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/
> ../../../../include/c++/4.6.3/fstream:42:0,
>  from test.cpp:3:
>
> c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
> +/4.6.3/bits/codecvt.h:216:45: error: macro "length" passed 4
> arguments, but tak
> es just 1
> In file included from
> c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/
> ../../../../include/c++/4.6.3/fstream:921:0,
>  from test.cpp:3:
>
> c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
> +/4.6.3/bits/fstream.tcc:826:60: error: macro "length" passed 4
> arguments, but t
> akes just 1
>
> c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
> +/4.6.3/bits/fstream.tcc:943:39: error: macro "length" passed 4
> arguments, but t
> akes just 1
> In file included from
> c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/
> ../../../../include/c++/4.6.3/fstream:42:0,
>  from test.cpp:3:
>
> c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
> +/4.6.3/bits/codecvt.h:215:7: error: expected ';' at end of member
> declaration
>
> c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
> +/4.6.3/bits/codecvt.h:217:7: error: expected unqualified-id before
> '{' token
> make: *** [test.o] Error 1
>
> Thanks,
> sunaga
>
> __
> 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] A good way to debug a c++ library embedded to an R code

2015-02-02 Thread Qiang Kou
If you are familiar with GDB, you can just start R by "R -d gdb".

Dirk gave a good example on SO, please check the link below:

http://stackoverflow.com/questions/11345537/debugging-line-by-line-of-rcpp-generated-dll-under-windows

Best,

KK

On Mon, Feb 2, 2015 at 2:00 PM, Charles Novaes de Santana <
charles.sant...@gmail.com> wrote:

> Dear all,
>
> I am using R CMD SHLIB to compile a c++ code into a library (.so) and
> dyn.load to load this library into a R code. I am facing some problems in
> the c++ part that I can not figure out how to solve. Do you recomend any
> good way to debug this R + C++ program? If I was programming only in C++ I
> would use GDB.
>
> I would much appreciate any help or suggestion!
>
> Best regards,
>
> Charles
>
> --
> Um axé! :)
>
> --
> Charles Novaes de Santana, PhD
> http://www.imedea.uib-csic.es/~charles
>
> [[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.




-- 
Qiang Kou
q...@umail.iu.edu
School of Informatics and Computing, Indiana University

[[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] rtools fstream error

2015-02-02 Thread sunaga
Thank you, it worked. 
For completeness, had to add Rf_ in front of allocVector (and possibly any 
other function from Rdefines.h) 


- Original Message -

From: "William Dunlap"  
To: sun...@telenet.be 
Cc: r-help@r-project.org 
Sent: Monday, February 2, 2015 10:29:19 PM 
Subject: Re: [R] rtools fstream error 

Try adding the line 
#define R_NO_REMAP 
to the top of your file (before any #include's) so the R 
include files don't define length(x). 

Bill Dunlap 
TIBCO Software 
wdunlap tibco.com 

On Mon, Feb 2, 2015 at 1:11 PM, < sun...@telenet.be > wrote: 


Hi, 

when writing a simple cpp function to be run in R I obtain a compilation error 
as soon as I include fstream. Any hints of what goes wrong and how to fix it? 
It's Windows 7 64-bit, R-3.1.2 and Rtools32. An example to recreate the error: 

#include  
#include  
#include  
using namespace std; 

extern "C" SEXP test(SEXP x) { 
SEXP result; 

PROTECT(result = allocVector(REALSXP,1)); 
REAL(result)[0] = REAL(x)[0]*5; 

UNPROTECT(1); 
return result; 
} 

Output: 

> R CMD SHLIB test.cpp 
g++ -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -I"d:/RCompile/CRANpkg/ 
extralibs64/local/include" -O2 -Wall -mtune=core2 -c test.cpp -o test.o 
In file included from 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/ 
../../../../include/c++/4.6.3/fstream:42:0, 
from test.cpp:3: 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
 
+/4.6.3/bits/codecvt.h:216:45: error: macro "length" passed 4 arguments, but 
tak 
es just 1 
In file included from 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/ 
../../../../include/c++/4.6.3/fstream:921:0, 
from test.cpp:3: 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
 
+/4.6.3/bits/fstream.tcc:826:60: error: macro "length" passed 4 arguments, but 
t 
akes just 1 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
 
+/4.6.3/bits/fstream.tcc:943:39: error: macro "length" passed 4 arguments, but 
t 
akes just 1 
In file included from 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/ 
../../../../include/c++/4.6.3/fstream:42:0, 
from test.cpp:3: 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
 
+/4.6.3/bits/codecvt.h:215:7: error: expected ';' at end of member declaration 
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../include/c+
 
+/4.6.3/bits/codecvt.h:217:7: error: expected unqualified-id before '{' token 
make: *** [test.o] Error 1 

Thanks, 
sunaga 

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






[[alternative HTML version deleted]]

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


[R] Plot residuals against standard normal distribution

2015-02-02 Thread Mikael Olai Milhøj
Hi,

I'm having trouble trying to plot the density of the residuals against the
standard normal distribution N(0,1). (I'm trying to see if my residuals are
well-behaved).

I know hwo to calculate the standardized residuals (I guess that there may
be a simple way using a R function) and then plot this by using the density
function

y<-(model$residuals-mean(model$residuals))/sd(model$residuals)
plot(density(y))

But I don't know how to add the N(0,1) curve. Any suggestions? Thanks in
advance


/Mikael

[[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] Maxent does not work

2015-02-02 Thread Kenneth Z
Yesterday I installed the most recent R and maxent package, but it stopped 
working. Even a simple command like
Model <- maxent(matrix(c(1,2,3,4,5,6,7,8), nrow=2, ncol=4),c(1,-1))

will cause a fatal error in R. I am attaching a screenshot to this email.
 Any help will be appreciated.

Best regards,
Ken




> On Dec 12, 2012, at 4:13 PM, Kenneth Z  wrote:
> 
> I found that the optim() function does not always reach the real minimum. Is 
> it because the solution is trapped at a local minimum?
> 
> Thanks!
> Ken
> 
> 
> 
>> On Dec 12, 2012, at 2:17 PM, Jeff Newmiller  wrote:
>> 
>> ... origin pro?
>> 
>> Then why are you here?
>> 
>> It is not clear from your message that this has anything to do with R.
>> ---
>> Jeff NewmillerThe .   .  Go Live...
>> DCN:Basics: ##.#.   ##.#.  Live Go...
>> Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
>> --- 
>> Sent from my phone. Please excuse my brevity.
>> 
>> vishal katoch  wrote:
>> 
>>> Hello,
>>> i am working in origin pro,
>>> i want to plot a graph as like a pdf attached but with black and white
>>> lines.
>>> here radial axis varies from 0 to 1. and angular axis from 0 degree to
>>> 60 degree.and third axis which is depend on both radial and axial gives
>>> non intersecting lines.
>>> how can i read the data from plot for replot.
>>> vikas 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> __
>>> R-help@r-project.org mailing list
>>> 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
>> 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] Plot residuals against standard normal distribution

2015-02-02 Thread peter dalgaard

> On 02 Feb 2015, at 23:42 , Mikael Olai Milhøj  wrote:
> 
> Hi,
> 
> I'm having trouble trying to plot the density of the residuals against the
> standard normal distribution N(0,1). (I'm trying to see if my residuals are
> well-behaved).
> 
> I know hwo to calculate the standardized residuals (I guess that there may
> be a simple way using a R function) and then plot this by using the density
> function
> 
> y<-(model$residuals-mean(model$residuals))/sd(model$residuals)
> plot(density(y))
> 
> But I don't know how to add the N(0,1) curve. Any suggestions? Thanks in
> advance

I'd try

curve(dnorm(x), add=TRUE)

Some diddling of ylim= is usually required. 


I'd usually prefer qqnorm() for normality checks, though; it is pretty hard to 
assess the tails of density plots.
 
Also notice rstandard(), rstudent().

-pd

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

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
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] Boundaries and deldir

2015-02-02 Thread p_connolly

On 2015-02-03 00:46, Rolf Turner wrote:

[...]



The deldir function creates a Delaunay triangulation/Dirichlet
tessellation inside a "rectangular window" (denoted by "rw" in the
argument list).  This is the only boundary invoked or involved.

The function plot.tile.list() will *plot* the Dirichlet tessellation
"clipped" to a specified polygon.  But that is just for *plotting*.  I
am not sure that I really understand the idea of a "boundary beyond
which the triangulation ceases".  The Delaunay triangulation is a
finite
structure; its outer boundary is the convex hull of the set of points
being triangulated.  You cannot confine it to a smaller region without
losing some of those points.

If you can explain what you really want to do, perhaps I can help.


This should make it clearer:


Suppose we had trees planted at the following coordinates

x   <- c(2.3,3.0,7.0,1.0,3.0,8.0)
y   <- c(2.3,3.0,2.0,5.0,8.0,9.0)

We can get a plot of the layout and polygons that "belong" to each tree.

del <- deldir(x,y,list(ndx=2,ndy=2),c(0,10,0,10), plotit = TRUE, wl = 
'tess')


The areas of the polygons so drawn can be seen in this dataframe.

del$summary

Apart from those immediately adjacent to the corner (dummy) points,
the areas represent the amount of space the roots could grow at a
uniform rate before encountering a neighbouring tree's roots or a
notional concrete path as described by the dummy triangular points,
shown by this red square:

polygon(y=c(0,0,10,10,0), x=c(0,10, 10, 0, 0), border = "red")

My question relates to the possibility of doing something similar if
the notional path was described by this green polygon:

polygon(y=c(0.5, 1, 1.5, 9.5, 10, 8.5, 0.5),
x=c(0.5, 8, 9.5, 9, 7, .7, 0.5), border = "green")

Judging by references to 'rw', a rectangular window, I suspect not.


Thanks for the help.

Patrick





cheers,

Rolf


__
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] FFT Normalization Documentation

2015-02-02 Thread Franklin Bretschneider
Dear Eike Petersen,


Re:

> Hello everyone,
> 
> the docpage for the fft function states:
> 
> “Description: Performs the Fast Fourier Transform of an array.”
> 
> and
> 
> “Arguments – inverse: if ‘TRUE’, the unnormalized inverse transform is 
> computed
> (the inverse has a ‘+’ in the exponent of e, but here, we do _not_ divide by
> ‘1/length(x)’).”
> 
> Judging from this, I would expect ‘fft(x)’ to yield the correct FFT of x, and
> ‘fft(X, inverse = TRUE) / length(X)’ to yield the correct inverse FFT of X.
> 
> However, it seems to me that actually the result of ‘fft(x)’ should be scaled 
> by
> ‘1/length(x)’, while ‘fft(X, inverse=TRUE)’ seems to yield a correct result by
> default:
> 
> t <- seq(0.001, 1, 0.001)
> y <- 1 + sin(2*pi*20*t) + 1.5 * sin(2*pi*30*t)
> Y <- fft(y)
> dev.new()
> plot(abs(Y)) ## Shows peaks at amplitudes 1000, 500 and 750, while they should
> be at amplitude 1, 0.5 and 0.75.
> y2 <- Re(fft(Y / length(Y), inverse = TRUE))
> max(abs(y-y2)) ## The IFFT yields a correctly scaled result by default, if
> applied to a correctly scaled FFT.
> 
> Did I get something wrong? If not, having spent quite some time figuring this
> out, I would like to see the documentation clearly pointing this out. I find 
> the
> current text rather confusing.
> 
> On another note: I have spent some time working on demo files that showcase 
> some
> of the properties of the FFT and their implementation in R. I have done this
> primarily for myself, as I keep forgetting how these things work, but I 
> thought
> that it might be helpful to others as well. Any hints on where/how I should
> publish such a thing?
> 
> Kind regards and many thanks in advance,
> 
> Eike
> 
> __
> 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.


As far as I know an FFT must be normalized and folded to obtain a spectrum in 
the form we like, so this would be my version:

#  your time signal:

t <- seq(0.001, 1, 0.001)
y <- 1 + sin(2*pi*20*t) + 1.5 * sin(2*pi*30*t)

# find time and frequency calibration:

n = length(y)
dt = t[2]-t[1]
fNyq = 1/(2*dt)
tmax = max(t)
df = 1/tmax

#  make frequency vector to display as x-values of the spectrum rather than the 
index.

f = seq(-fNyq, fNyq-df, by=df)

#  make folding mask

mask=rep(c(1, -1),length.out=n)

#  fold the spectrum around the Nyquist frequency; so the DC value (f=0) is in 
the middle; the - and + max frequency at the ends.

yy = y * mask

#  #  Then do the FFT

YY <- fft(yy)

Plot the amplitude spectrum vector against the freq. vector

plot(f,abs(YY), type='h') 





It would be a good idea to put such an example in the help pages indeed. 
The short example given in the manual isn't of much help for the usual 
(periodic!) time signals.

Hoping this helps, I remain

With best wishes,

Frank







Franklin Bretschneider
Dept of Biology
Utrecht University
brets...@xs4all.nl

__
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] Plot residuals against standard normal distribution

2015-02-02 Thread Hall, Mark
Since you are plotting densities, check out the sm package.  It has been
over a year or so since I've used it, but there was a setting on the
univariate densities to check the data against a normal distribution.

Best, MEH



On Mon, Feb 2, 2015 at 2:42 PM, Mikael Olai Milhøj 
wrote:

> Hi,
>
> I'm having trouble trying to plot the density of the residuals against the
> standard normal distribution N(0,1). (I'm trying to see if my residuals are
> well-behaved).
>
> I know hwo to calculate the standardized residuals (I guess that there may
> be a simple way using a R function) and then plot this by using the density
> function
>
> y<-(model$residuals-mean(model$residuals))/sd(model$residuals)
> plot(density(y))
>
> But I don't know how to add the N(0,1) curve. Any suggestions? Thanks in
> advance
>
>
> /Mikael
>
> [[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.
>



-- 
Mark E. Hall, PhD
Assistant Field Manager, Black Rock Field Office
Winnemucca District Office
775-623-1529.

[[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] Asymmetric Cost assignment for SVM | Help

2015-02-02 Thread Bharat Bargujar
Hi Friends,

I want to assign asymmetric cost values at the time training.

For example : For false negative cost should be 10 and for For false
positive it should be 1.

Can some help me with this.


Code:

svmFit <- train(Y ~ .,
data = train,
method = "svmRadial",
preProc = c("center", "scale"),
cost=5,
trControl = trainControl(method = "repeatedcv", repeats =
5,classProbs =  TRUE))


So I need a way to force cost of 10 for false negative and 1 for false
positive at time of training.

Regards,
Bharat

[[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] Updating to R 3.1.1. - impacts on existing packages

2015-02-02 Thread Sun Shine

Hi list

I've signed up for a Coursera course on exploratory data analysis, and 
the recommendation is to update to R base 3.1.1. I'm currently on 3.0.2.


If I do upgrade, what is the best way for me to upgrade all my packages 
for compatibility? Would this be accomplished through the command:


> update.packages()

Also, any ideas what percentage of the packages have been updated to 
work with 3.1.1. ? I'm just wanting to do a risk evaluation because I 
don't want to lose access to packages such as ggplot2, sna, statnet, 
FactoMineR, and several others through upgrading.


Thanks for any steers

Sun

__
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] Updating to R 3.1.1. - impacts on existing packages

2015-02-02 Thread Henrik Bengtsson
On Mon, Feb 2, 2015 at 4:49 PM, Sun Shine  wrote:
> Hi list
>
> I've signed up for a Coursera course on exploratory data analysis, and the
> recommendation is to update to R base 3.1.1. I'm currently on 3.0.2.
>
> If I do upgrade, what is the best way for me to upgrade all my packages for
> compatibility? Would this be accomplished through the command:
>
>> update.packages()
>
> Also, any ideas what percentage of the packages have been updated to work
> with 3.1.1. ? I'm just wanting to do a risk evaluation because I don't want
> to lose access to packages such as ggplot2, sna, statnet, FactoMineR, and
> several others through upgrading.

All package on CRAN should be up-to-date (that's almost the definition
of CRAN; if a package is not updated in time it's likely to be
archived due to lack of maintenance).  When in doubt, have a look at
their individual CRAN pages, e.g.
http://cran.r-project.org/package=ggplot2.  Look for the "r-release".

Note that "r-release" always refers to the latest stable official R
release, which currently is R 3.1.2.  You should upgrade to that
version and not 3.1.1.  It's pretty safe to always install the most
recent stable release version of R.  If you're using an old version of
R, like you do, it's more likely that you run into problems in general
than if you use the most recent version.  So, avoid sticking with old
version and make to upgrade whenever a new release come out.

/Henrik

>
> Thanks for any steers
>
> Sun
>
> __
> 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] Updating to R 3.1.1. - impacts on existing packages

2015-02-02 Thread Jeff Newmiller
I think you missed the question, Henrik, which was directed at updating 
the local 3.1 library with all of the packages that were in the 3.0 
library.


The usual advice for this is to copy your 3.0 library onto your 3.1 
library (duplicate directory structure) so R knows what packages you want 
to use and then use update packages. In general the copied directories 
will not work directly, but R can update them. Note that some packages are 
dropped due to better support in different packages or lack of maintainer 
activity, so not all packages thus copied may end up usable.


On Mon, 2 Feb 2015, Henrik Bengtsson wrote:


On Mon, Feb 2, 2015 at 4:49 PM, Sun Shine  wrote:

Hi list

I've signed up for a Coursera course on exploratory data analysis, and the
recommendation is to update to R base 3.1.1. I'm currently on 3.0.2.

If I do upgrade, what is the best way for me to upgrade all my packages for
compatibility? Would this be accomplished through the command:


update.packages()


Also, any ideas what percentage of the packages have been updated to work
with 3.1.1. ? I'm just wanting to do a risk evaluation because I don't want
to lose access to packages such as ggplot2, sna, statnet, FactoMineR, and
several others through upgrading.


All package on CRAN should be up-to-date (that's almost the definition
of CRAN; if a package is not updated in time it's likely to be
archived due to lack of maintenance).  When in doubt, have a look at
their individual CRAN pages, e.g.
http://cran.r-project.org/package=ggplot2.  Look for the "r-release".

Note that "r-release" always refers to the latest stable official R
release, which currently is R 3.1.2.  You should upgrade to that
version and not 3.1.1.  It's pretty safe to always install the most
recent stable release version of R.  If you're using an old version of
R, like you do, it's more likely that you run into problems in general
than if you use the most recent version.  So, avoid sticking with old
version and make to upgrade whenever a new release come out.

/Henrik



Thanks for any steers

Sun

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



---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
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] the less-than-minus gotcha

2015-02-02 Thread Steve Taylor
Responding to several messages in this thread...

> > All the more reason to use = instead of <-
> Definitely not!

Martin and Rolf are right, it's not a reason for that; I wrote that quickly 
without thinking it through.  An "=" user might be more likely to fall for the 
gotcha, if not spacing their code nicely.  So the lesson learned from the 
gotcha is that it's good to space your code nicely, as others have siad, not 
which assignment symbol to use.

However, I continue to use "=" for assignment on a daily basis without any 
problems, as I have done for many years.  I remain unconvinced by any and all 
of these arguments against it in favour of "<-".  People telling me that I 
"should" use the arrow need better agruments than what I've seen so far.

I find "<-" ugly and "->" useless/pointless, whereas "=" is simpler and also 
nicely familiar from my experience in other languages.  It doesn't matter to me 
that "=" is not commutative because I don't need it to be.

> Further it can be nicely marked up by a real "left arrow" 
> by e.g. the listings LaTeX 'listings' package...

Now that's just silly, turning R code into graphical characters that are not 
part of the R language.

>  foo(x = y) and foo(x <- y)

I'm well aware of this distinction and it never causes me any problems.  The 
latter is an example of bad (obfuscated) coding, IMHO; it should be done in two 
lines for clarity as follows:

x = y
foo(x)

> Using = has it's problems too.
Same goes for apostrophes.

Shall we discuss putting "else" at the start of line next?

cheers,
 Steve

__
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] the less-than-minus gotcha

2015-02-02 Thread Ista Zahn
On Mon, Feb 2, 2015 at 8:57 PM, Steve Taylor  wrote:
> Responding to several messages in this thread...
>
>> > All the more reason to use = instead of <-
>> Definitely not!
>
> Martin and Rolf are right, it's not a reason for that; I wrote that quickly 
> without thinking it through.  An "=" user might be more likely to fall for 
> the gotcha, if not spacing their code nicely.  So the lesson learned from the 
> gotcha is that it's good to space your code nicely, as others have siad, not 
> which assignment symbol to use.
>
> However, I continue to use "=" for assignment on a daily basis without any 
> problems, as I have done for many years.  I remain unconvinced by any and all 
> of these arguments against it in favour of "<-".  People telling me that I 
> "should" use the arrow need better agruments than what I've seen so far.

Fair enough, but you skipped right past the most important one: it
makes code easier to read. It's very nice to be able to visually scan
through the code and easily see where assignment happens.

>
> I find "<-" ugly and "->" useless/pointless,

I never used it either, until recently when I started using magrittr.
Maybe still pointless, but I find the form
> library(magrittr)
>
> "hello" %>%
+ paste("world,") %>%
+ paste("my name is") %>%
+ paste("Ista") -> hi
> hi
[1] "hello world, my name is Ista"

quite nice.

--Ista

whereas "=" is simpler and also nicely familiar from my experience in
other languages.  It doesn't matter to me that "=" is not commutative
because I don't need it to be.
>
>> Further it can be nicely marked up by a real "left arrow"
>> by e.g. the listings LaTeX 'listings' package...
>
> Now that's just silly, turning R code into graphical characters that are not 
> part of the R language.
>
>>  foo(x = y) and foo(x <- y)
>
> I'm well aware of this distinction and it never causes me any problems.  The 
> latter is an example of bad (obfuscated) coding, IMHO; it should be done in 
> two lines for clarity as follows:
>
> x = y
> foo(x)
>
>> Using = has it's problems too.
> Same goes for apostrophes.
>
> Shall we discuss putting "else" at the start of line next?
>
> cheers,
>  Steve
>
> __
> 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] the less-than-minus gotcha

2015-02-02 Thread Steve Taylor
I disagree.  Assignments in my code are all lines that look like this:

variable = expression

They are easy to find and easy to read.

-Original Message-
From: Ista Zahn [mailto:istaz...@gmail.com] 
Sent: Tuesday, 3 February 2015 3:36p
To: Steve Taylor
Cc: r-h...@stat.math.ethz.ch
Subject: Re: [R] the less-than-minus gotcha

On Mon, Feb 2, 2015 at 8:57 PM, Steve Taylor  wrote:
Fair enough, but you skipped right past the most important one: it
makes code easier to read. It's very nice to be able to visually scan
through the code and easily see where assignment happens.

__
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] the less-than-minus gotcha

2015-02-02 Thread Jeff Newmiller
I did not start out liking <-, but I am quite attached to it now, and even Rcpp 
feels weird to me now. This may seem like yet another variation on a theme that 
you don't find compelling, but I find that

f(x=x)

makes sense when scope is considered, but

x=x

on its own is silly. That is why I prefer to reserve = for assigning 
parameters... I use it to clarify that I am crossing scope boundaries, while <- 
never does. (<<- is a dangerous animal, though... to be used only locally in 
nested function definitions).

In my view, this is similar to preferring == from C-derived syntaxes over the 
overloaded = from, say, Basic. I am sure you can get by with the syntactic 
overloading, but if you have the option of reducing ambiguity, why not use it?

---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 2, 2015 5:57:05 PM PST, Steve Taylor  wrote:
>Responding to several messages in this thread...
>
>> > All the more reason to use = instead of <-
>> Definitely not!
>
>Martin and Rolf are right, it's not a reason for that; I wrote that
>quickly without thinking it through.  An "=" user might be more likely
>to fall for the gotcha, if not spacing their code nicely.  So the
>lesson learned from the gotcha is that it's good to space your code
>nicely, as others have siad, not which assignment symbol to use.
>
>However, I continue to use "=" for assignment on a daily basis without
>any problems, as I have done for many years.  I remain unconvinced by
>any and all of these arguments against it in favour of "<-".  People
>telling me that I "should" use the arrow need better agruments than
>what I've seen so far.
>
>I find "<-" ugly and "->" useless/pointless, whereas "=" is simpler and
>also nicely familiar from my experience in other languages.  It doesn't
>matter to me that "=" is not commutative because I don't need it to be.
>
>> Further it can be nicely marked up by a real "left arrow" 
>> by e.g. the listings LaTeX 'listings' package...
>
>Now that's just silly, turning R code into graphical characters that
>are not part of the R language.
>
>>  foo(x = y) and foo(x <- y)
>
>I'm well aware of this distinction and it never causes me any problems.
>The latter is an example of bad (obfuscated) coding, IMHO; it should be
>done in two lines for clarity as follows:
>
>x = y
>foo(x)
>
>> Using = has it's problems too.
>Same goes for apostrophes.
>
>Shall we discuss putting "else" at the start of line next?
>
>cheers,
> Steve
>
>__
>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] the less-than-minus gotcha

2015-02-02 Thread Steve Taylor
Nobody would write x=x or indeed x<-x; both are silly.  If I found myself 
writing f(x=x) I might smirk at the coincidence, but it wouldn't bother me.  I 
certainly wouldn't confuse it with assigning x to itself.

By the way, here's another assignment operator we can use:

`:=` = `<-`  # this is going in my .Rprofile
x := 1


-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] 
Sent: Tuesday, 3 February 2015 3:54p
To: Steve Taylor; r-h...@stat.math.ethz.ch
Subject: Re: [R] the less-than-minus gotcha

I did not start out liking <-, but I am quite attached to it now, and even Rcpp 
feels weird to me now. This may seem like yet another variation on a theme that 
you don't find compelling, but I find that

f(x=x)

makes sense when scope is considered, but

x=x

on its own is silly. That is why I prefer to reserve = for assigning 
parameters... I use it to clarify that I am crossing scope boundaries, while <- 
never does. (<<- is a dangerous animal, though... to be used only locally in 
nested function definitions).

In my view, this is similar to preferring == from C-derived syntaxes over the 
overloaded = from, say, Basic. I am sure you can get by with the syntactic 
overloading, but if you have the option of reducing ambiguity, why not use it?

---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 2, 2015 5:57:05 PM PST, Steve Taylor  wrote:
>Responding to several messages in this thread...
>
>> > All the more reason to use = instead of <-
>> Definitely not!
>
>Martin and Rolf are right, it's not a reason for that; I wrote that
>quickly without thinking it through.  An "=" user might be more likely
>to fall for the gotcha, if not spacing their code nicely.  So the
>lesson learned from the gotcha is that it's good to space your code
>nicely, as others have siad, not which assignment symbol to use.
>
>However, I continue to use "=" for assignment on a daily basis without
>any problems, as I have done for many years.  I remain unconvinced by
>any and all of these arguments against it in favour of "<-".  People
>telling me that I "should" use the arrow need better agruments than
>what I've seen so far.
>
>I find "<-" ugly and "->" useless/pointless, whereas "=" is simpler and
>also nicely familiar from my experience in other languages.  It doesn't
>matter to me that "=" is not commutative because I don't need it to be.
>
>> Further it can be nicely marked up by a real "left arrow" 
>> by e.g. the listings LaTeX 'listings' package...
>
>Now that's just silly, turning R code into graphical characters that
>are not part of the R language.
>
>>  foo(x = y) and foo(x <- y)
>
>I'm well aware of this distinction and it never causes me any problems.
>The latter is an example of bad (obfuscated) coding, IMHO; it should be
>done in two lines for clarity as follows:
>
>x = y
>foo(x)
>
>> Using = has it's problems too.
>Same goes for apostrophes.
>
>Shall we discuss putting "else" at the start of line next?
>
>cheers,
> Steve
>
>__
>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] A good way to debug a c++ library embedded to an R code

2015-02-02 Thread Pierrick Bruneau
There's also a section about this in "Writing R extensions":
http://cran.r-project.org/doc/manuals/r-release/R-exts.html#Debugging-compiled-code

Pierrick

On Mon, Feb 2, 2015 at 10:42 PM, Qiang Kou  wrote:
> If you are familiar with GDB, you can just start R by "R -d gdb".
>
> Dirk gave a good example on SO, please check the link below:
>
> http://stackoverflow.com/questions/11345537/debugging-line-by-line-of-rcpp-generated-dll-under-windows
>
> Best,
>
> KK
>
> On Mon, Feb 2, 2015 at 2:00 PM, Charles Novaes de Santana <
> charles.sant...@gmail.com> wrote:
>
>> Dear all,
>>
>> I am using R CMD SHLIB to compile a c++ code into a library (.so) and
>> dyn.load to load this library into a R code. I am facing some problems in
>> the c++ part that I can not figure out how to solve. Do you recomend any
>> good way to debug this R + C++ program? If I was programming only in C++ I
>> would use GDB.
>>
>> I would much appreciate any help or suggestion!
>>
>> Best regards,
>>
>> Charles
>>
>> --
>> Um axé! :)
>>
>> --
>> Charles Novaes de Santana, PhD
>> http://www.imedea.uib-csic.es/~charles
>>
>> [[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.
>
>
>
>
> --
> Qiang Kou
> q...@umail.iu.edu
> School of Informatics and Computing, Indiana University
>
> [[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] New to R

2015-02-02 Thread Lalitha Kristipati
Hi,



In our data we have 10 people with 10 different attributes , we want to rank 
the people based on the weightage of these attributes.

Suggest the best statistical method to do this.

Does Revolution R solves my problem??



Regards,
Lalitha Kristipati
Associate Software Engineer




Disclaimer:  This message and the information contained herein is proprietary 
and confidential and subject to the Tech Mahindra policy statement, you may 
review the policy at http://www.techmahindra.com/Disclaimer.html externally 
http://tim.techmahindra.com/tim/disclaimer.html internally within TechMahindra.



[[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] New to R

2015-02-02 Thread Jeff Newmiller
Please don't cross-post to multiple lists. There is a Posting Guide mentioned 
in the footer that you probably won't see because you are using Nabble. It 
would have informed you that the R-devel mailing list was for people interested 
in modifying R, definitely not this topic.

As to your question, Revolution R would probably be overkill, and if you chose 
to go that route then asking the Revolution R support people for help would be 
appropriate. This list is for the open source R software that RR builds on.

Your problem  statement suggests you already know the weights... in which case 
this is a straightforward linear algebra calculation that is trivial in R.

But your question mentions selecting statistics methods, which is not on topic 
here in the R-help mailing list, since methods are independent of the software 
used to apply them. If you know what methods you want to apply, and have read 
the introductory R documentation, then this is an appropriate place to ask for 
help on how to apply R to your problem. If that is the case, then DO read the 
Posting Guide and try again with some example data and if possible some sample 
results you expect to get. We can then show you how to connect the dots using R.

---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On February 2, 2015 10:14:28 PM PST, Lalitha Kristipati 
 wrote:
>Hi,
>
>
>
>In our data we have 10 people with 10 different attributes , we want to
>rank the people based on the weightage of these attributes.
>
>Suggest the best statistical method to do this.
>
>Does Revolution R solves my problem??
>
>
>
>Regards,
>Lalitha Kristipati
>Associate Software Engineer
>
>
>
>
>Disclaimer:  This message and the information contained herein is
>proprietary and confidential and subject to the Tech Mahindra policy
>statement, you may review the policy at
>http://www.techmahindra.com/Disclaimer.html externally
>http://tim.techmahindra.com/tim/disclaimer.html internally within
>TechMahindra.
>
>
>
>   [[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.