[R] Function definition: where is the error in the "for" loop?

2012-08-10 Thread Dr. Holger van Lishaut
Dear all, The following function code fails with errors (see below): RegPlots <- function (data, ContrVar, RespVar){ intNmbrRows<-length(RespVar);intNmbrCols<-lenght(ContrVar) par(mfrow=c(intNmbrRows,intNmbrCols)) For(i in 1:intNmbrRows){ For (j in 1:intNmbrCols){

Re: [R] Function definition: where is the error in the "for" loop?

2012-08-11 Thread Dr. Holger van Lishaut
Am 11.08.2012, 01:18 Uhr, schrieb Rui Barradas : [...] The solution is obviously to write 'for', with lowercase 'f'. Hope this helps, Dear Mr Barradas, indeed it did help, thank you very much! Best regards Holger van Lishaut __ R-help@r-project.o

Re: [R] Function definition: where is the error in the "for" loop?

2012-08-11 Thread Dr. Holger van Lishaut
Am 11.08.2012, 01:18 Uhr, schrieb Rui Barradas : [...] The solution is obviously to write 'for', with lowercase 'f'. Hope this helps, Dear Mr Barradas, indeed it did help, thank you very much! Best regards Holger van Lishaut __ R-help@r-project.o

[R] Regular Expressions in grep

2012-08-21 Thread Dr. Holger van Lishaut
Dear r-help members, I have a number in the form of a string, say: a<-"-01020.909200" I'd like to extract "1020." as well as ".9092" Front<-grep(pattern="[1-9]+[0-9]*\\.", value=TRUE, x=a, fixed=FALSE) End<-grep(pattern="\\.[0-9]*[1-9]+", value=TRUE, x=a, fixed=FALSE) However, both strings gi

Re: [R] Regular Expressions in grep - Solution and function to determine significant figures of a number

2012-08-22 Thread Dr. Holger van Lishaut
Dear all, regmatches works. And, since this has been asked here before: SignifStellen<-function(x){ strx=as.character(x) nchar(regmatches(strx, regexpr("[1-9][0-9]*\\.[0-9]*[1-9]",strx)))-1 } returns the significant figures of a number. Perhaps this can help someone. Thanks & best reg

Re: [R] Regular Expressions in grep - Solution and function to determine significant figures of a number

2012-08-23 Thread Dr. Holger van Lishaut
Am 22.08.2012, 21:46 Uhr, schrieb Dr. Holger van Lishaut : SignifStellen<-function(x){ strx=as.character(x) nchar(regmatches(strx, regexpr("[1-9][0-9]*\\.[0-9]*[1-9]",strx)))-1 } returns the significant figures of a number. Perhaps this can help someone. Sorry, to