Search notes:

R function: length

Counting the elements in a vector

If applied to a vector, length() counts its elements:
length(42:100)
# [1] 59

length("foo")
# [1] 1

length("")
# [1] 1

length(c())
# [1] 0

length(c("foo"))
# [1] 1

length(c("foo", "bar"))
# [1] 2
Github repository about-r, path: /functions/length.R

Counting columns in a data frame

If applied to a data frame, length() returns the number its columns.
In order to determine the number of observations of a data frame, nrow() can be used.

See also

Index to (some) R functions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758201059, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/functions/length(68): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78