[R] Aggregation across two variables in data.table

2017-12-13 Thread Michael Haenlein
Dear all,

I have a data.frame that includes a series of demographic variables for a
set of respondents plus a dependent variable (Theta). For example:

   AgeEducation   Marital Familysize
IncomeHousingTheta
1:  50 Associate degree  Divorced  4
 70K+Owned with mortgage 9.14
2:  65  Bachelor degree   Married  1
10-15K Owned without mortgage 7.345036
3:  33  Bachelor degree   Married  2
30-40KOwned with mortgage 7.974937
4:  69  Bachelor degree Never married  1
 70K+Owned with mortgage 7.733053
5:  54 Some college, less than college graduate Never married  3
30-40K Rented 7.648642
6:  35 Associate degree Separated  2
10-15K Rented 7.496411

My objective is to calculate the average of Theta across all pairs of two
demographics.

For 1 demographic this is straightforward:

Demo_names <- c("Age", "Education", "Marital", "Familysize", "Income",
"Housing")
means1 <- as.list(rep(0, length(Demo_names)))
for (i in 1:length(Demo_names)) {
Demo_tmp <- Demo_names[i]
means1[[i]] <- data_tmp[,list(mean(Theta)),by=Demo_tmp]}

Is there an easy way to extent this logic to more than 1 variable? I know
how to do this manually, e.g.,
data_tmp[,list(mean(Theta)),by=list(Marital, Education)]

But I don't know how to integrate this into a loop.

Thanks,

Michael

[[alternative HTML version deleted]]

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


[R] change in behavior of c.trellis

2017-12-13 Thread Richard M. Heiberger
> library(latticeExtra)
Loading required package: lattice
Loading required package: RColorBrewer
> t11 <- xyplot(1 ~ 1)
> t11
> c(t11, t11)
Warning message:
In formals(fun) : argument is not a function
> version
   _
platform   x86_64-w64-mingw32
arch   x86_64
os mingw32
system x86_64, mingw32
status Patched
major  3
minor  4.3
year   2017
month  12
day12
svn rev73903
language   R
version.string R version 3.4.3 Patched (2017-12-12 r73903)
nickname   Kite-Eating Tree
>


the c.trellis seems to work correctly except for the new warning.

There was no warning in 3.3.3.
I first noticed it in 3.4.1

the c.trellis function itself is not changed between 3.3.3 and 3.4.3 Patched.

__
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] match and new columns

2017-12-13 Thread William Dunlap via R-help
Try the following (which won't work with factors):

> i <- match(tdat$B, tdat$A)
> newColumns <- tdat[i, c("B", "C")]
> newColumns[is.na(newColumns)] <- "0"
> transform(tdat, D=newColumns[["B"]], E=newColumns[["C"]])
A   B   CY   D   E
1 A12 B03 C04 0.70   0   0
2 A23 B05 C06 0.05   0   0
3 A14 B06 C07 1.20   0   0
4 A25 A23 A12 3.51 B05 C06
5 A16 A25 A14 2,16 A23 A12


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Dec 13, 2017 at 5:37 PM, Val  wrote:

> Hi Bill,
>
> I put stringsAsFactors = FALSE
>  still did not work.
>
> tdat <- read.table(textConnection("A B C Y
> A12 B03 C04 0.70
> A23 B05 C06 0.05
> A14 B06 C07 1.20
> A25 A23 A12 3.51
> A16 A25 A14 2,16
> "),header =
> TRUE ,stringsAsFactors = FALSE)
> tdat$D <- 0
> tdat$E <- 0
>
> tdat$D <- (ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0))
> tdat$E <- (ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0))
> tdat
>
> I got this,
>
>  A  B  C   Y   DE1 A12 
>  B03 C04 0.7000
> 2 A23 B05 C06 0.05003 A14 
>  B06 C07 1.2000
> 4 A25 A23 A12 3.51  
> 5 A16 A25 A14 2,16  
>
>
>
>
>
> On Wed, Dec 13, 2017 at 7:23 PM, William Dunlap  wrote:
>
>> Use the stringsAsFactors=FALSE argument to read.table when
>> making your data.frame - factors are getting in your way here.
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>> On Wed, Dec 13, 2017 at 3:02 PM, Val  wrote:
>>
>>> Thank you Rui,
>>> I did not get the desired result. Here is the output from your script
>>>
>>>A   B   CY D E
>>> 1 A12  B03 C04
>>> 0.70 0 0
>>> 2 A23 B05 C06 0.05 0 0
>>> 3 A14  B06 C07
>>> 1.20 0 0
>>> 4 A25 A23 A12 3.51 1 1
>>> 5 A16 A25 A14 2,16 4
>>>  4
>>>
>>>
>>> On Wed, Dec 13, 2017 at 4:36 PM, Rui Barradas 
>>> wrote:
>>>
>>> > Hello,
>>> >
>>> > Here is one way.
>>> >
>>> > tdat$D <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0)
>>> > tdat$E <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0)
>>> >
>>> >
>>> > Hope this helps,
>>> >
>>> > Rui Barradas
>>> >
>>> >
>>> > On 12/13/2017 9:36 PM, Val wrote:
>>> >
>>> >> Hi all,
>>> >>
>>> >> I have a data frame
>>> >> tdat <- read.table(textConnection("A B C Y
>>> >> A12 B03 C04 0.70
>>> >> A23 B05 C06 0.05
>>> >> A14 B06 C07 1.20
>>> >> A25 A23 A12 3.51
>>> >> A16 A25 A14 2,16
>>> "),header =
>>> TRUE)
>>> >>
>>> >> I want match tdat$B with tdat$A and populate the  column   values of
>>> >> tdat$A
>>> >> ( col A and Col B) in the newly created columns (col D and col  E).
>>> >> please
>>> >> find my attempt and the desired output below
>>> >>
>>> >> Desired output
>>> >> A B C Y  D E
>>> >> A12 B03 C04 0.70  0  0
>>> >> A23 B05 C06 0.05  0  0
>>> >> A14 B06 C07 1.20  0  0
>>> >> A25 A23 A12 3.51 B05 C06
>>> >> A16 A25 A14 2,16 A23 A12
>>> 
>>> >>
>>> >> my attempt,
>>> >>
>>> >> tdat$D <- 0
>>> >> tdat$E <- 0
>>> >>
>>> >> if(tdat$B %in% tdat$A)
>>> >>{
>>> >>tdat$D <- tdat$A[tdat$B]
>>> >>tdat$E <- tdat$A[tdat$C]
>>> >> }
>>> >>   but did not work.
>>> >>
>>> >> Thank you in advance
>>> >>
>>> >> [[alternative HTML version deleted]]
>>> >>
>>> >> __
>>> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> >> https://stat.ethz.ch/mailman/listinfo/r-help
>>> >> PLEASE do read the posting guide http://www.R-project.org/posti
>>> >> ng-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/posti
>>> ng-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] match and new columns

