[R] re ad and check table

2008-07-18 Thread mysimbaa

Dear R users,
I want to read a file like following :

if it is a table then z - read.table(pathname, dec=., header=TRUE)
else if it's not a table (image,doc,...) then send an error or something
like that

acually I have a read.table in the beginnig of my R code, and if my data is
not a table I become in my R console : fail in scan.
So the question is how to check the nature of the file?
something like : is.table?
I don't know the function.

Thanks for any help
Adel
-- 
View this message in context: 
http://www.nabble.com/read-and-check-table-tp18532292p18532292.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] eval.wih.vis

2008-07-16 Thread mysimbaa

I solved my problem.
I had to delete stop()
It doesn't make sense to have a stop() in if. stop() is to stop the
execution of the code once the condition is met.
the else does the job of stop() in this case.



mysimbaa wrote:
 
 Hello,
 I have an error since I run my R code. This error is :
 Fehler in eval.with.vis(expr, envir, enclos) : 
 
 
 My code is:
 
 #CONDITION1 : check if the right logfile is chosen
 c1=log(z[,3],n)
 if (c1==FALSE) { 
 plot(0:1,0:1,type = n, axes=FALSE,xlab=,ylab=)
 text(0.4,0.8,adj=0,paste(FEHLER),col=red)
 text(0.4,0.6,adj=0,paste(Falsche Logfile gewählt))
 stop()} else
 {...}
 
 z[,3] is a vector of n values. And log is a function which returns
 TRUE/FALSE
 #Detection whether the Right Logfile was chosen
 log-function(col,Len){
 vLog=ifelse(sum(col)(5000*Len),TRUE,FALSE)}
 
 
 I think the error comes from stop(), but not sure.
 Can anyone help to avoid this error?
 
 Thanks.
 Adel
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/eval.wih.vis-tp18439974p18480900.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] eval.wih.vis

2008-07-14 Thread mysimbaa

Hello,
I have an error since I run my R code. This error is :
Fehler in eval.with.vis(expr, envir, enclos) : 
 

My code is:

#CONDITION1 : check if the right logfile is chosen
c1=log(z[,3],n)
if (c1==FALSE) { 
plot(0:1,0:1,type = n, axes=FALSE,xlab=,ylab=)
text(0.4,0.8,adj=0,paste(FEHLER),col=red)
text(0.4,0.6,adj=0,paste(Falsche Logfile gewählt))
stop()} else
{...}

z[,3] is a vector of n values. And log is a function which returns
TRUE/FALSE
#Detection whether the Right Logfile was chosen
log-function(col,Len){
vLog=ifelse(sum(col)(5000*Len),TRUE,FALSE)}


I think the error comes from stop(), but not sure.
Can anyone help to avoid this error?

Thanks.
Adel



-- 
View this message in context: 
http://www.nabble.com/eval.wih.vis-tp18439974p18439974.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Plot depends on conditions

2008-07-10 Thread mysimbaa

Yeah,
It is a IF-THEN-ELSE.
Possible combinations are c4...c7. I know how to combine them in a plot.
But what I don't know is to build a function which return a plot depending
on those conditions !!!
Any help?

Thanks,
Adel Tekari



jholtman wrote:
 
 It sounds like an IF-THEN-ELSE should do the job.  What happens in the
 c1  c4 are FALSE, or some other combination?  Is your description the
 priority order that the tests are to be done in?
 
 On Mon, Jul 7, 2008 at 10:45 AM, mysimbaa [EMAIL PROTECTED] wrote:

 Dear R users,

 I want to do some plots which depends on conditions (7 conditions)
 I had collected all the conditions in a vector Cond(c1,c2,c3,c4,c5,c6,c7)
 All the conditions are logic (TRUE/FALSE).

 If c1 or c2 are FALSE I want to have only one Plot. Then I want to have a
 break (something like stop() or abort()) - no need to continue the
 execution.
 If c3 or c4 are FALSE I want par(mfrow=c(2,1)). Then a break
 If c5,c6 or c7 are FALSE par(mfrow=c(2,2)). Then a break

 If (all(Cond)) then another plot, par(mfrow=c(2,2))

 I think the best way is to build a function which plots depending on the
 conditions
 Do any one have an idea how to do this properly?

 Thanks in advance,
 Adel

 --
 View this message in context:
 http://www.nabble.com/Plot-depends-on-conditions-tp18318449p18318449.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 
 
 
 -- 
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390
 
 What is the problem you are trying to solve?
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Plot-depends-on-conditions-tp18318449p18379861.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plot depends on conditions

