[R] error with lhoat() function from the package hydroPSO
Dear all, I just installed the package hydroPSO and when I try to run the example of the lhoat() function I got this error: nparam <- 5 lhoat( fn=sphere, lower=rep(-100,nparam), upper=rep(100,nparam), control=list(N=10, f=0.1, write2disk=TRUE) ) *Error in fn.name == "hydromod" : * * comparison (1) is possible only for atomic and list types* Any idea about what it might be? Thank you Rui [[alternative HTML version deleted]] __ 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] How to "call" an object given a string?
Hello, This is very basic and very frustrating. Suppose this: >A=5 >B=5 >C=10 > ls() "A" "B" "C" I would like this >xpto() 5 5 10 How can I do xpto()? Thanks Rui [[alternative HTML version deleted]] __ 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] How to use RWeka with Multilayer Perceptron?
Hello, I have a serialized Multilayer Perceptron trained using weka. I would like to use R to re-evaluate the model. How can I do this? I could not find an example of RWeca that applies to Multilayer Perceptron. Thanks, Rui __ 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] RWeka and Back Propagation NN
Hello, I have a trained Back Propagation Neural Network model in weka. I would like to re-evaluate the NN using R with a given input. How can I do this? I could not find an example of RWeca that applies to NN Thanks, Rui __ 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 with
Hi, I downloaded a dataset from UCI repositories named Bag of Words: http://archive.ics.uci.edu/ml/machine-learning-databases/bag-of-words/readme.txt The dataset is in a text file with the following structure: --- docID1 wordID1 count docID1 wordID2 count docID1 wordID3 count docID1 wordID4 count ... docID2 wordID2 count docID2 wordID5 count docID2 wordID6 count --- Where docIDx is an integer that identifies the document x; wordIDy is an integer that identifies the word y ; and count is an integer with the number of times that the wordIDy appears in the docIDx. Example: --- 1 1 3 1 2 54 1 3 11 1 4 17 2 1 5 2 4 78 2 5 20 --- I would like to import the file into a matrix (not sparse) where: the wordIDy would correspond to the column [,y] the docIDx would correspond to the row [x,] the value in [x,y] would be the count of wordIDy in the docIDx So, for the previous example it would be like: [,1][,2][,3][,4][,5] [1,] 3 54 11 17 0 [2,] 50 0 78 20 I don1t have a clue about how to do this. Can someone please help me? Thank you Rui [[alternative HTML version deleted]] __ 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] Is there any R function for data normalization?
Hello, I have a matrix with values, with columns c1..cn. I need the values to be normalized between 0 and 1 by column. Therefor, the 0 should correspond to the minimum value in the column c1 and 1 should correspond to the maximum value in the column c1. The remaining columns should be organized in the same way. Does a function in R exists for this purpose? Thanks, Rui [[alternative HTML version deleted]] __ 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] lapply with different size lists?
Hello, I have 2 functions (a and b) a = function(n) { matrix (runif(n*2,0.0,1), n) } > > > b = function (m, matrix) { > n=nrow (matrix) > p=ceiling (n/m) > lapply (1:p, function (l,n,m) { > inf = ((l-1)*m)+1 > if (l else sup=n > data.frame (matrix (lapply (inf: sup, function(i) > c(i, Inf, matrix[i,1], matrix[i,2]) ), nrow=m ) ) > }, n=n, m=m > ) > } > > >my.matrix = a(7) > >my.matrix > [,1] [,2] > [1,] 0.708060983 0.3242221 > [2,] 0.356736311 0.1454096 > [3,] 0.402880340 0.4763676 > [4,] 0.795947223 0.4052168 > [5,] 0.001620093 0.2618591 > [6,] 0.192215589 0.6595275 > [7,] 0.539199304 0.5402015 > > > b (m=6,matrix=my_matrix) > [[1]] > matrix.lapply.inf.sup..function.i..c.i..Inf..matrix.i..1...matrix.i.. > 1 1.000, Inf, 0.7080610, 0.3242221 > 2 2.000, Inf, 0.3567363, 0.1454096 > 3 3.000, Inf, 0.4028803, 0.4763676 > 4 4.000, Inf, 0.7959472, 0.4052168 > 55.0, Inf, 0.001620093, 0.261859077 > 6 6.000, Inf, 0.1922156, 0.6595275 > > [[2]] > matrix.lapply.inf.sup..function.i..c.i..Inf..matrix.i..1...matrix.i.. > 1 7.000, Inf, 0.5391993, 0.5402015 > 2 7.000, Inf, 0.5391993, 0.5402015 > 3 7.000, Inf, 0.5391993, 0.5402015 > 4 7.000, Inf, 0.5391993, 0.5402015 > 5 7.000, Inf, 0.5391993, 0.5402015 > 6 7.000, Inf, 0.5391993, 0.5402015 > It seems like the second list is filled with repeated rows (from 2 to 6) I would like the second list to stop in the last row of the my_matrix So, I would like to have the following result: > b (m=6,matrix=my_matrix) [[1]] matrix.lapply.inf.sup..function.i..c.i..Inf..matrix.i..1...matrix.i.. 1 1.000, Inf, 0.7080610, 0.3242221 2 2.000, Inf, 0.3567363, 0.1454096 3 3.000, Inf, 0.4028803, 0.4763676 4 4.000, Inf, 0.7959472, 0.4052168 55.0, Inf, 0.001620093, 0.261859077 6 6.000, Inf, 0.1922156, 0.6595275 [[2]] matrix.lapply.inf.sup..function.i..c.i..Inf..matrix.i..1...matrix.i.. 1 7.000, Inf, 0.5391993, 0.5402015 Can`t I do this with an apply function? Is there any more efficient way that substituting the lapply by a for loop? THanks, Rui [[alternative HTML version deleted]] __ 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] What is tthe meaning of Ncells and Vcells?
Hello, When I do gc() I got this return: > gc() used (Mb) gc trigger (Mb) max used(Mb) Ncells 288952 15.5 968217 51.8 381338927 20365.7 Vcells 57781947 440.9 180578758 1377.8 551082632 4204.5 What does actually means Ncells, Vcells, used and gc trigger? Thanks, Rui __ 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] Does anyone knows a KMeans ++ package for R?
Dear Pascal, >From Wikipedia: In applied statistics, k-means++ is an algorithm for choosing the initial values (or "seeds") for the k-means clustering algorithm. It was proposed in 2007 by David Arthur and Sergei Vassilvitskii, as an approximation algorithm for the NP-hard k-means problem—a way of avoiding the sometimes poor clusterings found by the standard k-means algorithm. On Wed, Feb 29, 2012 at 11:33 AM, Pascal Oettli wrote: > Dear Rui, > > What "++" means? There is kmeans in "stats" package. > > Best Regards, > Pascal > > > Le 29/02/2012 19:20, Rui Esteves a écrit : >> >> Dear all. >> >> I am searching for KMeans ++ for R. I cannot find it. >> Do you know any package with it? >> >> Best regards, >> Rui >> >> __ >> 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.
[R] Does anyone knows a KMeans ++ package for R?
Dear all. I am searching for KMeans ++ for R. I cannot find it. Do you know any package with it? Best regards, Rui __ 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] Error: unexpected '<' in "<" when modifying existing functions
All of these tries leave to the same result: 1) First I defined kmeansnew with the content of kmeans, but leaving the out. Then I run environment(kmeansnew)<- environment(stats::kmeans) at the command line. 2) kmeansnew <- kmeans() { environment(kmeansnew)<- environment(stats::kmeans) } 3) kmeansnew <- kmeans() {} environment(kmeansnew)<- environment(stats::kmeans) When I do kmeansnew(iris[-5],4) it returns: Error in do_one(nmeth) : object 'R_kmns' not found 'R_kmns' is a .FORTRAN that is called by the original kmeans(). it is the same error as if i would just leave out. On Sat, Jan 14, 2012 at 11:50 AM, Duncan Murdoch wrote: > On 12-01-14 3:58 AM, Rui Esteves wrote: >> >> Thank you both. >> >> 1) As Duncan said, if I leave out, it >> will not work since it is using .C and .Fortran functions that kmeans >> calls. >> I >> 2) don`t know how to use the as.environment() (I did not understood by >> reading the help). >> >> 3) Setting environment(kmeansnew)<- environment(stats::kmeans) does >> not work as well. > > > I think you need to explain what "does not work" means. What did you do, > and how do you know it didn't work? > >> >> 4) Using fix() works, but then I don`t know how to store just the >> function in an external file. To use it in another computer, for >> example. If I use save(myfunc,"myFile.R", ASCII=TRUE) it doesn't work >> when I try to load it again using myfunc=load("myFile.R") > > > Don't use load() on a source file. Use load() on a binary file produced by > save(). You could save() your working function, but then you can't edit it > outside of R. To produce a .R file that you can use in another session, > you're going to need to produce the function, then modify the environment, > using 2 or 3 above. > > Duncan Murdoch __ 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] Error: unexpected '<' in "<" when modifying existing functions
Thank you both. 1) As Duncan said, if I leave out, it will not work since it is using .C and .Fortran functions that kmeans calls. I 2) don`t know how to use the as.environment() (I did not understood by reading the help). 3) Setting environment(kmeansnew) <- environment(stats::kmeans) does not work as well. 4) Using fix() works, but then I don`t know how to store just the function in an external file. To use it in another computer, for example. If I use save(myfunc,"myFile.R", ASCII=TRUE) it doesn't work when I try to load it again using myfunc=load("myFile.R") Rui On Sat, Jan 14, 2012 at 3:22 AM, Duncan Murdoch wrote: > On 12-01-13 8:05 PM, Peter Langfelder wrote: >> >> On Fri, Jan 13, 2012 at 4:57 PM, Rui Esteves wrote: >>> >>> Hi. >>> I am trying to modify kmeans function. >>> It seems that is failing something obvious with the workspace. >>> I am a newbie and here is my code: >> >> >>>> >>> >>> Error: unexpected '<' in "<" >> >> >> Do not include the last line >> >> >> >> it is not part of the function definition. Simply leave it out and >> your function will be defined in the user workspace (a.k.a. global >> environment). > > > That's only partly right. Leaving it off will define the function in the > global environment, but the definition might not work, because that's where > it will look up variables, and the original function would look them up in > the stats namespace. I don't know if that will matter, but it might lead to > tricky bugs. > > What you should do when modifying a function from a package is set the > environment to the same environment a function in the package would normally > get, i.e. to the stats namespace. I think the as.environment() function can > do this, but I always forget the syntax; an easier way is the following: > > Create the new function: > > kmeansnew <- function (...) ... > > Set its environment the same as the old one: > > environment(kmeansnew) <- environment(stats::kmeans) > > BTW, if you use the fix() function to get a copy for editing, it will do > this for you automatically. > > Duncan Murdoch > > __ 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] Error: unexpected '<' in "<" when modifying existing functions
Hi. I am trying to modify kmeans function. It seems that is failing something obvious with the workspace. I am a newbie and here is my code: myk = function (x, centers, iter.max = 10, nstart = 1, algorithm = c("Hartigan-Wong", + "Lloyd", "Forgy", "MacQueen")) + { + do_one <- function(nmeth) { + Z <- switch(nmeth, { + Z <- .Fortran(R_kmns, as.double(x), as.integer(m), + as.integer(ncol(x)), centers = as.double(centers), + as.integer(k), c1 = integer(m), integer(m), nc = integer(k), + double(k), double(k), integer(k), double(m), + integer(k), integer(k), as.integer(iter.max), + wss = double(k), ifault = 0L) + switch(Z$ifault, stop("empty cluster: try a better set of initial centers", + call. = FALSE), warning(gettextf("did not converge in %d iterations", + iter.max), call. = FALSE, domain = NA), stop("number of cluster centres must lie between 1 and nrow(x)", + call. = FALSE)) + Z + }, { + Z <- .C(R_kmeans_Lloyd, as.double(x), as.integer(m), + as.integer(ncol(x)), centers = as.double(centers), + as.integer(k), c1 = integer(m), iter = as.integer(iter.max), + nc = integer(k), wss = double(k)) + myIter=Z$iter + if (Z$iter > iter.max) warning("did not converge in ", + iter.max, " iterations", call. = FALSE) + if (any(Z$nc == 0)) warning("empty cluster: try a better set of initial centers", + call. = FALSE) + Z + + }, { + Z <- .C(R_kmeans_MacQueen, as.double(x), as.integer(m), + as.integer(ncol(x)), centers = as.double(centers), + as.integer(k), c1 = integer(m), iter = as.integer(iter.max), + nc = integer(k), wss = double(k)) + if (Z$iter > iter.max) warning("did not converge in ", + iter.max, " iterations", call. = FALSE) + if (any(Z$nc == 0)) warning("empty cluster: try a better set of initial centers", + call. = FALSE) + Z + }) + Z + } + x <- as.matrix(x) + m <- nrow(x) + if (missing(centers)) + stop("'centers' must be a number or a matrix") + nmeth <- switch(match.arg(algorithm), `Hartigan-Wong` = 1, + Lloyd = 2, Forgy = 2, MacQueen = 3) + if (length(centers) == 1L) { + if (centers == 1) + nmeth <- 3 + k <- centers + if (nstart == 1) + centers <- x[sample.int(m, k), , drop = FALSE] + if (nstart >= 2 || any(duplicated(centers))) { + cn <- unique(x) + mm <- nrow(cn) + if (mm < k) + stop("more cluster centers than distinct data points.") + centers <- cn[sample.int(mm, k), , drop = FALSE] + } + } + else { + centers <- as.matrix(centers) + if (any(duplicated(centers))) + stop("initial centers are not distinct") + cn <- NULL + k <- nrow(centers) + if (m < k) + stop("more cluster centers than data points") + } + if (iter.max < 1) + stop("'iter.max' must be positive") + if (ncol(x) != ncol(centers)) + stop("must have same number of columns in 'x' and 'centers'") + Z <- do_one(nmeth) + best <- sum(Z$wss) + if (nstart >= 2 && !is.null(cn)) + for (i in 2:nstart) { + centers <- cn[sample.int(mm, k), , drop = FALSE] + ZZ <- do_one(nmeth) + if ((z <- sum(ZZ$wss)) < best) { + Z <- ZZ + best <- z + } + } + centers <- matrix(Z$centers, k) + dimnames(centers) <- list(1L:k, dimnames(x)[[2L]]) + cluster <- Z$c1 + if (!is.null(rn <- rownames(x))) + names(cluster) <- rn + totss <- sum(scale(x, scale = FALSE)^2) + print(Z$iter) + structure(list(cluster = cluster, centers = centers, totss = totss, + withinss = Z$wss, tot.withinss = best, betweenss = totss - + best, size = Z$nc, iter = Z$iter), class = "kmeans") + } > Error: unexpected '<' in "<" __ 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] how to find the number of iterations kmeans used to converge?
Dear all, I need to know in which number of iterations the kmeans converge each time I run it. Any idea how to do it? Thank you for your attention, Rui __ 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] Max value of an integer
Hi. Is there any constant that represents the maximum value of an integer? If I need to setup by myself what is the maximum value? Best, Rui __ 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] (no subject)
Hello. I have this matrix: cy[,1] [,2] [,3] [,4] [,5] [,6] [1,] 1.000 1.000 -0.5164570 -0.5164087 -0.4004139 -0.4003719 [2,] 1.000 1.000 -0.5164570 -0.5164087 -0.4004139 -0.4003719 [3,] -0.5164570 -0.5164570 1.000 1.000 -0.1186691 -0.1186972 [4,] -0.5164087 -0.5164087 1.000 1.000 -0.1186995 -0.1187276 [5,] -0.4004139 -0.4004139 -0.1186691 -0.1186995 1.000 1.000 [6,] -0.4003719 -0.4003719 -0.1186972 -0.1187276 1.000 1.000 [7,] -0.4058070 -0.4058070 -0.1150400 -0.1150706 0.826 0.824 [8,] -0.4061715 -0.4061715 -0.1147942 -0.1148249 0.802 0.799 [9,] -0.4061804 -0.4061804 -0.1147882 -0.1148189 0.801 0.799 [10,] 1.000 1.000 -0.5164570 -0.5164087 -0.4004139 -0.4003719 [,7] [,8] [,9] [,10] [1,] -0.4058070 -0.4061715 -0.4061804 1.000 [2,] -0.4058070 -0.4061715 -0.4061804 1.000 [3,] -0.1150400 -0.1147942 -0.1147882 -0.5164570 [4,] -0.1150706 -0.1148249 -0.1148189 -0.5164087 [5,] 0.826 0.802 0.801 -0.4004139 [6,] 0.824 0.799 0.799 -0.4003719 [7,] 1.000 0.999 0.999 -0.4058070 [8,] 0.999 1.000 1.000 -0.4061715 [9,] 0.999 1.000 1.000 -0.4061804 [10,] -0.4058070 -0.4061715 -0.4061804 1.000 I want to know the coordinates of the 1's only in the cy's lower triangle. If I do cy%in%1 or cy ==1 I have this result: [1] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE [25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE [37] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE [49] FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE [61] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE [73] FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE [85] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE [97] FALSE FALSE FALSE TRUE It seems that is only considering the principal diagonal. I don't understand why... Thank you, Rui [[alternative HTML version deleted]] __ 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] Kmeans with hamming distance?
Hello, I need to do kmeans clustering with hamming distance instead of the euclidean. The kmeans function only uses euclidean. How can I do it? Thank you Rui [[alternative HTML version deleted]] __ 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] Where can I find cmeans {e1071} package?
Hello, I need a Fuzzy C Means algorithm. I found some documentation about cmeans {e1071} at http://rss.acs.unt.edu/Rdoc/library/e1071/html/cmeans.html Does someone knows where I can find it? Thank you Rui [[alternative HTML version deleted]] __ 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] How to cancel a R function in the command line?
I found it. It is "ctr shift c" Rui On Thu, Oct 20, 2011 at 7:22 PM, Rui Esteves wrote: > Hi Tsjerk, > > In my command line it does not. > Maybe it because I am using linux. > That is my problem. > > Thank you for answering, > Rui > > On Thu, Oct 20, 2011 at 7:18 PM, Tsjerk Wassenaar wrote: > >> Hi Rui, >> >> In the R terminal ctrl-c cancels the function, not the session. >> >> Cheers, >> >> Tsjerk >> >> On Oct 20, 2011 7:16 PM, "Rui Esteves" wrote: >> >> Hi, >> >> This question seems very basic but I cannot find an answer on google. >> >> I have a R session on a linux command line. >> I called a function that is taking ages. >> I want to cancel the function but without killing the R session. >> What is the shortcut? >> >> Thanks, >> Rui >> >>[[alternative HTML version deleted]] >> >> __ >> 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. >> >> > [[alternative HTML version deleted]] __ 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] How to cancel a R function in the command line?
Hi Tsjerk, In my command line it does not. Maybe it because I am using linux. That is my problem. Thank you for answering, Rui On Thu, Oct 20, 2011 at 7:18 PM, Tsjerk Wassenaar wrote: > Hi Rui, > > In the R terminal ctrl-c cancels the function, not the session. > > Cheers, > > Tsjerk > > On Oct 20, 2011 7:16 PM, "Rui Esteves" wrote: > > Hi, > > This question seems very basic but I cannot find an answer on google. > > I have a R session on a linux command line. > I called a function that is taking ages. > I want to cancel the function but without killing the R session. > What is the shortcut? > > Thanks, > Rui > >[[alternative HTML version deleted]] > > __ > 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. > > [[alternative HTML version deleted]] __ 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] How to cancel a R function in the command line?
Hi, This question seems very basic but I cannot find an answer on google. I have a R session on a linux command line. I called a function that is taking ages. I want to cancel the function but without killing the R session. What is the shortcut? Thanks, Rui [[alternative HTML version deleted]] __ 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] Foreach (doMC)
Hello, I am trying to run a small example with foreach, but I am having some problems. Here is the code: *library(doMC) registerDoMC() zappa = list() frank = list() foreach (i = 1:4) %dopar% { zappa[[i]] = kmeans (iris[-5],4) frank[[i]] = warnings() }* The code runs without error. However the zappa and frank will be empty lists. If I use regular *for *instead, the list will be filled up with kmeans and warnings results. However, it will not be processed distributed. What am I doing wrong? What am I not understanding? Thanks Rui [[alternative HTML version deleted]] __ 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.