[R] Help on Select.list
David Winsemius
dwinsemius at comcast.net
Fri Sep 3 15:30:00 CEST 2010
On Sep 3, 2010, at 8:59 AM, Ravi S. Shankar wrote:
> Hi David,
> Thank you for your response. But that wasn't what I was looking for.
> names=c("Ravi", "Raj","Shubha","Nivriti")
> select.list(names) gives a pop up with the 4 names. I just wanted in
> the pop up a heading (say BOYS) followed by two names and another
> heading (say GIRLS) and the remaining two names.
>
> Is there a way I can include headings in the select.list()
Sorry. that function was not in my experience. You could include the
headings in the list perhaps with some message saying that the
headings are not a legitimate choice. I looked at the code for
select.list and doubt that you can enforce the advice with anything in
the select.list parameters. The vector gets handed off pretty quickly
to .Internal functions You would need to handle undesired user
behavior programatically:
names=c("Boys~(Do not choose)", "Ravi", "Raj","Girls~(Do not choose)",
"Shubha","Nivriti")
select.list(names)
If you wanted more control ove rthe behavior I think you would need to
work with : tk_select.list {tcltk}
--
David
>
>
> Thank you once again for the help.
> Regards
> Ravi
>
> -----Original Message-----
> From: David Winsemius [mailto:dwinsemius at comcast.net]
> Sent: Friday, September 03, 2010 6:14 PM
> To: Ravi S. Shankar
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Help on Select.list
>
>
> On Sep 3, 2010, at 3:55 AM, Ravi S. Shankar wrote:
>
>> Hi R,
>>
>>
>>
>> I am using select.list
>>
>> names=c("Ravi", "Raj","Shubha","Nivriti")
>>
>> select.list(names) provides a drop down to choose one of the 4
>> names.
>>
>>
>>
>> However I would like to know if it is possible to create a
>> classification something like this
>>
>>
>>
>> select.list(names) should give
>>
>
> See if these beginnings get you any further:
>
>> ifelse( names %in% c("Ravi", "Raj") ,"Boys", "Girls")
> [1] "Boys" "Boys" "Girls" "Girls"
>
>
>> names[names %in% c("Ravi", "Raj")]
> [1] "Ravi" "Raj"
>> names[!(names %in% c("Ravi", "Raj"))]
> [1] "Shubha" "Nivriti"
>
> In any case you will need to provided a master list of either (or
> both) boy names and girl names.
>
>>
>>
>> Boys
>>
>> Ravi
>>
>> Raj
>>
>> Girls
>>
>> Shubha
>>
>> Nivriti
>>
>> I should be able to choose only one of the names.
>
> I'm afraid that did not make much sense to me.
>
> --
> David.
>>
>> Any help would be appreciated.
>>
>>
>>
>> R version 2.10.1 (2009-12-14)
>>
>> i386-pc-mingw32
>>
>>
>>
>> locale:
>>
>> [1] LC_COLLATE=English_United States.1252
>>
>> [2] LC_CTYPE=English_United States.1252
>>
>> [3] LC_MONETARY=English_United States.1252
>>
>> [4] LC_NUMERIC=C
>>
>> [5] LC_TIME=English_United States.1252
>>
>>
>>
>> attached base packages:
>>
>> [1] stats graphics grDevices datasets utils methods base
>>
>>
>>
>>
>> other attached packages:
>>
>> [1] clim.pact_2.2-41 akima_0.5-4 ncdf_1.6.1 rcom_2.2-3
>>
>> [5] rscproxy_1.3-1
>>
>>
>>
>> loaded via a namespace (and not attached):
>>
>> [1] tools_2.10.1
>>
>>
>>
>> Thank you
>>
>> Regards
>>
>> Ravi
>>
>>
>>
>> This e-mail may contain confidential and/or privileged i...{{dropped:
>> 13}}
>>
>> ______________________________________________
>> 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.
>
> David Winsemius, MD
> West Hartford, CT
>
> This e-mail may contain confidential and/or privileged...{{dropped:15}}
More information about the R-help
mailing list