Greetings R-Geniuses,

What is the most efficient way to handle the problem described below?

Thanks
     Marsh Feldman


Problem description:

Each U.S. state has its own matrix. The rows are dates, the columns are 
industries, and each cell contains total statewide employment at the 
given time and industry. There is a similar matrix for the U.S. as a 
whole. Due to disclosure rules and other limitations, one or more 
industries may be missing from any given matrix (including the national 
one), but industries missing from one matrix are sometimes not missing 
from others. Industry numbers are treated as factors commonly used as 
column names.

I want to do two things:

   1. For any given set of states, find the set of industries present in
      all of them and use this to select this subset of industries from
      each state's matrix.
   2. For any given set of states, find the set of industries present in
      any of the states.
   3. Given that one or more cells in the table may be NA, identify
      those industries present in all states and have no values equal to NA.

I can do this using for() statements and %in%, but is there is a more 
efficient way? Your thoughts?

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to