Transform data format for factor analysis