0

I'm working in R Version 2.15.0 on Mac OS X (Intel, 64-bit). When I apply prompt to a vector object, it throws an error unless I specify the file argument. Additionally, when I do provide a file name, there are oddities in the help file skeleton (e.g. many \name, \alias, and \usage commands, one for each element of the vector). Are these the expected results of prompt when specifying a vector? Sample commands that replicate the problem:

> COL <- rgb(1:4 / 4, 4:1 / 4, c(1, 0, 1, 0))
> prompt(COL)
Error in file(file, ifelse(append, "a", "w")) : 
  invalid 'description' argument
In addition: Warning messages:
1: In if (is.na(filename)) return(Rdtxt) :
  the condition has length > 1 and only the first element will be used
2: In if (file == "") file <- stdout() else if (substring(file, 1L,  :
  the condition has length > 1 and only the first element will be used
3: In if (substring(file, 1L, 1L) == "|") { :
  the condition has length > 1 and only the first element will be used
> prompt(COL, file="COL.Rd")
Created file named ‘COL.Rd’.
Edit the file and move it to the appropriate directory. 

One other odd component: when running 32-bit R on my machine and loading in the package, R will not properly load and allow access to the vector object when it is from the package (i.e. it throws an error: Error: internal error -3 in R_decompress1). However, when I load in the .rda object directly, things are fine in R 32-bit. Are such problems/inconsistencies expected when running R 32-bit on a 64-bit machine?

Edit: One more question. Any idea on how to get .R and .rda files to open in R 64-bit by default? The "Get Info" trick doesn't work... when clicking "Change All", it reverts back to the default R 32-bit. This seems to be a problem for certain file types.

Thanks!

David Diez
  • 679
  • 1
  • 6
  • 13

1 Answers1

3

As Paul said, split your questions next time.

Regarding the prompt function:

  • If you don't specify anthing, the filename is set to NULL, and the default behaviour is that the object itself is used to create a filename. When you pass a vector, the function sees that as a vector of objects and hence creates a vector of names. That gives the error message.

  • If you want to document a vector object, use the argument name instead, eg: prompt(name="COL"). That will give you the wanted behaviour

  • If you want to see a list, ?prompt tells you that you should specify filename=NA. The output will come to the console instead.

Opening .R and .rda files by 64 bit by default is OS dependent. In Windows you can do this eg via the control Panel > Default Programs > set Associations and then set the association to the 64bit binary file of R (to be found in ...\R\R-2.15.0\bin\x64 ).

The second question is impossible to answer without further details. I suggest you figure out how to reproduce that (see this question) and ask it in a new question

Community
  • 1
  • 1
Joris Meys
  • 106,551
  • 31
  • 221
  • 263