dimanche 28 décembre 2014

Why do ncol and nrow only yield NULL when I do have data?


Vote count:

0




I am new to R, so most likely this is a silly question. Every time I create artificial data, and sometimes using imported data sets, R tells me my variables have no rows or columns. I can run regressions but I cannot base commands on the number of rows/columns my variables have. For instance, say I have a variable x1, which is a column vector of 100 observations.


ncol(x1)


NULL


nrow(x1)


NULL


However, if I do this:


x=t(x) x=t(x)


and type again ncol(x), nrow(x), then I get the actual number of columns, rows that the object has.


Why is this happening and how can I fix this without having to use t()?



asked 18 secs ago







Why do ncol and nrow only yield NULL when I do have data?

Aucun commentaire:

Enregistrer un commentaire