Skip to content

Executing index value for unequal vector lengths

3 messages · Eliza Botto, Ivan Krylov, Jeff Newmiller

#
Good day useRs,

I have the data of two vectors
c(1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020, 2021)
c(2018, 2019, 2020, 2021)

You can see that 2018, 2019, 2020, 2021 are equal in both vectors.

I want to execute the index values for the values in DDD which are equal to EEE (31,32,33,34); and also the index values where EEE values are equal to DDD (1,2,3,4).

I tried the following commend but it didn't work
I thank-you very much in advance
#
On Wed, 20 Apr 2022 06:18:14 +0000
Eliza Botto <eliza_botto at outlook.com> wrote:

            
== doesn't work because it's element-wise. Try the %in% operator, or
setdiff() if you know that EEE and DDD are sets and you'd like to be
fancy.
#
?match
On April 19, 2022 11:18:14 PM PDT, Eliza Botto <eliza_botto at outlook.com> wrote: