similar to: While loop working with TRUE/FALSE?

Displaying 20 results from an estimated 5000 matches similar to: "While loop working with TRUE/FALSE?"

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 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,])))
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:
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 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]
2012 Nov 24
3
function call from another r file
How to call a function from another r file ? Anyone can help me . Having a function named like fun1 which is saved in r file file1.r and i have another r file like file2.r, and i need to call the fun1 (which is in file1) within file2. Thank you -- View this message in context: http://r.789695.n4.nabble.com/function-call-from-another-r-file-tp4650627.html Sent from the R help mailing list
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
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
2013 Jan 29
3
NA and Character(0) in List Element
Hi, This is probably a small query but one I'm struggling with: I have a list in which I had elements which were NA, I removed them, by doing: list2 <- lapply(list, na.omit), However this leaves the element there with 'character(0)' in place as well as attributes: e.g. [[978]] character(0) attr(,"na.action") [1] 1 attr(,"class") [1] "omit" I want
2010 Oct 10
2
GC verbose=false still showing report
I must be reading the help file for gc() wrong. I thought it said that gc(verbose=FALSE) will run the garbage collection without printing the Ncells/Vcells summary. However, this is what I get: gc(verbose = FALSE) used (Mb) gc trigger (Mb) max used (Mb) Ncells 267097 14.3 531268 28.4 531268 28.4 Vcells 429302 3.3 20829406 159.0 55923977 426.7 I'm embedding this in an
2013 Nov 17
1
order() function, decreasing=TRUE unexpected behaviour
There appears to be an issue with the decreasing=TRUE option on the order() function that indicates either a bug or perhaps a design flaw (potentially flawed because I would suggest the majority of users would expect different behaviour). # demonstration of problem: x <- c(2,1,3,4,5) order(x) order(x, decreasing=TRUE) order(x) correctly reports the order as: 2 1 3 4 5 I expected the result
2012 Nov 08
5
map two names into one
Thanks. Yes. Your approach can identify: Glaxy ace S 5830 and S 5830 Glaxy ace But you can not identify using same program: Iphone 4S 16 G Iphone 4S 16G How should I solve both in same time. Kind regards,Tammy [[alternative HTML version deleted]]
2011 Apr 07
2
Two functions as parametrs of a function.
Hi R users: I'm trying to make a function where two of the parameters are functions, but I don't know how to put each set of parameters for each function. What am I missing? I try this code: f2<-function(n=2,nsim=100,fun1=rnorm,par1=list(),fun2=rnorm,par2=list()){ force(fun1) force(fun2) force(n) p1<-unlist(par1) p2<-unlist(par2) force(p1) force(p2)
2002 Sep 17
3
[LLVMdev] questions
Sorry I got really overwhelmed by so many classes and member functions in LLVM. So would you please clarify some problems I have? 1. If I see this instruction in the function. %S.i = alloca %struct.SimpleStruct Suppose SimpleStruct is as following: struct.SimpleStruct = type { int, double } When I read the instruction, how can I know the type of simplstruct, should I use 'getType'
2012 Aug 30
1
How to modify the values of the parameters passing via ...
Dear Friends, Let's assume there are three parameters that were passed into fun1. In fun1, we need to modify one para but the remains need to be untouched. And then all parameters were passed into fun2. However, I have failed to achieve it. Please see the following code. ########################################## fun1 <-function(x, y, z=10) {x+y+z;} fun2 <-function(aa, ...) {
2006 Aug 09
3
objects and environments
Dear list, I have two functions created in the same environment, fun1 and fun2. fun2 is called by fun1, but fun2 should use an object which is created in fun1 fun1 <- function(x) { ifelse(somecondition, bb <- "o", bb <- "*") ## mymatrix is created, then myresult <- apply(mymatrix, 1, fun2) } fun2 <- function(idx) { if (bb == "o) { #
2012 Nov 20
2
correct function formation in R
Dear list! ? I have question of?'correct function formation'. Which function (fun1 or fun2; see below) is written more correctly? Using ''structure'' as output or creating empty ''data.frame'' and then transform it as output? (fun1 and fun1 is just for illustration). ? Thanks a lot, OV ? code: input <- data.frame(x1 = rnorm(20), x2 = rnorm(20), x3 =