Search notes:

R function: formatC

nums <- seq( -1, 1, length.out=7)

nums
# [1] -1.0000000 -0.6666667 -0.3333333  0.0000000  0.3333333  0.6666667  1.0000000

formatC( nums )
# [1] "-1"      "-0.6667" "-0.3333" "0"       "0.3333"  "0.6667"  "1"

formatC( nums, digits=2)
# [1] " -1"   "-0.67" "-0.33" "  0"   "0.33"  "0.67"  "  1"

formatC( nums, digits=2, format='f')
# [1] "-1.00" "-0.67" "-0.33" "0.00"  "0.33"  "0.67"  "1.00"
Github repository about-r, path: /functions/formatC.R

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...', 1758200822, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/functions/formatC(51): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78