2017-12-13 Thread Val
Hi Bill,

I put stringsAsFactors = FALSE
 still did not work.

tdat <- read.table(textConnection("A B C Y
A12 B03 C04 0.70
A23 B05 C06 0.05
A14 B06 C07 1.20
A25 A23 A12 3.51
A16 A25 A14 2,16"),header = TRUE ,stringsAsFactors = FALSE)
tdat$D <- 0
tdat$E <- 0

tdat$D <- (ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0))
tdat$E <- (ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0))
tdat

I got this,

 A  B  C   Y   DE
1 A12 B03 C04 0.7000
2 A23 B05 C06 0.0500
3 A14 B06 C07 1.2000
4 A25 A23 A12 3.51  
5 A16 A25 A14 2,16  





On Wed, Dec 13, 2017 at 7:23 PM, William Dunlap  wrote:

> Use the stringsAsFactors=FALSE argument to read.table when
> making your data.frame - factors are getting in your way here.
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Wed, Dec 13, 2017 at 3:02 PM, Val  wrote:
>
>> Thank you Rui,
>> I did not get the desired result. Here is the output from your script
>>
>>A   B   CY D E
>> 1 A12  B03 C04
>> 0.70 0 0
>> 2 A23 B05 C06 0.05 0 0
>> 3 A14  B06 C07
>> 1.20 0 0
>> 4 A25 A23 A12 3.51 1 1
>> 5 A16 A25 A14 2,16 4
>>  4
>>
>>
>> On Wed, Dec 13, 2017 at 4:36 PM, Rui Barradas 
>> wrote:
>>
>> > Hello,
>> >
>> > Here is one way.
>> >
>> > tdat$D <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0)
>> > tdat$E <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0)
>> >
>> >
>> > Hope this helps,
>> >
>> > Rui Barradas
>> >
>> >
>> > On 12/13/2017 9:36 PM, Val wrote:
>> >
>> >> Hi all,
>> >>
>> >> I have a data frame
>> >> tdat <- read.table(textConnection("A B C Y
>> >> A12 B03 C04 0.70
>> >> A23 B05 C06 0.05
>> >> A14 B06 C07 1.20
>> >> A25 A23 A12 3.51
>> >> A16 A25 A14 2,16
>> "),header =
>> TRUE)
>> >>
>> >> I want match tdat$B with tdat$A and populate the  column   values of
>> >> tdat$A
>> >> ( col A and Col B) in the newly created columns (col D and col  E).
>> >> please
>> >> find my attempt and the desired output below
>> >>
>> >> Desired output
>> >> A B C Y  D E
>> >> A12 B03 C04 0.70  0  0
>> >> A23 B05 C06 0.05  0  0
>> >> A14 B06 C07 1.20  0  0
>> >> A25 A23 A12 3.51 B05 C06
>> >> A16 A25 A14 2,16 A23 A12
>> 
>> >>
>> >> my attempt,
>> >>
>> >> tdat$D <- 0
>> >> tdat$E <- 0
>> >>
>> >> if(tdat$B %in% tdat$A)
>> >>{
>> >>tdat$D <- tdat$A[tdat$B]
>> >>tdat$E <- tdat$A[tdat$C]
>> >> }
>> >>   but did not work.
>> >>
>> >> Thank you in advance
>> >>
>> >> [[alternative HTML version deleted]]
>> >>
>> >> __
>> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> >> https://stat.ethz.ch/mailman/listinfo/r-help
>> >> PLEASE do read the posting guide http://www.R-project.org/posti
>> >> ng-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/posti
>> ng-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] match and new columns

