[R] in par(mfrow=c(1, 2)), how to keep one half plot static and the other half changing

2012-11-27 Thread Baoqiang Cao
Hi, I'm trying to plot something in the following way and would like if you could help: I'd like in a same plot window, two plots are shown, the left one is a bird-view plot of the whole data, the right half keep changing, i.e., different plots will be shown up on request, so that when I select/c

[R] lm on matrix data

2012-10-10 Thread Baoqiang Cao
Hi, I have a question about using lm on matrix, have to admit it is very trivial but I just couldn't find the answer after searched the mailing list and other online tutorial. It would be great if you could help. I have a matrix "trainx" of 492(rows) by 220(columns) that is my x, and trainy is 49

Re: [R] tm package: problem of TermDocumentMatrix and minWordLength

2012-05-16 Thread Baoqiang Cao
try this: dtm <- DocumentTermMatrix(examplecorpus, control = list(wordLengths=c(1,100))) On Wed, May 16, 2012 at 6:22 AM, C.H. wrote: > Dear All, > > The following code illustrate the problem. > > [R code] > require(tm) > exampledoc <- c("R is good", "R is really good") > examplecorpus <- Corp

[R] error while install RCurl

2011-06-21 Thread Baoqiang Cao
Hi, I got an error when tried to install RCurl, here is what I did: R CMD INSTALL RCurl_1.6-6.tar.gz * installing to library ‘/home/b/R/i486-pc-linux-gnu-library/2.13’ * installing *source* package ‘RCurl’ ... checking for curl-config... no Cannot find curl-config ERROR: configuration failed for

Re: [R] about spearman and kendal correlation coefficient calculation in "cor"

2011-05-16 Thread Baoqiang Cao
Thank you very much Thomas! I indeed learned a lot. Baoqiang On Tue, 2011-05-17 at 09:46 +1200, Thomas Lumley wrote: > } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pro

[R] about spearman and kendal correlation coefficient calculation in "cor"

2011-05-16 Thread Baoqiang Cao
Hi, I have the following two measurements stored in mat: > print(mat) [,1] [,2] [1,] -14.80976 -265.786 [2,] -14.92417 -54.724 [3,] -13.92087 -58.912 [4,] -9.11503 -115.580 [5,] -17.05970 -278.749 [6,] -25.23313 -219.513 [7,] -19.62465 -497.873 [8,] -13.92087 -659.486 [

[R] help on compare two ranks

2011-04-14 Thread Baoqiang Cao
Hi, I have to one set of inputs and their observed true values of each input. Now I have a model takes the input and predict a value. I only consider the ranks based on either the observed true values or the predicted values. My question is how do I compare this two rank in R? That is, how close t

[R] use pcls to solve least square fitting with constraints

2010-12-06 Thread Baoqiang Cao
Hi, I have a least square fitting problem with linear inequality constraints. pcls seems capable of solving it so I tried it, unfortunately, it is stuck with the following error: > M <- list() > M$y = Dmat[,1] > M$X = Cmat > M$Ain = as.matrix(Amat) > M$bin = rep(0, dim(Amat)[1]) > M$p=qr.solve(as.

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread Baoqiang Cao
o there is a lot of > checking to do > to make bullet proof code that downloads files. > > > > > > On Tue, Nov 30, 2010 at 3:16 PM, Baoqiang Cao wrote: >> >> Hi Georg, >> >> Your code does work, I mean, it doesn't give me any error message, >

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread Baoqiang Cao
derfunction = h$update) h$value()[['status']] If the status is 404, then not found. If exists then status should be 200. " What a productive day! BC On Tue, Nov 30, 2010 at 1:34 PM, Georg Ruß wrote: > On 30/11/10 10:10:07, Baoqiang Cao wrote: >> I'd like to down

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread Baoqiang Cao
ALSE, ftplistonly = TRUE, crlf = > TRUE) > filenames = paste(url, strsplit(filenames, "\r*\n")[[1]], sep = "") > con = getCurlHandle( ftp.use.epsv = FALSE) > contents = sapply(filenames[1:5], getURL, curl = con) > names(contents) = filenames[1:length(contents)] &g

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread Baoqiang Cao
coerced into a data.frame that will look like a directory structure > listing the file names. > > If you need code just ask, but the RCurl docs are pretty good. > > > > On Tue, Nov 30, 2010 at 8:10 AM, Baoqiang Cao wrote: >> >> Hi, >> >> I'd l

[R] how to know if a file exists on a remote server?

2010-11-30 Thread Baoqiang Cao
Hi, I'd like to download some data files from a remote server, the problem here is that some of the files actually don't exist, which I don't know before try. Just wondering if a function in R could tell me if a file exists on a remote server? I searched this mailing list and after read severals m

[R] problem with catching error message in open function

2008-09-24 Thread Baoqiang Cao
Hi R-helpers, I'm extracting data from an public server, since there is a restriction such that I have to submit my entries one by one (I have 10^5 entries). I partially succeeded with using tf <- open(url, "r") if(isOpen(tf, "r")) {readLines(tf)} close(tf) Some entries successfully were ret

[R] function as.dist failed on large matrix on 64bit machine

2008-08-14 Thread Baoqiang Cao
Hi there, I'm having a problem with as.dist when I tried to convert a numerical matrix to dist. The data matrix is 10^4 by 10^4. I got the following: d <- as.dist(dat) Error: cannot allocate vector of size 762.9Mb I need convert "dat" to dist because I will use hclust to do some clustering a