Displaying 15 results from an estimated 15 matches for "chris82".
2012 Feb 01
6
While loop working with TRUE/FALSE?
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 message in context:
2008 Nov 10
2
Make one vector from matrix comparison
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 a loop:
for (i in (1:4)){
for (j in (1:4)){
b <- (c(setequal(testmat1[j,],testmat2[i,])))
2008 Sep 17
1
Re adout row and column of a matrix value
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,] 1 1 2 2 2 1 1 2
[2,] 1 2 3 3 3 4 4 3
[3,] 3 3 3 5 5 6 5 4
[4,] 4 4 4 3
2008 Nov 25
1
add string to a list
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] "string"
.
.
.
[224] "string"
[225]
2011 Nov 15
2
points() colored by value
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 this message in context:
2011 Feb 03
2
substring and paste character with a for loop
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 the loop as I expected.
text <- "aaa,bbb,ccc,ddd"
characterseq <-
2013 Apr 16
2
R process slow down after a amount of time
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 data which fill some memory?
Chris
--
View this message in context:
2011 Sep 16
3
How to save row values from a matrix into one vector?
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()
for (o in 1:3){
op[o] <- as.vector(test.id[o,])
}
The results should be like this:
[1]
2008 Oct 22
3
Substitute problem
hello R users,
I didn't find a solution for a special problem.
I have two dataframes.
dataframe1:
X value row col ID
1 8.973498062 5512625 3460000 1
2 11.656658570 5501625 3464000 2
3 11.121777570 5495625 3473000 3
4 9.310465964 5508625 3477000 4
5 8.883483845 5515625 3496000 5
dataframe2:
X value
2008 Sep 21
1
Searching a relativ maximum of a matrix
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 eight neighbours values.
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 1 2 2 2
2012 Jul 10
1
image.plot transparent?
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 values are white colored and not transparent anymore.
It is problematic if I have a secondary
2008 Jul 23
2
Flip Matrix form file?
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,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9
> b1 <- apply(t(b),1,rev)
> b1
[,1] [,2] [,3]
[1,] 7 8 9
[2,] 4 5 6
[3,] 1 2 3
but my
2011 Apr 06
1
Problem to convert date to number
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")
"2006-04-30 11:35:00
2008 Sep 09
1
Substitute Values in a Matrix?
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
. .
. .
2.9 19.5
3.0 20
There is a difference
2012 Jul 10
0
R-help Digest, Vol 113, Issue 13
...for specific values from
> multiple .txt-files (Rui Barradas)
> 4. Re: How to use external image with R plot? (Michael Sumner)
> 5. Re: is it possible to insert a figure into into another new
> figure by r script (Thomas Adams)
> 6. image.plot transparent? (Chris82)
> 7. Re: How to add marker in Stacked bar plot? (Jorge I Velez)
> 8. Re: Predicted values for zero-inflated Poisson (Laura Lee)
> 9. Re: how can I show the xlab and ylab information while using
> layout (Sarah Goslee)
> 10. Re: image.plot transparent? (Sarah Go...