2017-12-13 Thread William Dunlap via R-help
Use the stringsAsFactors=FALSE argument to read.table when
making your data.frame - factors are getting in your way here.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Dec 13, 2017 at 3:02 PM, Val  wrote:

> Thank you Rui,
> I did not get the desired result. Here is the output from your script
>
>A   B   CY D E
> 1 A12 B03 C04 0.70 0 0
> 2 A23 B05 C06 0.05 0 0
> 3 A14 B06 C07 1.20 0 0
> 4 A25 A23 A12 3.51 1 1
> 5 A16 A25 A14 2,16 4 4
>
>
> On Wed, Dec 13, 2017 at 4:36 PM, Rui Barradas 
> wrote:
>
> > Hello,
> >
> > Here is one way.
> >
> > tdat$D <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0)
> > tdat$E <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0)
> >
> >
> > Hope this helps,
> >
> > Rui Barradas
> >
> >
> > On 12/13/2017 9:36 PM, Val wrote:
> >
> >> Hi all,
> >>
> >> I have a data frame
> >> tdat <- read.table(textConnection("A B C Y
> >> A12 B03 C04 0.70
> >> A23 B05 C06 0.05
> >> A14 B06 C07 1.20
> >> A25 A23 A12 3.51
> >> A16 A25 A14 2,16"),header = TRUE)
> >>
> >> I want match tdat$B with tdat$A and populate the  column   values of
> >> tdat$A
> >> ( col A and Col B) in the newly created columns (col D and col  E).
> >> please
> >> find my attempt and the desired output below
> >>
> >> Desired output
> >> A B C Y  D E
> >> A12 B03 C04 0.70  0  0
> >> A23 B05 C06 0.05  0  0
> >> A14 B06 C07 1.20  0  0
> >> A25 A23 A12 3.51 B05 C06
> >> A16 A25 A14 2,16 A23 A12
> >>
> >> my attempt,
> >>
> >> tdat$D <- 0
> >> tdat$E <- 0
> >>
> >> if(tdat$B %in% tdat$A)
> >>{
> >>tdat$D <- tdat$A[tdat$B]
> >>tdat$E <- tdat$A[tdat$C]
> >> }
> >>   but did not work.
> >>
> >> Thank you in advance
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> __
> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide http://www.R-project.org/posti
> >> ng-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] match and new columns

2017-12-13 Thread Val
Thank you Rui,
I did not get the desired result. Here is the output from your script

   A   B   CY D E
1 A12 B03 C04 0.70 0 0
2 A23 B05 C06 0.05 0 0
3 A14 B06 C07 1.20 0 0
4 A25 A23 A12 3.51 1 1
5 A16 A25 A14 2,16 4 4


On Wed, Dec 13, 2017 at 4:36 PM, Rui Barradas  wrote:

> Hello,
>
> Here is one way.
>
> tdat$D <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0)
> tdat$E <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0)
>
>
> Hope this helps,
>
> Rui Barradas
>
>
> On 12/13/2017 9:36 PM, Val wrote:
>
>> Hi all,
>>
>> I have a data frame
>> tdat <- read.table(textConnection("A B C Y
>> A12 B03 C04 0.70
>> A23 B05 C06 0.05
>> A14 B06 C07 1.20
>> A25 A23 A12 3.51
>> A16 A25 A14 2,16"),header = TRUE)
>>
>> I want match tdat$B with tdat$A and populate the  column   values of
>> tdat$A
>> ( col A and Col B) in the newly created columns (col D and col  E).
>> please
>> find my attempt and the desired output below
>>
>> Desired output
>> A B C Y  D E
>> A12 B03 C04 0.70  0  0
>> A23 B05 C06 0.05  0  0
>> A14 B06 C07 1.20  0  0
>> A25 A23 A12 3.51 B05 C06
>> A16 A25 A14 2,16 A23 A12
>>
>> my attempt,
>>
>> tdat$D <- 0
>> tdat$E <- 0
>>
>> if(tdat$B %in% tdat$A)
>>{
>>tdat$D <- tdat$A[tdat$B]
>>tdat$E <- tdat$A[tdat$C]
>> }
>>   but did not work.
>>
>> Thank you in advance
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-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: [ESS] problem starting help in ESS

2017-12-13 Thread William McCoy
Today I removed the Fedora ESS packages from both of the computers on 
which I have been having trouble.  I installed ESS 17.11 from Melpa on 
both of them.  I used Melpa just because I had some other packages from 
there that I have been using with my Emacs installations and it would be 
easy to add ESS to that list.  So anyway my problem goes away on both 
computers with this new setup.


I'm still not sure what was wrong before.  I saw no bugs at all reported 
on the Fedora bugzilla site regarding their ESS package for Fedora 27. 
If I get time tomorrow I will report the problem to bugzilla.


Thanks a lot to Rodney for his help.  Now I can get to work!


On 12/13/2017 10:02 AM, Sparapani, Rodney wrote:

Hi Will:

MELPA sounds ok, but I don’t know if we control that either.  As far as I know,
we only control the source itself.  If you are having trouble with the Fedora
version of ESS (or the Melpa version), then you report the errors to them and
not to us.





--
Rodney Sparapani, PhD
Assistant Professor of Biostatistics
Medical College of Wisconsin, Milwaukee

-Original Message-
From: William McCoy 
Date: Tuesday, December 12, 2017 at 7:37 PM
To: Rodney Sparapani 
Subject: Re: [ESS] problem starting help in ESS

Thanks, Rodney.  Maybe tomorrow I will get a chance to try out ESS
17.11.  Perhaps I will install it from Melpa Stable.  Do you think that
is a good way?

Also, I should mention that if I am in an ESS buffer using R, I can use

C-c C-e C-d to dump an existing object (or create a new object) to an
emacsclient session with no problem.  Everything works as documented in
that regard.  So it seems quite strange that I can't dump the R help files.

I should also mention that I have exactly the same issue with ESS, emacs

and R on another computer running Fedora 27.

Anyway, thanks again for your help.  I will keep you informed with what

I find.  And in the meantime if anyone else has any ideas, let me know.
I'm surprised this problem doesn't seem to have come up before.  That
makes me think I have something very peculiar about my setup.

Bill






--
William D. McCoy
Geosciences
University of Massachusetts
Amherst, MA 01003

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

Re: [R] match and new columns

2017-12-13 Thread Rui Barradas

Hello,

Here is one way.

tdat$D <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0)
tdat$E <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0)


Hope this helps,

Rui Barradas

On 12/13/2017 9:36 PM, Val wrote:

Hi all,

I have a data frame
tdat <- read.table(textConnection("A B C Y
A12 B03 C04 0.70
A23 B05 C06 0.05
A14 B06 C07 1.20
A25 A23 A12 3.51
A16 A25 A14 2,16"),header = TRUE)

I want match tdat$B with tdat$A and populate the  column   values of tdat$A
( col A and Col B) in the newly created columns (col D and col  E).  please
find my attempt and the desired output below

Desired output
A B C Y  D E
A12 B03 C04 0.70  0  0
A23 B05 C06 0.05  0  0
A14 B06 C07 1.20  0  0
A25 A23 A12 3.51 B05 C06
A16 A25 A14 2,16 A23 A12

my attempt,

tdat$D <- 0
tdat$E <- 0

if(tdat$B %in% tdat$A)
   {
   tdat$D <- tdat$A[tdat$B]
   tdat$E <- tdat$A[tdat$C]
}
  but did not work.

Thank you in advance

[[alternative HTML version deleted]]

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



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


Re: [ESS] connection to Oracle does not work in ESS

2017-12-13 Thread Vitalie Spinu

Hi Stephen,

I doubt it's problem with ESS. Running R from emacs shell and with ESS should be
equivalent. Make sure that it's indeed the same R instance and RODBC what are
called in your experiments. Do you have a custom inferior-ess-r-program-name
setup?

Do you issue Rterm or R in the emacs shell?

  Vitalie

>> On Wed, Dec 13 2017 22:23, Bond, Stephen wrote:

> Further info:

> When I use Rterm in a cmd shell the connection works.
> When I use Rterm in a shell within Emacs the connection works.
> Something must be going wrong in the way ESS does things.

> Stephen

> From: Bond, Stephen
> Sent: Wednesday, December 13, 2017 12:53 PM
> To: 'ess-help@r-project.org'
> Subject: connection to Oracle does not work in ESS

> On 64-bit win7:

> I have a DSN which tests successfully in control panel. I can connect from 
> RGui with:
> con=odbcConnect("DSNname",uid="myuid",pwd="mypass")

> it does not work in ESS:

> R version 3.4.2 (2017-09-28) -- "Short Summer"
> Copyright (C) 2017 The R Foundation for Statistical Computing
> Platform: x86_64-w64-mingw32/x64 (64-bit)

>> > options(chmhelp=FALSE, help_type="text")
>> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient.exe', 
>> show.error.locations=TRUE)
>> library(RODBC)
>> con=odbcConnect("DSNname",uid="myuid",pwd="mypass")

> Warning messages:
> 1: In RODBC::odbcDriverConnect() :
>   [RODBC] ERROR: state 08004, code 12154, message 
> [Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve the connect identifier 
> specified
> 2: In RODBC::odbcDriverConnect() :
>   ODBC connection failed

> I have all the paths setup and the driver is installed correctly. Tnsping 
> finds the db.

> Let me know if anybody can help.

> Stephen

>   [[alternative HTML version deleted]]

> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R] difference between ifelse and if...else?

2017-12-13 Thread MacQueen, Don
Because ifelse is not intended to be an alternative to if ... else. They exist 
for different purposes.

(besides the other replies, a careful reading of their help pages, and trying 
the examples, should explain the different purposes).

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 

On 12/13/17, 7:31 AM, "R-help on behalf of Jinsong Zhao" 
 wrote:

Hi there,

I don't know why the following codes are return different results.

 > ifelse(3 > 2, 1:3, length(1:3))
[1] 1
 > if (3 > 2) 1:3 else length(1:3)
[1] 1 2 3

Any hints?

Best,
Jinsong

__
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] match and new columns

2017-12-13 Thread Val
Hi all,

