From: John Fox <jfox_at_mcmaster.ca>

Date: Wed, 16 Jun 2010 09:03:36 -0400

R-help_at_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. Received on Wed 16 Jun 2010 - 13:06:24 GMT

Date: Wed, 16 Jun 2010 09:03:36 -0400

Dear Alain,

*> -----Original Message-----
*

> From: Alain Guillet [mailto:alain.guillet@uclouvain.be]

*> Sent: June-16-10 8:30 AM
**> To: John Fox
**> Cc: r-help_at_r-project.org
**> Subject: Re: [R] Problem with the recode function
**>
**> Dear John,
**>
**> Thanks a lot for the time you spent on my problem. I don't believe you
**> can do something to avoid this kind of problem.
**>
**> I don't know if it is technically possible but I wonder if when we load
**> Rcmdr plug-ins from the Rcmdr menu, it wouldn't be possible during the
**> restart of Rmcdr to detach the package used by Rcmdr in order to load
**> them after the packages used by the plug-ins in order to at least avoid
**> to break Rmcdr (in breaking I mean to prevent from using Rcmdr functions
**> like recode (from car) in my example).
*

As I said, I'll think about whether something can be done to solve the problem, but I don't think that this approach will work, even if it were feasible (the Rcmdr doesn't keep track of the packages that are loaded by dialogs and even if it did, if wouldn't know about packages that are loaded as dependencies of these). For example, the Rcmdr previously detached the rgl package before closing the Commander window and this created problems for some plug-in packages.

Best,

John

*>
**> Regards,
*

> Alain

*>
**>
**>
**> On 15-Jun-10 21:37, John Fox wrote:
**> > Dear Alain,
**> >
**> >
**> >> -----Original Message-----
**> >> From: Alain Guillet [mailto:alain.guillet_at_uclouvain.be]
**> >> Sent: June-15-10 12:25 PM
**> >> To: John Fox
**> >> Cc: r-help_at_r-project.org
**> >> Subject: Re: [R] Problem with the recode function
**> >>
**> >> I found out what the problem is: when I start R Commander, some
*

plug-ins

> >> are automatically loaded and it seems that the problem comes from the

*> >> RcmdrPlugin.Export, more precisely from the Hmisc package (the plug-in
**> >> depends on it) which contains a recode() function too with the
*

following

> >> documentation :

*> >>
**> > That makes sense of the problem, but I'm not sure what I can about it --
**> > that is, there's always the possibility that someone will load a package
**> > that shadows a function in another package. I'll think some more about
*

the

*> > problem.
**> >
**> > Best,
*

> > John

*> >
**> >
**> >> Hmisc-internal package:Hmisc R Documentation
**> >> Internal Hmisc functions
**> >> Description:
**> >> Internal Hmisc functions.
**> >> Details:
**> >> These are not to be called by the user or are undocumented.
**> >>
**> >>
**> >> Alain
**> >>
**> >>
**> >>
**> >>
**> >>
**> >> On 15-Jun-10 17:53, John Fox wrote:
**> >>
**> >>> Dear Alain,
**> >>>
**> >>> I'm afraid that I can't duplicate your problem. First, there is no
**> >>>
**> > recode
**> >
**> >>> function in the Rcmdr package; it uses recode from car.
**> >>>
**> >>> Here's a record of my Rcmdr session, using the recode dialog to
*

generate

*> >>>
*

> >> the

*> >>
**> >>> recode command:
**> >>>
**> >>>
**> >>>
**> >>>> test$variable<- recode(test$x, '1:5=0; else=1; ',
**> >>>>
**> > as.factor.result=TRUE)
**> >
**> >>>>
**> >>>
**> >>>> test # entered in script window
**> >>>>
**> >>>>
**> >>> x variable
**> >>> 1 1 0
**> >>> 2 2 0
**> >>> 3 3 0
**> >>> 4 4 0
**> >>> 5 5 0
**> >>> 6 6 1
**> >>> 7 7 1
**> >>> 8 8 1
**> >>> 9 9 1
**> >>> 10 10 1
**> >>>
**> >>> I noticed that you set as.factor.result=TRUE for one command and FALSE
**> >>>
**> > for
**> >
**> >>> the other, but both work for me. It occurred to me that you may have
**> >>>
**> >> entered
**> >>
**> >>> the recode command in the script window and executed it from there,
*

