[R] Several quick questions

Sébastien pomchip at free.fr
Sat Jul 7 14:45:39 CEST 2007

Dear R users,

Here is a couple a quick questions, for which I was unable to not find 
any answer in the list archives and in the help:

1- Is there any R equivalents of the VB functions Cint, CStr, etc... 
(for non VB users, these functions transform the category of a specified 
variable and smartly adapt the value of this variable) ?

I have tried to use the as.numeric, as.factor and as.vector commands but 
the result is not exactly what I want ([1] 1, 3, 5, 6)
 >a<-as.factor(cbind(1,3,5,6))      # creates a dummy factor
[1] 1 3 5 6
Levels: 1 3 5 6
 >> a<-as.vector(as.numeric(a))
 > a
[1] 1 2 3 4

2- When a log scale is called in a graph, the label takes a format like 
10^n. Is there a way to come back to a regular number format like 1, 10, 
100... without having to create a custom axis ?

3- In lattice graphics, how does the default value of the "axs" argument 
influence the values of "limits" ?
This question should be considered in the following context. The help 
states that a 4% extension is applied by default to the axis range in 
base graphics. So, I have tried to apply this 4 % extension to create 
some custom lattice graphics. I worked on a dataset in which the 
independent variable ranged from 0  to 120, so I basically customized my 
axis using limits=c(-4.8,124.8). The results of the graphics with and 
without the limits command were not identical...

Thanks in advance for your help.


More information about the R-help mailing list