Number of table rows with different number of rows for each column

I have a csv file containing 2 columns with different amounts of data, this data is called toasting and looks like this:

a   b
1   3
3   6
2   6
4   7


You can see that the number of rows for "a" is 4 and b is "7". The problem is, when I use the command nrow

, it will give a null result, for example:



Which function should I use and how should I write it?


source to share

1 answer

if you want the "length" of the vector - try length(belasting$a)

if you need dataset rows try nrow(belasting)

as such your data is inconsistent - data <- data.frame(a = c(1 , 2 , 3, 4), b = c(1 , 2, 3, 4 , 5, 6, 6))

if you try this, you will be sent an error. You cannot ask for "the number of rows of a worksheet with a different number of rows for each column".



All Articles