[R] Executing index value for unequal vector lengths

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Wed Apr 20 08:37:16 CEST 2022


?match

On April 19, 2022 11:18:14 PM PDT, Eliza Botto <eliza_botto using outlook.com> wrote:
>Good day useRs,
>
>I have the data of two vectors
>
>> dput(DDD)
>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)
>
>> dput(EEE)
>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
>
>>which(EEE==DDD))
>
>I thank-you very much in advance
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list