I have a data frame
tdat <- read.table(textConnection("A B C Y
A12 B03 C04 0.70
A23 B05 C06 0.05
A14 B06 C07 1.20
A25 A23 A12 3.51
A16 A25 A14 2,16"),header = TRUE)

I want match tdat$B with tdat$A and populate the  column   values of tdat$A
( col A and Col B) in the newly created columns (col D and col  E).  please
find my attempt and the desired output below

Desired output
A B C Y  D E
A12 B03 C04 0.70  0  0
A23 B05 C06 0.05  0  0
A14 B06 C07 1.20  0  0
A25 A23 A12 3.51 B05 C06
A16 A25 A14 2,16 A23 A12

my attempt,

tdat$D <- 0
tdat$E <- 0

if(tdat$B %in% tdat$A)
  {
  tdat$D <- tdat$A[tdat$B]
  tdat$E <- tdat$A[tdat$C]
}
 but did not work.

Thank you in advance

[[alternative HTML version deleted]]

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


[R] running Cox regression model for 1000 markers

2017-12-13 Thread Ding, Yuan Chun
HI All,

Sorry to bother you.

I have a data matrix with 1000 genes in rows and 100 samples in columns;  I 
need to run Cox regression model for each of the 1000 markers.  I know how to 
run Cox regression model for individual marker. Does anyone know a R package or 
method to run Cox model for those 1000 markers and then output results in a 
data frame?

Thank you,

Ding


-
-SECURITY/CONFIDENTIALITY WARNING-
This message (and any attachments) are intended solely f...{{dropped:22}}

__
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] Best R GUIs

2017-12-13 Thread Wensui Liu
how could you miss emacs + ess?

On Wed, Dec 13, 2017 at 5:04 AM, Juan Telleria  wrote:

> Dear R Community Members,
>
> I would like to add to one article I have written the best Graphical User
> Interfaces the R programming language has.
>
> For the moment I know:
> A) Rstudio.
> B) R Tools for Visual Studio.
> C) Open Analytics Architect.
>
> Are there others worth to mention?
>
> Thank you.
>
> Kind regards,
> Juan Telleria
>
> [[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] Add vectors of unequal length without recycling?

2017-12-13 Thread William Michels via R-help
Maingo,

See previous discussion below on rbind.na() and cbind.na() scripts:

https://stat.ethz.ch/pipermail/r-help/2016-December/443790.html

You might consider binding first then adding orthogonally.
So rbind.na() then colSums(), OR cbind.na() then rowSums().

Best of luck,

W Michels, Ph.D.



On Wed, Dec 13, 2017 at 8:34 AM, William Dunlap via R-help
 wrote:
> Without recycling you would get:
> u <- c(10, 20, 30)
> u + 1
> #[1] 11 20 30
> which would be pretty inconvenient.
>
> (Note that the recycling rule has to make a special case for when one
> argument has length zero - the output then has length zero as well.)
>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Tue, Dec 12, 2017 at 9:41 PM, Maingo via R-help 
> wrote:
>
>> I'm a newbie for R lang. And I recently came across the "Recycling Rule"
>> when adding two vectors of unequal length.
>>
>> I learned from this tutor [ http://www.r-tutor.com/r-
>> introduction/vector/vector-arithmetics ] that:
>>
>> ""
>>
>> If two vectors are of unequal length, the shorter one will be recycled in
>> order to match the longer vector. For example, the following vectors u and
>> v have different lengths, and their sum is computed by recycling values of
>> the shorter vector u.
>>
>> > u = c(10, 20, 30)
>>
>> > v = c(1, 2, 3, 4, 5, 6, 7, 8, 9)
>>
>> > u + v
>>
>> [1] 11 22 33 14 25 36 17 28 39
>>
>> ""
>>
>> And I wondered, why the shorter vecter u should be recycled? Why not just
>> leave the extra values(4,5,6,7,8,9) in the longer vector untouched by
>> default?
>>
>> Otherwise is it better to have another function that could add vectors
>> without recycling? Right now the recycling feature bugs me a lot.
>>
>> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/
>> posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[ESS] connection to Oracle does not work in ESS

2017-12-13 Thread Bond, Stephen
On 64-bit win7:

I have a DSN which tests successfully in control panel. I can connect from RGui 
with:
con=odbcConnect("DSNname",uid="myuid",pwd="mypass")

it does not work in ESS:

R version 3.4.2 (2017-09-28) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)


> > options(chmhelp=FALSE, help_type="text")
> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient.exe', 
> show.error.locations=TRUE)
> library(RODBC)
> con=odbcConnect("DSNname",uid="myuid",pwd="mypass")


Warning messages:
1: In RODBC::odbcDriverConnect() :
  [RODBC] ERROR: state 08004, code 12154, message [Oracle][ODBC][Ora]ORA-12154: 
TNS:could not resolve the connect identifier specified
2: In RODBC::odbcDriverConnect() :
  ODBC connection failed

I have all the paths setup and the driver is installed correctly. Tnsping finds 
the db.

Let me know if anybody can help.

Stephen


[[alternative HTML version deleted]]

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R-es] Resumen de R-help-es, Vol 106, Envío 13

2017-12-13 Thread Ernesto Jimenez Garrido
Estimado grupo,

Hay alguien que pueda compartir proyecto de filtros para se�ales que 
identifiquen si los pacientes estan sanos o enfermos en pruebas de respiraci�n 
forzada?

Estar�a muy agradecido.

Soy un usuario antiguo, que con los a�os (soy mayor de 65) he perdido capacidad 
y memoria y ahora ando un poco perdido sin saber por donde empezar.

El bucle for me trae martirizado


Ernest Jim�nez Garrido

