2000:2017
The expected output is a vector of the sequence 2000 to 2017 with a step of 1.
Output: 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017
'2000':'2017'
However, when I type this command, it still gives me the same output.
Output: 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017
Unable to understand how it is generating sequence from characters.
Edit 1:
Ultimately, I am trying to understand why the code below worked? How can X2007:X2011 can possibly work? The select function is from dplyr package.
My data also has similar column names as mentioned in the image above but I do not have 'X' there. I just have years like 2007,2008 etc.
For me select(Division, State, 2007:2011) does not work.
Error:Can't subset columns that don't exist. x Locations 2007, 2008, 2009, 2010, and 2011 don't exist.
But this works select(Division, State, '2007':'2011').