samedi 15 avril 2017

data pattern matching using R

I have just started using R studio and I have encountered with an obstacle when dealing with my raw data. So this is the problem. I have two data sets A and B with same number of rows (names of the firms) and columns (months). But apparently I have to match the pattern of data locations, (for example. if (i,j) of A is blank, then I need to erase the entry in data B of (i,j). I need to have same number of cells and same pattern of data allocation on both data sets. I have tried this double loop , but it doesn't work.

  for (i in  1:length.firm)
            for (j in 1:time.)
                  if (CR [i,j] == ",") marketreturnmonthly[i,j] == ","

can anyone show me how to solve this problem? enter image description here

Aucun commentaire:

Enregistrer un commentaire