[R] get the scripname within the executed myscript.r

2010-11-02 Thread Žroutík
Dear R-users! Is there a way to obtain the name of the executed myscript.r, i.e. when cmd> rscript myscript.r is executed? (The name of the script in this case is "myscript.r") Here is the explanation of why I would like to get that: Why: I have prepared a set of scripts (decompose_data.r, plot

[R] should srt= in text()/par() recycle its parametres or not?

2010-05-04 Thread Žroutík
Dear R-users, I bumped into an unusual behaviour when a parametre is not recycled. Using text() with srt= values (turn string by an angle), srt=10*c(1:8), or even srt=c(1:2) and ploting my eight names to their values in the plot(), gives the following error: graphical parameter "srt" has the wron

[R] sequence of equal-length numbers (for filenames)

2010-01-25 Thread Žroutík
Dear R-users, I'd like to create filenames in a mask "file000.dat" numbered from 1 to e.g. 123. The last problem I'm dealing with is creating the sequence of numbers with equal length, i.e. 001, 002, 023, 024, 122, 123. The closest I got is by a repetition: Sequence <- c(1:123) for(i in

[R] installing mlica, or other ICA package

2009-08-12 Thread Žroutík
Dear R-users, was anybody able to install the mlica package succesfully? Or other ICA (Independent Component Analysis) package? But not the e1071. I have found mlica in the archive http://lib.stat.cmu.edu/R/CRAN/src/contrib/Archive/mlica/, repacked it to ZIP, installed and got an "updating HTML p

[R] loading multiple .Rdata and preserving variable names

2009-07-15 Thread Žroutík
Dear R-users, I need to load outputs from multiple previous calculations into one R session for comparison and (cross-)analysis. The previous calculations are stored in different directories in .Rdata files (I don't know if this is the best storage for later usage, but the previous project could b

[R] exists function on list objects gives always a FALSE

2009-05-19 Thread Žroutík
Dear R-users, in a minimal example exists() gives FALSE on an object which obviously does exist. How can I check on that list object anyway else, please? > SmoothData <- list(exists=TRUE, span=0.001) > SmoothData $exists [1] TRUE $span [1] 0.001 > exists("SmoothData") TRUE > exists("SmoothData

[R] smoothing a matrix (interpolate in plane)

2009-03-01 Thread Žroutík
Hi R-users, I'd like to smooth a matrix to dismiss spikes and to interpolate in plane example of a matrix: Map[1:3,1:3] [,1] [,2] [,3]... [1,] 34.4 34.2 35.1 [2,] 33.4 34.2 35.4 [3,] 34.1 33.2 32.1 dim(Map)[1] =/= dim(Map)[2] What functions can I use? Thanks a lot for any response,

Re: [R] Fwd: trunc/floor a number -- strange bahaviour

2009-02-13 Thread Žroutík
Thank you very much, Duncan! Now it is totally clear for me. Reading the 'R inferno' tract suggested to me in private by a user (nut one can google it), and wondering about heaven and hell Best regards, Z On Fri, Feb 13, 2009 at 1:05 PM, Duncan Murdoch wrote: I'm glad you are happy with your

[R] Fwd: trunc/floor a number -- strange bahaviour

2009-02-12 Thread Žroutík
Resolved. nchar(unlist(strsplit(as.character(n),"\\.")))[2] in the function: NumberPrecision <- function(n) { PocetCyklu <- 0 if(n != round(n)) { PocetCyklu <- nchar(unlist(strsplit(n,"\\.")))[2] } else { while(n == round(n)) { n <- n/10 PocetCyklu <- PocetCyklu + 1 } PocetCyklu <- PocetCyklu - 1

[R] trunc/floor a number -- strange bahaviour

2009-02-12 Thread Žroutík
Hi everybody, given a fresh rgui.exe load on winxp OS, I enter (a minimal exaple) n <- 12.357531 Then the following command: n <- (n - floor(n))*10; n gives the following outputs: [1] 3.57531 [1] 5.7531 [1] 7.531 [1] 5.31 [1] 3.1 [1] 1 === still as expected [1] 10=== not expecte