2008-07-07 Thread mysimbaa

Dear R users,

I want to do some plots which depends on conditions (7 conditions)
I had collected all the conditions in a vector Cond(c1,c2,c3,c4,c5,c6,c7)
All the conditions are logic (TRUE/FALSE).

If c1 or c2 are FALSE I want to have only one Plot. Then I want to have a
break (something like stop() or abort()) - no need to continue the
execution.
If c3 or c4 are FALSE I want par(mfrow=c(2,1)). Then a break
If c5,c6 or c7 are FALSE par(mfrow=c(2,2)). Then a break

If (all(Cond)) then another plot, par(mfrow=c(2,2))

I think the best way is to build a function which plots depending on the
conditions
Do any one have an idea how to do this properly?

Thanks in advance,
Adel 

-- 
View this message in context: 
http://www.nabble.com/Plot-depends-on-conditions-tp18318449p18318449.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] initialize a matrix

2008-07-04 Thread mysimbaa


-- 
View this message in context: 
http://www.nabble.com/initialize-a-matrix-tp18279886p18279886.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] create a zero matrix fill

2008-07-04 Thread mysimbaa

Dear R user,

I have written a function which returns max,min and variation of a power
(see below)
Power is a given matrix(1,n)

I call the function 
Variation-VAR(p,(n-deltat))

Now the problem is when I want plot(Results[1],Results[2]). Not possible! 
I become the following error (in english it means: Error in
as.double.default(x) :Object cannot be transformed in double)

 plot(Variation[1],Variation[2])
Fehler in as.double.default(x) : (list) Objekt kann nicht nach 'double'
umgewandelt werden

Any suggestion?

Hier is the function:
#Computing variation of the power
VAR-function(power,length){
tvar=pmean=pmin=pmax=varmax=varmin-matrix(data=0,ncol=(length-tml0))
for(i in tml0:length){
tvar[i]=i
pmean[i]=mean(power[i:(i+deltat)])
pmin[i]=min(power[i:(i+deltat)])
pmax[i]=max(power[i:(i+deltat)])
varmax[i]=100*(pmax[i]-pmean[i])/pmean[i]
varmin[i]=100*(pmean[i]-pmin[i])/pmean[i]
Results=list(tvar,pmean,pmin,pmax,varmax,varmin)

}} 


Thanks,
Adel
-- 
View this message in context: 
http://www.nabble.com/create-a-zero-matrix---fill-tp18281974p18281974.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] initialize a matrix

2008-07-04 Thread mysimbaa

I had implemented this

tvar=pmean=pmin=pmax=varmax=varmin-matrix(data=NA,nrow=n-deltat-tml,ncol=1)

Now the problem I become pmean=pmin=pmax which is not possible!

Any suggestion?

Thanks in advance
-- 
View this message in context: 
http://www.nabble.com/initialize-a-matrix-tp18279886p18280210.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Add comments on plot window

2008-07-01 Thread mysimbaa

I solved the problem with
plot(0:1,0:1, type = n, axes=FALSE,xlab=,ylab=)
text(...)

Thanks,
Adel


mysimbaa wrote:
 
 Dear R users,
 
 Is it possible to add comments in a plot window?
 I have 3 plots - this plots have to be commented on same window
 Is possible to do the following :
 http://www.nabble.com/file/p18193822/plot%2526comments.JPG
 plot%26comments.JPG 
 
 I don't know how to do it. Maybe plot.window or something like that.
 
 Any suggestions??
 Thanks in advance,
 Adel.
 

-- 
View this message in context: 
http://www.nabble.com/Add-comments-on-plot-window-tp18193822p18214155.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] if one of 4 conditions is not satisfied

2008-07-01 Thread mysimbaa

I'm trying to do realize the following:
I have 4 condtions.
If all conditions are satisfied I will paste(PASS)
If any of these is not satisfied I will paste(FAIL). But I have to paste
the corresponding failure.