but

*> >>>
*

> >> that

*> >>
**> >>> works for me too.
**> >>>
**> >>> Best,
**> >>> John
**> >>>
**> >>> --------------------------------
**> >>> John Fox
**> >>> Senator William McMaster
**> >>> Professor of Social Statistics
**> >>> Department of Sociology
**> >>> McMaster University
**> >>> Hamilton, Ontario, Canada
**> >>> web: socserv.mcmaster.ca/jfox
**> >>>
**> >>>
**> >>>
**> >>>
**> >>>> -----Original Message-----
**> >>>> From: r-help-bounces_at_r-project.org
**> >>>>
**> > [mailto:r-help-bounces_at_r-project.org]
**> >
**> >>>>
**> >>> On
**> >>>
**> >>>
**> >>>> Behalf Of Alain Guillet
**> >>>> Sent: June-15-10 10:58 AM
**> >>>> To: r-help_at_r-project.org
**> >>>> Subject: [R] Problem with the recode function
**> >>>>
**> >>>> Hello,
**> >>>>
**> >>>> I am using the recode() function in Rcmdr and the result is not what
*

I

> >>>> expect so I am almost sure I did something wrong but what...

*> >>>>
**> >>>> > test<- data.frame(x=1:10)
**> >>>> > library(car)
**> >>>> > recode(test$x,'1:5=0 ; else=1', as.factor.result=TRUE)
**> >>>> [1] 0 0 0 0 0 1 1 1 1 1
**> >>>> Levels: 0 1
**> >>>>
**> >>>> BUT
**> >>>>
**> >>>> > library(Rcmdr) # recode from the car package is now masked
**> >>>>
**> >>>> Now I recode test$x through the Rmcdr interface and I get the
*

following

> >>>> code :

*> >>>> test$variable<- recode(test$x, '1:5 = 0; else = 1; ',
**> >>>> as.factor.result=FALSE)
**> >>>> And a vector of NA as result.
**> >>>>
**> >>>> > test$variable
**> >>>> [1] NA NA NA NA NA NA NA NA NA NA
**> >>>>
**> >>>> I am using R 2.11.1 with Rcmdr 1.5-5 on Windows Vista.
**> >>>>
**> >>>>
**> >>>> Regards,
**> >>>> Alain
**> >>>>
**> >>>> --
**> >>>> Alain Guillet
**> >>>> Statistician and Computer Scientist
**> >>>>
**> >>>> SMCS - IMMAQ - Université catholique de Louvain
**> >>>> Bureau c.316
**> >>>> Voie du Roman Pays, 20
**> >>>> B-1348 Louvain-la-Neuve
**> >>>> Belgium
**> >>>>
**> >>>> tel: +32 10 47 30 50
**> >>>>
**> >>>> ______________________________________________
**> >>>> R-help_at_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.
**> >>>>
**> >>>>
**> >>>
**> >>>
**> >>>
**> >> --
**> >> Alain Guillet
**> >> Statistician and Computer Scientist
**> >>
**> >> SMCS - IMMAQ - Université catholique de Louvain
**> >> Bureau c.316
**> >> Voie du Roman Pays, 20
**> >> B-1348 Louvain-la-Neuve
**> >> Belgium
**> >>
**> >> tel: +32 10 47 30 50
**> >>
**> >
**> >
**> >
**> >
**>
**> --
**> Alain Guillet
**> Statistician and Computer Scientist
**>
**> SMCS - IMMAQ - Université catholique de Louvain
**> Bureau c.316
**> Voie du Roman Pays, 20
**> B-1348 Louvain-la-Neuve
**> Belgium
**>
**> tel: +32 10 47 30 50
*

R-help_at_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. Received on Wed 16 Jun 2010 - 13:06:24 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Wed 16 Jun 2010 - 13:10:32 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*