[R] Executing index value for unequal vector lengths

Eliza Botto e||z@_botto @end|ng |rom out|ook@com
Wed Apr 20 08:18:14 CEST 2022


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]]



More information about the R-help mailing list