ifelse is a good solution but for a 2 conditions. Maybe switch or something
like this.

Does anyone have an idea how to do?

Thanks in advance.
Adel
-- 
View this message in context: 
http://www.nabble.com/if-one-of-4-conditions-is-not-satisfied-tp18214194p18214194.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] if one of 4 conditions is not satisfied

2008-07-01 Thread mysimbaa

Thank you very much for your precise help.
I will try to implement this tomorrow.
It looks like the best solution which could be done.
Greetings,

Adel Tekari




Marc Schwartz wrote:
 
 on 07/01/2008 07:40 AM mysimbaa wrote:
 I'm trying to do realize the following:
 I have 4 condtions.
 If all conditions are satisfied I will paste(PASS)
 If any of these is not satisfied I will paste(FAIL). But I have to
 paste
 the corresponding failure.
 
 ifelse is a good solution but for a 2 conditions. Maybe switch or
 something
 like this.
 
 Does anyone have an idea how to do?
 
 Thanks in advance.
 Adel
 
 An easy way would be to have your condition results, which are 
 presumably TRUE/FALSE, in a vector such as:
 
Cond - c(TRUE, FALSE, FALSE, TRUE)
 
 Then you could use all() to check to see if they are 'all' TRUE:
 
 all(Cond)
[1] FALSE
 
 Then use which() to get the index of the FALSE elements:
 
 which(!Cond)
[1] 2 3
 
 If you have your test labels in a character vector, such as:
 
Cond.Vec - c(Cond 1, Cond 2, Cond 3, Cond 4)
 
 You could then use:
 
 if (all(Cond)) {
Out - PASS
 } else {
Out - paste(FAIL:, paste(Cond.Vec[which(!Cond)],
  collapse =   ))
 }
 
 
   Out
 [1] FAIL: Cond 2  Cond 3
 
 
 See ?all and ?which
 
 HTH,
 
 Marc Schwartz
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/if-one-of-4-conditions-is-not-satisfied-tp18214194p18220836.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Add comments on plot window

2008-06-30 Thread mysimbaa

Dear R users,

Is it possible to add comments in a plot window?
I have 3 plots - this plots have to be commented on same window
Is possible to do the following :
http://www.nabble.com/file/p18193822/plot%2526comments.JPG
plot%26comments.JPG 

I don't know how to do it. Maybe plot.window or something like that.

Any suggestions??
Thanks in advance,
Adel.
-- 
View this message in context: 
http://www.nabble.com/Add-comments-on-plot-window-tp18193822p18193822.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] png file in batch mode

2008-03-31 Thread mysimbaa

Dear R users,
I have an R script which produce me a plot. I run it in batch mode.
The outputed file is .ps
How ca I ouput the plot in .png in stead of .ps ?
I found in R FAQ 7.19 the solution but it is for Linux, and I'm using
Windows.

Thanks for your help,
Ciao,
Adel

-- 
View this message in context: 
http://www.nabble.com/png-file-in-batch-mode-tp16395299p16395299.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] executable script

2008-03-20 Thread mysimbaa

Can you please give me some additional informations.
I never created a .bat
I have no experience.


Peter Alspach wrote:
 
 Kia ora unknown requestor
 
 One option is to create a .bat file along the following lines:
 
 path_to_R\bin\R CMD BATCH yourScript.R
 
 
 Peter Alspach
 
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of mysimbaa
 Sent: Thursday, 15 November 2007 6:10 a.m.
 To: r-help@r-project.org
 Subject: [R] executable script
 
 
 Dear All,
 
 Apologies for this simple question and thanks in advance for 
 any help given.
 
 I want to make from my .R script an .exe file.
 
 Is there any way to transfort my script to an autolaunch file?
 It means it runs the script by double clicking on it.
 
 p.s.: I'm using windows
 --
 View this message in context: 
 http://www.nabble.com/executable-script-tf4806651.html#a13751752
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/executable-script-tp13751752p16173775.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] gui to run script

2008-03-20 Thread mysimbaa

Dear R users,
I'm trying since longtime to make an autolaunch of my code, but no results.
I have programmed three codes. And depending on my data(logfile collected
from another source) I have (frequently) to run one of the three codes.

