Skip to content
Prev 34838 / 63421 Next

format (PR#14062)

Full_Name: Dirk Jacob
Version: R 2.8.1 and 2.9.1
OS: Win XP
Submission from: (NULL) (153.96.32.62)


I want to convert numbers to strings
like:
and it works

 [1] "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01"
[10] "3e-01" "3e-01" "3e-01"

if I use different numbers it does not:
If I try the same format command, it does not:
Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3,  : 
  invalid 'scientific' argument

Only if I change scientific to NA
remark (not important for the problem):
but I need scientific because sometimes the strings get to long otherwise


Now if I am trying the same thing as at the beginning it doesn't work anymore
Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3,  : 
  invalid 'scientific' argument

This looks like some problem in .Internal(format, ...) to me!?

if I remove everything from my environment
[1] "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01" "3e-01"
[10] "3e-01" "3e-01" "3e-01"
it works again!

rm(list=ls(all=T))

inputs= c(0.3+0*(1:12) )
(format(inputs,digits=3,scientific=T,collapse=" "))