[R] R process slow down after a amount of time

2013-04-16 Thread Chris82
Hi R users, I have mentioned that R is getting slower if a process with a loop runs for a while. Is that normal? Let's say, I have a code which produce an output file after one loop run. Now after 10, 15 or 20 loop runs the time between the created files is stongly increasing. Is there maybe any

[R] Is something wrong wiht draw.circle()?

2012-09-07 Thread Chris82
Hey R users, I am a little bit confused. require(plotrix) plot(0,xlim=c(-10,10),ylim=c(-10,10),type=n,xlab=,ylab=) draw.circle(0,0,5) lines(c(0,0),c(0,5)) lines(c(0,5),c(0,0)) This is not really a circle with a radius of 5. best regards -- View this message in context:

Re: [R] image.plot transparent?

2012-07-13 Thread Chris82
Hello, hiere is a small reproducible example. All z.i which are NA should be transparent at the plot, but they are white colored. ### Example image.plot regular x,y grid ### x - seq(2,2.9,0.1) y - seq(42,42.9,0.1) z - matrix(seq(-5,4.9,0.1),nrow=10) image.plot(x,y,z) ### overplotting by

[R] image.plot transparent?

2012-07-10 Thread Chris82
Hi R users, I have a maybe strange problem. Normaly I do image.plot() with x,y coordinates and add=T and if I have some NA values in my data matrix z, the color will be transparent of these pixels. But now I have a disorted coordinate system and x,y are a matrix. It works also fine, but now NA

Re: [R] While loop working with TRUE/FALSE?

2012-02-02 Thread Chris82
Thanks to Berend and the others, I've found a solution which works fine for my problem. I have not only 2 vectors, but also 4. Question is, if q1 and q2 is equal to w1 and w2. The computational time is very short, also for large data. q1 - c(9,5,1,5) q2 - c(9,2,1,5) w1 - c(9,4,4,4,5) w1 -

[R] While loop working with TRUE/FALSE?

2012-02-01 Thread Chris82
Hi R users, is there any possibilty that a while loop is working like that: z - c(0,1,2,3,4,5,6,7,8,9) r - 7 while(w == T) { for ( i in 1:10 ){ w - r == z[i] print(w) } } The loop should stop if w == TRUE best regards -- View this

Re: [R] While loop working with TRUE/FALSE?

2012-02-01 Thread Chris82
Thanks to both. This is just a simple example. In real I have two vectors with different lengths. The code consists of two for loops for r and z. The main problem is the computational time, so I try to stop the loop if w is TRUE for the first time. First I tried to use the command stop in

Re: [R] Plot 2 different fields with image.plot()

2011-11-15 Thread Chris82
No, I have not. But it is a very nice option. Can't believe that I have overlooked it. Thanks a lot. Best regards -- View this message in context: http://r.789695.n4.nabble.com/Plot-2-different-fields-with-image-plot-tp4040413p4042339.html Sent from the R help mailing list archive at

[R] points() colored by value

2011-11-15 Thread Chris82
Hi R users, I want to colored points by their value for example: x - c(1,2,3,4) y - c(1,2,3,4) z - c(2,3,4,9) y and x are coordinates z is the value of the coordinates points(x,y,col= rainbow(z)) something like that But haven't found any solution at the moment. Thanks. Chris -- View

[R] Plot 2 different fields with image.plot()

2011-11-14 Thread Chris82
Dear R users, Is it possible to plot 2 different fields with image.plot(). For example at first a digitale elevation model and overlying another data field, where NA values are transparent, so that the digitale elevation model is still visble at this areas. Maybe there is another plotting

[R] optimize R code: replace for loop

2011-10-05 Thread Chris82
Dear R Users, at the moment I am trying to optimize an R script. testvec - c(0,1,0,1,1,1,1,0,0,1,0,1,0) sum.testvec - vector() tempsum - 1 for (e in 1:length(testvec)){ sum.testvec[e] - tempsum+testvec[e] tempsum - sum.testvec[e] } final.sum - c(1,sum.testvec) Is there an option to do

Re: [R] Intersection between circle and line?

2011-09-27 Thread Chris82
Thanks! In principle it is a mathematical problem. I have already found some solutions with google. I thought there is maybe an existing R function or package which handel this stuff. But it seems not to be. sos package gives me no suitable information for that. With best regards -- View this

[R] Intersection between circle and line?

2011-09-26 Thread Chris82
Dear R users, I am thinking about an easy and especially fast solution to calculate the x,y coordinates of the interesection between the borders of the red circle and the line. short example: plot(c(-3,0,3,9,21),c(-8,0,5,12,25)) draw.circle(0,0,radius=6,border=red,col=NA,lty=1,lwd=1) x -

Re: [R] How to save row values from a matrix into one vector?

2011-09-19 Thread Chris82
Thanks a lot! Works fine! -- View this message in context: http://r.789695.n4.nabble.com/How-to-save-row-values-from-a-matrix-into-one-vector-tp3818415p3823320.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

[R] How to save row values from a matrix into one vector?

2011-09-16 Thread Chris82
Dear R users, I guess, I have a quit simple problem, but I'm not getting the solution. I create a matrix like this: test - matrix(seq(1,3,1),ncol=5,nrow=3) then I want to create one vector, consisting of every row of the matrix. My first idea was to do this with a for loop. op - vector()

