[R] Chinese characters in html source captured by download.file() are garbled code , how to convert it readable

2013-07-28 Thread Yong Wang
Dear list, I am working with R to download numerous html source code from which the data extracted will be further processed. The problem is the Chinese character in the html source code are all garbled and I can't really find a way to convert them to something readable. This problem persists on

[R] How to speed up the for loop by releasing memeory

2012-12-15 Thread Yong Wang
Dear list; How can I speed up the run of following code (illustrative) # con-vector(numeric) for (i in 1:limit) { if(matched data for the ith item found) { if(i==1) {con-RowOfMatchedData } else

[R] mlogit package, Error in X[omitlines, ] - NA : subscript out of bounds

2011-04-29 Thread Yong Wang
I am using the mlogit packages and get a data problem, for which I can't find any clue from R archive. code below shows my related code all the way to the error #--- mydata - data.frame(dependent,x,y,z)

[R] any package for Heckman selection model when the outcome equation also probit ?

2011-04-13 Thread Yong Wang
Hi, all Can anybody hint if there is extant package or function to deal with Heckman selection model where the outcome model is also probit? In stata, it is called heckprob. Thank you yong __ R-help@r-project.org mailing list

[R] read.table() with \t as seperator, all other programs report equal fields each row, read.table() returns unequal row length error

2011-03-16 Thread Yong Wang
hi, list R is undoudtedly my favorite statistic tool, however, the data inputnpart has long been a pain. most data I have to deal with are irregular and contains special character. Recently I get a tab delimited data, read.table(filename,sep=\t) constantly return erors for certain rows does not

Re: [R] file reading problem unique to windows. Err info: Error in file(file, ifelse(append, a, w)). cannot open the connection

2010-11-26 Thread Yong Wang
be    • download.file() could leave the destination file open if the URL      was not able to be opened.  (PR#14414) (If you had followed the posting guide you would have tried R-patched before posting ) On Wed, 24 Nov 2010, Yong Wang wrote: Dear List I asked this question before, got some tips

[R] file reading problem unique to windows. Err info: Error in file(file, ifelse(append, a, w)). cannot open the connection

2010-11-24 Thread Yong Wang
Dear List I asked this question before, got some tips but can't get it solved. it is clear now that this problem only occurs when run on windows (I tested it on windows XP) nothing wrong at all when run on unix. unfortunately, sometimes I have to run it on windows, I appreciate any suggestion on

[R] what does this err mean and how to solve it? Error in file(file, ifelse(append, a, w))

2010-10-06 Thread Yong Wang
Dear List I am running a loop downloading  web pages and save the html to a temporary file (use download.file() )  then read (using readLines)  it in for processing; finally write useful info from each processed page to a unique file the problem is once the loop runs up to somewhere near  5000,

[R] How to store regex expression in a variable

2010-09-25 Thread Yong Wang
dear list I know how to store a regex expression in perl and ruby, no clue on R. I do read R regex manual , archives, and searched on line, still I need somebody help me out on how to store a regular expression in a variable. Thank you very much yong

[R] Read in a all-character file and specify field separator and records separator

2010-08-29 Thread Yong Wang
Dear list I used to use python or awk do preliminary process and then feed into R. In some circumstances, the data transmission becomes quite a pain. I am wondering if there is a convenient way to read in R text file (not data, text file in common sense) and specify field separator and records

[R] How to execute multiple R scripts sequentially in unix background

2010-05-21 Thread Yong Wang
Dear list I need to 1) run several R scripts sequentially due to results waiting and 2) run them in unix background since my ssh frequently timeout for some reason. if paste following codes to unix R --vanilla script1 R --vanilla script2 R --vanilla script3 will result in simultaneous

[R] Why eval(parse(text=var(vec))) return a matrix but NOT a number?

2010-03-17 Thread Yong Wang
Dear List I am getting a problem when using eval(parse). Code below sketchs what I am trying to do: For each row of a N*K dataframe (I use a 2*2 dataframe in the example below), applying a number of functions and get the outputs (two functions, sum and var are used in the example below). The

[R] for Interaction of continous var and categorical var, any way approach the categorical var to continous ?

2009-03-26 Thread Yong Wang
Dear list, This is NOT a techical question ragrding use of R. I have a linear model where the response variable is neigborhood safety . It is projected poverty deteriorate safety and number of officers per thousand residents improve safety. The focal hypothesis is poverty poses less safety

[R] UNIX Installation of package systemfit fails

2009-02-05 Thread Yong Wang
Dear list I am trying to install the systemfit package under unix, install.packages(systemfit) the installation failed. I am attaching the error and version information below, (if dependencies=TRUE, much more error) any help appreciated best, yong

[R] problem of unix package installation, following code no response: install.packages(packagename, dependecise=TRUE)

2008-11-10 Thread Yong Wang
Dear list I am trying installing a package under unix, the command as below works in some case but not some other cases, the primary syndrome is R will stop there with a message: (say I am trying to install the package SASxport) ### Warning in install.packages(SASxport,

[R] help on package or code for simutaneous equation probit(logit) model

2008-10-27 Thread Yong Wang
Dear List I am trying to fit a simutaneous equation logit model. i.e., the response variables of the structured equations are binomial, I am not sure if systemfit can do this job. A google search doesn't yield too much helpful information. Your knowledge on any other packages or codes are

[R] lm error and how to sidestep an error occured in for loop to keep it going without being interrupted

2007-09-27 Thread Yong Wang
Dear Rlist I am runing a for loop on a large dataset to do exploring investigation. Code embedded in the loop include the lm routine. Unfortunately, for some specification of dependent variable, the loop will be interrupted by error as below: Error in `contrasts-`(`*tmp*`, value =