Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

str2B

round real in string


Description

Function for rounding real given as string representation

Usage

str2B(str, base=10, round = 0)

Arguments

str

String representing a real

base

1 < integer < 17, base of representation

round

Integer, number of places after "." to be rounded; < 0: rounding places before least significand digit. If too negative, 0 will result.

Value

str2B from given string represention of x, round to 'round' decimal digits

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

Examples

x <- paste0("-    ","9167.8")
  str2B(x )
  for ( kk in -5:4) print(str2B(x,10,kk) )
# 0 -10000 -9000 -9200 -9170 -9168 -9167.8 ...

cwhmisc

Miscellaneous Functions for Math, Plotting, Printing, Statistics, Strings, and Tools

v6.6
GPL (>= 2)
Authors
Christian W. Hoffmann
Initial release
2018-08-24, 10:40:10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.