[R] Removing not duplicated rows

2011-04-08 Thread Chris82
Hello R users, I have a problem to delete rows in a table which are not duplicated in order of an id number a short example: x - data.frame(cbind(id=c(1,2,2,2,3,3,4,5,6,6), value=1:10)) x_new - x[which(duplicated(x$id)),] x_new id value 3 2 3 4 2 4 6 3 6 10 610

Re: [R] Removing not duplicated rows

2011-04-08 Thread Chris82
Thanks a lot, Jeremy! It's working perfectly. With best regards -- View this message in context: http://r.789695.n4.nabble.com/Removing-not-duplicated-rows-tp3436600p3436736.html Sent from the R help mailing list archive at Nabble.com. __

[R] Problem to convert date to number

2011-04-06 Thread Chris82
Hi R users, I have a maybe small problem which I cannot solve by myself. I want to convert chron dates times (04/30/06 11:35:00) to a number with as.POSIXct. The Problem is that I can't choose different timezones. I always get CEST and not UTC what I need. date = as.POSIXct(y,tz=UTC)

[R] substring and paste character with a for loop

2011-02-03 Thread Chris82
Hello R users, I have a little problem with a for loop. Below there is an simple example of my problem. I want to delet the commas in the character string. Fore this reason I create a for loop to unpick the string and rebuild him without the commas. The problem is, that paste does not work in

Re: [R] substring and paste character with a for loop

2011-02-03 Thread Chris82
Oh, that's of course a better solution. I've never red or heard about gsub. Thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/substring-and-paste-character-with-a-for-loop-tp3258449p3258485.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Faster Solution for a simple code?

2009-04-15 Thread Chris82
)) + })) [,1][,2] [,3] 510.310 510 3100 520.310 520 3101 500.320 500 3202 520.320 520 3200 On Mon, Apr 13, 2009 at 1:06 PM, Chris82 rubenba...@gmx.de wrote: Hi R-users, I create

[R] Faster Solution for a simple code?

2009-04-13 Thread Chris82
Hi R-users, I create a simple code to check out how often the same numbers in y occur in x. For example 500 32 occurs two times. But the code with the loop is extremly slow. x have 6100 lines and y sometimes more than 5 lines. Is there any alternative code to create with R?

[R] add string to a list

2008-11-25 Thread Chris82
hello R users, I didn't find a solution for a simple problem I think. I read 224 lines from a file input - readLines(con,n=224) and now I create a string x - \004 which should be line 225 of input. So I have input and x and want to add x to input, so that it looks like this: [1] string [2]

Re: [R] add string to a list

2008-11-25 Thread Chris82
Thanks! really a simple solution. regards Jorge Ivan Velez wrote: Dear Chris82, Try this: input - readLines(con,n=224) x - \004 input[225]-x input HTH, Jorge On Tue, Nov 25, 2008 at 4:37 PM, Chris82 [EMAIL PROTECTED] wrote: hello R users, I didn't find

[R] Make one vector from matrix comparison

2008-11-10 Thread Chris82
Hello R-users, I have a little problem. I compare each row of a matrix with each row of another matrix. testmat1 - matrix(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4) testmat2 - matrix(c(1,2,3,5,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4) Both matrix differs in the last row. Now I create

Re: [R] Substitute problem

2008-10-23 Thread Chris82
2 2 10.324148 5499625 3465000 61. 3 3 8.744591 5503625 3475000 71. 4 4 9.523473 5494625 3475000 3 -578.2354 5 5 8.856097 5507625 348 4 -619.1125 6 6 8.636881 5514625 3497000 5 -140.8012 On Wed, Oct 22, 2008 at 9:06 AM, Chris82 [EMAIL PROTECTED] wrote: hello

Re: [R] Substitute problem

2008-10-23 Thread Chris82
, Chris82 [EMAIL PROTECTED] wrote: hello R users, I didn't find a solution for a special problem. I have two dataframes. dataframe1: Xvalue row col ID 1 8.973498062 5512625 346 1 2 11.656658570 5501625

[R] Re adout row and column of a matrix value

2008-09-17 Thread Chris82
Hello R users, I want to readout the row and column postion from a certain matrix value into a csv file. I have only found this syntax which(a == b, arr.ind = T) so I get a = matrix [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,]11222112 [2,]123

[R] Substitute Values in a Matrix?

2008-09-09 Thread Chris82
Hi, I'm searching for a function to subistute Values in a Matrix to new Values. For example: old value new value 1.1 6 1.2 7 .. .. .. 1.9 14 2.0 15 and 2.1 15.5 2.2 16 .

[R] Flip Matrix form file?

2008-07-23 Thread Chris82
Hello, I have a problem to flip a 200x200 matrix, which is imported by a .asc file. I want to flip the matrix like in a created example below: b - matrix(1:9,3,3,byrow=T) b [,1] [,2] [,3] [1,]123 [2,]456 [3,]789 b1 - apply(t(b),1,rev) b1 [,1]

Re: [R] Flip Matrix form file?

2008-07-23 Thread Chris82
Thanks a lot, that resolve my probleme! -- View this message in context: http://www.nabble.com/Flip-matrix-from-file--tp18614800p18619853.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list