Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1043939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:44:49+00:00 2026-05-16T15:44:49+00:00

I am building a gui which lets me select a subset of a data.frame

  • 0

I am building a gui which lets me select a subset of a data.frame by clicking on the various factor names.
After having received user input, how do i pass it to the subset function?

e.g.: I have a dataframe df with factors MORNING and EVENING in column timeofday and RECEIVE and SEND in column optype. From the GUI I know that the user wants to a subset containing only RECEIVE operations, so i have the following strings as well:

RequestedFactor1 which equals “optype”
RequestedRelationship1 equals “==”
RequestedValue1 which equals “RECEIVE”

What can i do to those strings to pass them to subset, so that I will receive the same output as if i had called subset(df,optype==”RECEIVE”) ?

TIA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:44:50+00:00Added an answer on May 16, 2026 at 3:44 pm

    For this you can use an eval-parse construct, but again I warn that this is actually tricky business. Please read the help files about these two very carefully. So in your case this becomes :

    subset(df,eval(parse(text=paste(RF1,RR1,RV1)))) 
    

    An example to illustrate some tricky parts :

    > RF1 <- "optype"
    
    > RR1 <- "=="
    
    > RV1 <- "\"RECEIVE\""
    
    > optype <- c("RECEIVE","Not")
    
    > ifelse(eval(parse(text=paste(RF1,RR1,RV1))),1,0)
    [1] 1 0
    

    Mind the escaped quote-marks (\”). This is necessary as you want to test against a string, and not the RECEIVE object. Alternatively you can do :

    > RF1 <- "optype"
    
    > RR1 <- "=="
    
    > RV1 <- "Text"
    
    > optype <- c("RECEIVE","Not")
    
    > Text <- "RECEIVE"
    
    > ifelse(eval(parse(text=paste(RF1,RR1,RV1))),1,0)
    [1] 1 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a gui component that has a tree-based data model (e.g. folder structure
After building the application GUI, I realised it was a little bit too complex
I'm building a GUI in which I need to allow the user to enter
So, I'm building a GUI in Python using Tkinter which will be used to,
I'm building a really crude GUI to model mapper which basically traverses all TEdit
I have a question regarding building GUI applications. I feel like the title of
I am building a GUI extension using SDL Tridion 2011 SP1. I want to
I've recently begun working on a project regarding GUI building using some form of
I am building an HTML Gui builder and this involves round-tripping HTML pages from
Part of the GUI I'm building using tkinter has a pop-up window that says

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.