I'm looking for a better solution that run on of the codes without lauching
R, specifiying the path of the code and compile.

My idea is to make a gui (popup window) asking me :
- what of the three codes you want to run?
-autoload the corresponding code.
-save graphics in memory (when I type ctr+v it will appears.)

Is there any simple solution ?

Thanks for any help.

p.s. I running R under windows XP.
-- 
View this message in context: 
http://www.nabble.com/gui-to-run-script-tp16175981p16175981.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] re ad .csv separated with coma

2008-03-18 Thread mysimbaa

Dear R users,
I try to read .csv composed of two rows which are separated with coma in the
followin manner:
 1.ignore the three first lines
 2. read datas separated with coma.

I tried the following :
pathname - file.choose()   
z -read.csv(pathname, sep = , )
t=z[,1]
p=z[,2]

But when I tape p I have NULL !!!

My .csv is looking like : 

0011J06
2008 Mrz 17 11:15
Sample #, Measurement
1, -9.998E-6
2, 5.099E-4
3, 3.999E-5
4, 2.999E-4
5, 2.099E-4

Thanks for help.
Adel

-- 
View this message in context: 
http://www.nabble.com/read-.csv-separated-with-coma-tp16116354p16116354.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] automatically save graphic

2008-03-04 Thread mysimbaa

Dear R users,

I write some code which produce a graphic
Now I try at the end to output it (bitmap or jpeg) like this way :

- pop up window asking me to choose a path where to save my picture 
- choose name for this picture

thanks you in advance,

Adel 
-- 
View this message in context: 
http://www.nabble.com/automatically-save-graphic-tp15822254p15822254.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plot using colors

2008-03-03 Thread mysimbaa

Dear R users,
I have a problem since I try to plot my datas with different colors.

plot(tvar, var, xlab=zeit [s],ylab=Variation [%],  col = ifelse(var =
varstability, 'green','red'))
this works well!

But since I add a type=l to my plot, it will color all the plot with
green!!!
Is there any solution? I avoid to use teachingDemos.

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Plot-using-colors-tp15799930p15799930.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] display basename

2007-11-21 Thread mysimbaa

Thanks for help.
-- 
View this message in context: 
http://www.nabble.com/display-basename-tf4846650.html#a13876120
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Changing axis scale

2007-11-21 Thread mysimbaa

Hello R users,

Is it possible after making a plot(x,y) to change axis scale? 
For example : I have a range of 0 to 3000 in my y-axis and I want to make a
zoom between 2000 and 3000.


Thanks for any help.
-- 
View this message in context: 
http://www.nabble.com/Changing-axis-scale-tf4850633.html#a13878705
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] executable script

2007-11-14 Thread mysimbaa

Dear All,

Apologies for this simple question and thanks in advance for any help given.

I want to make from my .R script an .exe file.

Is there any way to transfort my script to an autolaunch file?
It means it runs the script by double clicking on it.

p.s.: I'm using windows 
-- 
View this message in context: 
http://www.nabble.com/executable-script-tf4806651.html#a13751752
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plot segments with different colors

2007-11-13 Thread mysimbaa

Hello Everybody,
I'm trying to plot(x,y) using different colors. 
I have to cut (x,y) into sub intervals.
And I want to plot this sub intervals using colors. But infortunally I don't
know how to do this with R.
Can any body help me please?

My code is looking like :
x-c(tvar[1:t0],tvar[t0:(ts)],tvar[ts:n])
F-c(var[1:t0],var[t0:(ts)],var[ts:n])
plot(x,F,xlab=Zeit [s],ylab=Variation [%],col = red,type=l)

Thanks 
-- 
View this message in context: 
http://www.nabble.com/Plot-segments-with-different-colors-tf4796466.html#a13721834
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Plot segments with different colors

2007-11-13 Thread mysimbaa

Another question concerning the type.

plot(x,F,xlab=Zeit [s],ylab=Variation [%],col = rep(c(red, blue,
magenta), c(t0, ts, n)),type=c(p, l,o))

Doesnt change the type with differents colors!
(I become only one type and my color is red)

How can I solve this?
-- 
View this message in context: 
http://www.nabble.com/Plot-segments-with-different-colors-tf4796466.html#a13723380
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.