De: R-help-es  de part de 
r-help-es-requ...@r-project.org 
Enviat el: dimecres, 13 de desembre de 2017 0:27:30
Per a: r-help-es@r-project.org
Tema: Resumen de R-help-es, Vol 106, Env�o 13

Env�e los mensajes para la lista R-help-es a
r-help-es@r-project.org

Para subscribirse o anular su subscripci�n a trav�s de la WEB
https://stat.ethz.ch/mailman/listinfo/r-help-es

O por correo electr�nico, enviando un mensaje con el texto "help" en
el asunto (subject) o en el cuerpo a:
r-help-es-requ...@r-project.org

Puede contactar con el responsable de la lista escribiendo a:
r-help-es-ow...@r-project.org

Si responde a alg�n contenido de este mensaje, por favor, edite la
linea del asunto (subject) para que el texto sea mas especifico que:
"Re: Contents of R-help-es digest...". Adem�s, por favor, incluya en
la respuesta s�lo aquellas partes del mensaje a las que est�
respondiendo.


Asuntos del d�a:

   1. usuarios y contrase�as (Javier Marcuzzi)
   2. Estimada comunidad, queria pedirles ayuda porque realmente
  llevo muchas horas tratando de hacer algo que debe ser simple, y
  por eso mismo ya me esta frustrando ... (eric)
   3. Re: Estimada comunidad, queria pedirles ayuda porque
  realmente llevo muchas horas tratando de hacer algo que debe ser
  simple, y por eso mismo ya me esta frustrando ...
  (Jes�s Para Fern�ndez)
   4. Heat map sin geodatos (Alex)
   5. Re: Heat map sin geodatos (Carlos J. Gil Bellosta)


--

Message: 1
Date: Tue, 12 Dec 2017 14:05:48 -0300
From: Javier Marcuzzi 
To: r-help-es@r-project.org
Subject: [R-es] usuarios y contrase�as
Message-ID:

Content-Type: text/plain; charset="UTF-8"

Estimados

No es justo R pero puede ser por seguridad o como material para an�lisis,
en el siguiente link est� la filtraci�n de 40 GB de usuarios y contrase�as,
con algo de estad�stica sobre un patr�n de cambio de estas.

Por otro lado en el siguiente link est� desde donde vi la informaci�n y una
herramienta para consultar si vuestra direcci�n de correo est� en ese base
de datos sin tener que descargar los 40 GB.

Algo que no comprendo bien, en su momento al haber una filtraci�n yo
comprob� y no figuraba mi cuenta, ahora mi correo figura en la filtraci�n
de la empresa a la cu�l comprob�. Cambiar� nuevamente mi password, la
verdad que no, ni yo las recuerdo porque no coloco cosas importantes, lo
realmente importante lo protejo, salvo LinkedIn el resto no tiene
importancia par mi caso.

https://medium.com/4iqdelvedeep/1-4-billion-clear-text-credentials-discovered-in-a-single-database-3131d0a1ae14

www.genbeta.com

[[alternative HTML version deleted]]



--

Message: 2
Date: Tue, 12 Dec 2017 17:32:26 -0300
From: eric 
To: Lista R 
Subject: [R-es] Estimada comunidad, queria pedirles ayuda porque
realmente llevo muchas horas tratando de hacer algo que debe ser
simple, y por eso mismo ya me esta frustrando ...
Message-ID: <7d009f53-1ef8-39d8-ab30-495080703...@gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Se ha borrado un adjunto en formato HTML...
URL: 


--

Message: 3
Date: Tue, 12 Dec 2017 22:40:06 +
From: Jes�s Para Fern�ndez 
To: eric , Lista R

Subject: Re: [R-es] Estimada comunidad, queria pedirles ayuda porque
realmente llevo muchas horas tratando de hacer algo que debe ser
simple, y por eso mismo ya me esta frustrando ...
Message-ID:



Content-Type: text/plain; charset="UTF-8"

Con el paquete data.table, el cual creo que estas usando, deberia valerte.

Has probado a hacer lo siguietne:

filas<-datos[muertos== "SI" ,.N]
datos[,.(.N/filas),by=.(a?o,causa.muerte)]


De todos modos, si nos pasass un dataset para poder verlo, te ayudaremos mucho 
mejor.

Un saludo
Jes?s

De: R-help-es  en nombre de eric 

Enviado: martes, 12 de diciembre de 

Re: [R] difference between ifelse and if...else?

2017-12-13 Thread Duncan Murdoch

On 13/12/2017 10:31 AM, Jinsong Zhao wrote:

Hi there,

I don't know why the following codes are return different results.

  > ifelse(3 > 2, 1:3, length(1:3))
[1] 1
  > if (3 > 2) 1:3 else length(1:3)
[1] 1 2 3

Any hints?


The documentation in the help page ?ifelse and ?"if" explains it pretty 
clearly.  Think of ifelse() as a function with vector inputs and a 
vector output, and if() as a flow control construction.


Duncan Murdoch

__
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] Add vectors of unequal length without recycling?

2017-12-13 Thread William Dunlap via R-help
Without recycling you would get:
u <- c(10, 20, 30)
u + 1
#[1] 11 20 30
which would be pretty inconvenient.

(Note that the recycling rule has to make a special case for when one
argument has length zero - the output then has length zero as well.)


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Dec 12, 2017 at 9:41 PM, Maingo via R-help 
wrote:

