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
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
https://stat.e
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?
thanks.
tion(.grp){
> + if (any(is.na(.grp))) return(c(.grp[1,1], .grp[1,2], 0))
> + c(.grp[1,1], .grp[1,2], nrow(.grp))
> + }))
>[,1][,2] [,3]
> 510.310 510 3100
> 520.310 520 3101
> 500.320 500 320
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 d
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
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.
_
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,t
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
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-help@r-p
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()
f
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 mailin
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 v
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 b
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:
http://r.7
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 optio
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 Nabble.co
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
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 <- c(-1
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
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
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 mes
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 comb
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 <- c
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
.
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
Hello R users,
is there a possibility to get the relativ maximum of a matrix?
To get the absolut maximum I use max(matrix)
For example:
The absolut maximum of this matrix is 6[3,6], but the relativ maximum is
6[3,6] and 4[7,6], because both values are the highest value in comparison
to their e
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 3464000 2
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 R users,
>>
>> I didn't find a solution for a special problem.
>> I have two dataframes.
&
5000 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 R users,
>>
>> I didn't find a soluti
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
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"
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
33 matches
Mail list logo