Re: [R] length of a string

2007-09-05 Thread Jared O'Connell
How's this? x = data.frame(ID=c(asdf,asdfasdf),1:2) x ID X1.2 1 asdf1 2 asdfasdf2 nchar(as.character(x$ID)) [1] 4 8 Assuming ID is a factor, if not, you can remove the as.character(). On 9/5/07, João Fadista [EMAIL PROTECTED] wrote: Dear all, I would like to know

Re: [R] how to do interpolation

2007-09-04 Thread Jared O'Connell
Use approx() if you just want linear interpolation. On 9/4/07, Yogesh Tiwari [EMAIL PROTECTED] wrote: Hello R Users, How to make a variable equidistance with time i.e. how to interpolate a variable if it is not sampled at equal time interval. Many thanks, Regards, Yogesh

Re: [R] how to collapse a list of 1 column matrix to a matrix?

2007-08-19 Thread Jared O'Connell
x = matrix(rnorm(9),3) x [,1] [,2][,3] [1,] 1.29693748 0.2018959 0.02534092 [2,] -1.19468858 -1.2249229 -0.85948508 [3,] -0.09274508 0.4071841 -0.11481410 apply(x,1,which.min) [1] 3 2 3 On 8/20/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: One more question.

Re: [R] How to start a R script from a dos command?

2007-07-01 Thread Jared O'Connell
R CMD BATCH blah.r R.exe --help would have been helpful for you here :) Jared On 7/1/07, Maja Schröter [EMAIL PROTECTED] wrote: Hi everybody, I want to start a R programm from a dos command. Are there any possibilities that I can start e.g. the file Test.R from dos? Maybe

Re: [R] Expand duplicated observations

2007-06-05 Thread Jared O'Connell
Also, to handle NAs and non-integers: x = c(1:3,9.4,NA) tmp = round(x) tmp[is.na(tmp)]=1 rep(x,tmp) [1] 1.0 2.0 2.0 3.0 3.0 3.0 9.4 9.4 9.4 9.4 9.4 9.4 9.4 9.4 9.4 NA On 6/6/07, Francisco J. Zagmutt [EMAIL PROTECTED] wrote: I think this will do what you want x=c(1,2,3) rep(x,x) [1]

Re: [R] Expand duplicated observations

2007-06-05 Thread Jared O'Connell
oh dear...I forgot about 0! :( On 6/6/07, Jared O'Connell [EMAIL PROTECTED] wrote: Also, to handle NAs and non-integers: x = c(1:3,9.4,NA) tmp = round(x) tmp[is.na(tmp)]=1 rep(x,tmp) [1] 1.0 2.0 2.0 3.0 3.0 3.0 9.4 9.4 9.4 9.4 9.4 9.4 9.4 9.4 9.4 NA On 6/6/07, Francisco J

Re: [R] opinions please: text editors and reporting/Sweave?

2007-05-30 Thread Jared O'Connell
Winshell (http://www.winshell.de/) is another (free) option if you want a Windows editor with good MikTEX integration. On 5/31/07, Duncan Murdoch [EMAIL PROTECTED] wrote: Tim Howard wrote: dear all - I currently use Tinn-R as my text editor to work with code that I submit to R, with some