> I'm a newbie for R lang. And I recently came across the "Recycling Rule"
> when adding two vectors of unequal length.
>
> I learned from this tutor [ http://www.r-tutor.com/r-
> introduction/vector/vector-arithmetics ] that:
>
> ""
>
> If two vectors are of unequal length, the shorter one will be recycled in
> order to match the longer vector. For example, the following vectors u and
> v have different lengths, and their sum is computed by recycling values of
> the shorter vector u.
>
> > u = c(10, 20, 30)
>
> > v = c(1, 2, 3, 4, 5, 6, 7, 8, 9)
>
> > u + v
>
> [1] 11 22 33 14 25 36 17 28 39
>
> ""
>
> And I wondered, why the shorter vecter u should be recycled? Why not just
> leave the extra values(4,5,6,7,8,9) in the longer vector untouched by
> default?
>
> Otherwise is it better to have another function that could add vectors
> without recycling? Right now the recycling feature bugs me a lot.
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
> [[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: [ESS] [R] M-x R gives no choice of starting dir

2017-12-13 Thread Paul Johnson
If Emacs is not asking for starting directory, it is very likely your
init file has this somewhere:

(setq ess-ask-for-ess-directory nil)


On Mon, Sep 11, 2017 at 3:23 PM, Enrico Schumann  
wrote:
> On Mon, 11 Sep 2017, Christian writes:
>
>> Hi,
>>
>> I experienced a sudden change in the behavior of M-x R in not giving
>> me the choice where to start R. May be that I botched my
>> preferences. I am using Aquamacs 3.3 on MacOS 10.12.6
>>
>> Christian
>
> I suppose you are using ESS? There is a variable called
> 'ess-ask-for-ess-directory', which controls whether
> M-x R prompts for a directory. Perhaps you have set
> this to nil?
>
> I also Cc the ESS-help mailing list and suggest that
> follow-up be sent there.
>
>
> Kind regards
>  Enrico
>
> --
> Enrico Schumann
> Lucerne, Switzerland
> http://enricoschumann.net
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



-- 
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu.

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R] [ESS] M-x R gives no choice of starting dir

2017-12-13 Thread Paul Johnson
If Emacs is not asking for starting directory, it is very likely your
init file has this somewhere:

(setq ess-ask-for-ess-directory nil)


On Mon, Sep 11, 2017 at 3:23 PM, Enrico Schumann  
wrote:
> On Mon, 11 Sep 2017, Christian writes:
>
>> Hi,
>>
>> I experienced a sudden change in the behavior of M-x R in not giving
>> me the choice where to start R. May be that I botched my
>> preferences. I am using Aquamacs 3.3 on MacOS 10.12.6
>>
>> Christian
>
> I suppose you are using ESS? There is a variable called
> 'ess-ask-for-ess-directory', which controls whether
> M-x R prompts for a directory. Perhaps you have set
> this to nil?
>
> I also Cc the ESS-help mailing list and suggest that
> follow-up be sent there.
>
>
> Kind regards
>  Enrico
>
> --
> Enrico Schumann
> Lucerne, Switzerland
> http://enricoschumann.net
>
> __
> ess-h...@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



-- 
Paul E. Johnson   http://pj.freefaculty.org
Director, Center for Research Methods and Data Analysis http://crmda.ku.edu

To write to me directly, please address me at pauljohn at ku.edu.

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


[ESS] how to change the default ess-style?

2017-12-13 Thread Joshua N Pritikin
I'm trying to persuade ess to use the RStudio- style by default. I 
upgraded to ess-17.11 (emacs 24.5+1-11+deb9u1). I tried some solutions 
suggested here,

https://stackoverflow.com/questions/7502540/make-emacs-ess-follow-r-style-guide

This one does something bad and every other attempt to load a file fails,

(add-hook 'find-file-hook 'my-r-style-hook)
(defun my-r-style-hook ()
  (when (string-match (file-name-extension buffer-file-name) "[r|R]$")
(ess-set-style 'RStudio)))

I tried this one,

(add-hook 'ess-mode-hook 
  (lambda () 
(ess-set-style 'RStudio-)
(setq ess-offset-arguments 'prev-line)))

It seems to do something,

ess-style is a variable defined in `ess-custom.el'.
Its value is RStudio-
Local in buffer MxAlgebra.R; global value is RRR

but the indention style still doesn't even remotely match RStudio.

Can somebody provide some elisp that works?

Thank you.

-- 
Joshua N. Pritikin, Ph.D.
Virginia Institute for Psychiatric and Behavioral Genetics
Virginia Commonwealth University
PO Box 980126
800 E Leigh St, Biotech One, Suite 1-133
Richmond, VA 23219
http://exuberant-island.surge.sh

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R] difference between ifelse and if...else?

2017-12-13 Thread Eric Berger
ifelse returns the "shape" of the first argument

In your ifelse the shape of "3 > 2" is a vector of length one, so it will
return a vector length one.

Avoid "ifelse" until you are very comfortable with it. It can often burn
you.




On Wed, Dec 13, 2017 at 5:33 PM, jeremiah rounds 
wrote:

> ifelse is vectorized.
>
> On Wed, Dec 13, 2017 at 7:31 AM, Jinsong Zhao  wrote:
>
> > Hi there,
> >
> > I don't know why the following codes are return different results.
> >
> > > ifelse(3 > 2, 1:3, length(1:3))
> > [1] 1
> > > if (3 > 2) 1:3 else length(1:3)
> > [1] 1 2 3
> >
> > Any hints?
> >
> > Best,
> > Jinsong
> >
> > __
> > 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/posti
> > ng-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] difference between ifelse and if...else?

2017-12-13 Thread jeremiah rounds
ifelse is vectorized.

On Wed, Dec 13, 2017 at 7:31 AM, Jinsong Zhao  wrote:

> Hi there,
>
> I don't know why the following codes are return different results.
>
> > ifelse(3 > 2, 1:3, length(1:3))
> [1] 1
> > if (3 > 2) 1:3 else length(1:3)
> [1] 1 2 3
>
> Any hints?
>
> Best,
> Jinsong
>
> __
> 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/posti
> ng-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] difference between ifelse and if...else?

2017-12-13 Thread Jinsong Zhao

Hi there,

I don't know why the following codes are return different results.

> ifelse(3 > 2, 1:3, length(1:3))
[1] 1
> if (3 > 2) 1:3 else length(1:3)
[1] 1 2 3

Any hints?

Best,
Jinsong

__
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] Best R GUIs

2017-12-13 Thread Juan Telleria
Thank you all, some of the best free IDEs are specified in the following
article:

http://www.linuxlinks.com/article/20110306113701179/GUIsforR.html

Plus pluggable IDEs:
A) ESS for Emacs
B) IRkernel for Jupyter notebooks
C) StatET for Eclipse
D) Vim-R for vim


Kind regards,
Juan

[[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] Best R GUIs

2017-12-13 Thread Mehta, Gaurang
Hi Zahn,
I thought Shiny package in R was the GUI equivalent for R applications.
Tools such as Rstudio is an IDE (integrated development environment) to me.
Regards,
Gaurang Mehta

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ista Zahn
Sent: 13 December 2017 12:03
To: Juan Telleria
Cc: r-help@r-project.org
Subject: Re: [R] Best R GUIs

On Dec 13, 2017 6:05 AM, "Juan Telleria"  wrote:

Dear R Community Members,

I would like to add to one article I have written the best Graphical User 
Interfaces the R programming language has.

For the moment I know:
A) Rstudio.
B) R Tools for Visual Studio.
C) Open Analytics Architect.


Many editors have plugins for working with R, including

D) ESS for Emacs
E) IRkernel for Jupyter notebooks
F) StatET for Eclipse
G) Vim-R for vim


Are there others worth to mention?

Thank you.

Kind regards,
Juan Telleria

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

This email is intended for the person or company named and access by anyone 
else is unauthorised. If you are not the person or company named, please delete 
this email and notify the sender.

The information in this email, including any attachments, may be confidential 
or legally privileged (meaning that its disclosure is protected in law). Its 
unauthorised disclosure, copying, distribution or use is prohibited and may be 
unlawful.

Email communications sent over the internet are not guaranteed to be secure or 
virus-free and such messages are potentially at risk.  The Royal London Group 
accepts no liability for any claims arising from use of the internet to 
transmit messages by or to any company within the Royal London Group.

The Royal London Group consists of The Royal London Mutual Insurance Society 
Limited and its subsidiaries.

The Royal London Mutual Insurance Society Limited is authorised by the 
Prudential Regulation Authority and regulated by the Financial Conduct 
Authority and the Prudential Regulation Authority and provides life assurance 
and pensions.

Registered in England and Wales number 99064.

Registered office: 55 Gracechurch Street, London, EC3V 0RL.

In the Republic of Ireland: The Royal London Mutual Insurance Society Limited 
is authorised by the Prudential Regulation Authority in the UK and is regulated 
by the Central Bank of Ireland for conduct of business rules.

__
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] overlay two histograms ggplot

2017-12-13 Thread Elahe chalabi via R-help
Hi all,

How can I overlay these two histograms? 

ggplot(gg, aes(gg$Alz, fill = gg$veg)) + geom_histogram(alpha = 0.2)
ggplot(tt, aes(tt$Cont, fill = tt$veg)) + geom_histogram(alpha = 0.2)

thanks for any help!
Elahe

__
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] Best R GUIs

2017-12-13 Thread Ista Zahn
On Dec 13, 2017 6:05 AM, "Juan Telleria"  wrote:

Dear R Community Members,

I would like to add to one article I have written the best Graphical User
Interfaces the R programming language has.

For the moment I know:
A) Rstudio.
B) R Tools for Visual Studio.
C) Open Analytics Architect.


Many editors have plugins for working with R, including

D) ESS for Emacs
E) IRkernel for Jupyter notebooks
F) StatET for Eclipse
G) Vim-R for vim


Are there others worth to mention?

Thank you.

Kind regards,
Juan Telleria

[[alternative HTML version deleted]]

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

[[alternative HTML version deleted]]

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


[R] Best R GUIs

2017-12-13 Thread Juan Telleria
Dear R Community Members,

I would like to add to one article I have written the best Graphical User
Interfaces the R programming language has.

For the moment I know:
A) Rstudio.
B) R Tools for Visual Studio.
C) Open Analytics Architect.

Are there others worth to mention?

Thank you.

Kind regards,
Juan Telleria

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