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 7934105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:32:29+00:00 2026-06-03T21:32:29+00:00

How to combine all state names in a single vector, instead of listing all

  • 0

How to combine all state names in a single vector, instead of listing all the logical exclusions separately? I found function %notin% on the CRAN website, but R doesn’t recognize is as a legitimate function.

indata <- indata[which(indata$STATE != "GU" & indata$STATE != "WY" &
                       indata$STATE != "KS" & indata$STATE != "ME" &
                       indata$STATE != "MT" & indata$STATE != "ND" &), ]

Thanks.

  • 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-06-03T21:32:32+00:00Added an answer on June 3, 2026 at 9:32 pm
    indata[!indata$STATE %in% c("GU", "WY", "KS", "ME", "MT", "ND"), ]
    

    EDIT: @CarlWitthoft, believe it or not, I’ve actually had the following in a private package for a while

    `%notin%` <- function (x, table) x[!x %in% table]
    

    However, I never think to use it until after I’ve already typed it out the long way. Plus, using it makes my code less distributable. I was not aware of

    operators:::`%!in%`
    

    which is only the second half of %notin%

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using Stata to combine and analyze data for all of our agencies
I'm trying to combine all javascript files in a project during the build process,
Is there any way to combine all of this to reduce the amount of
Ok, so I am importing a CSV, and then I want to combine all
I am trying to combine two arrayLists, producing a new arrayList that contains all
How could I combine all of the comments that appear in $row[comment] below into
I have a database table of all zipcodes in the US that includes city,state,latitude
I'm trying to combine the Address and Country Create Views into a single view.
I am trying to combine to queries with union all: use SalesDWH go select
I am trying to follow the advice given in Combine state with IO actions

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.