[R] R copies for no apparent reason

2017-03-02 Thread Jiucang Hao
rence to x, so when changing it after, R makes another copy. Any one knows why R does this? Even when the function doesn't change x at all? Thanks. Regards, JiuCang Hao [[alternative HTML version deleted]] __ R-help@r-project.org mailin

Re: [R] K Fold CrossValidation

2013-05-15 Thread Kevin Hao
Maybe the following code is helpful for you. At the same time, you can check the ChemometricsWithR package from http://cran.r-project.org/web/packages/available_packages_by_date.html. # product crossvalidation index crossvalind

Re: [R] K Fold CrossValidation

2013-05-15 Thread Kevin Hao
Below is the some code, may be helpful for you. [maybe have the finished package which includes mlr with crossvaliation], you can check http://cran.r-project.org/web/packages/available_packages_by_date.html. you can check this "ChemometricsWithR

[R] need help for Imbalanced classification problems!!!

2013-05-14 Thread Kevin Hao
Hi all, I am facing the imbalanced classification problems. That means I have a dataset, in which the ratio of majority data to minority data is 100:1 (or more). In addition, the independent variables are many and this is a binary classification questions. The model I built give poor predictive

Re: [R] Read big data (>3G ) methods ?

2013-04-27 Thread Kevin Hao
ert it to some > binary format first (RDS, ff, sqlite, bigmemory, ...). Most packages have > routines to convert CSV files to the binary format. > > With all of the above LaF helps. ffbase contains a routine laf_to_ffdf to > convert to to ff format. > > > HTH, > > Jan >

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
Thank you very much. More and more methods are coming. That sounds great! Thanks, kevin On Fri, Apr 26, 2013 at 7:51 PM, Duncan Murdoch wrote: > On 13-04-26 3:00 PM, Kevin Hao wrote: > >> Hi Ye, >> >> Thanks. >> >> That is a good method. have any oth

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
Hi Ye, Thanks. That is a good method. have any other methods instead of using database? kevin On Fri, Apr 26, 2013 at 1:58 PM, Ye Lin wrote: > Have you think of build a database then then let R read it thru that db > instead of your desktop? > > > On Fri, Apr 26, 2013 at 8:0

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
0:58 AM, Ye Lin wrote: > >> Have you think of build a database then then let R read it thru that db >> instead of your desktop? >> >> >> On Fri, Apr 26, 2013 at 8:09 AM, Kevin Hao wrote: >> >>> Hi all scientists, >>> >>> Recently, I

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
> And another tip here is, you can split the large file into smaller ones. > > > > On Fri, Apr 26, 2013 at 8:09 AM, Kevin Hao wrote: > >> Hi all scientists, >> >> Recently, I am dealing with big data ( >3G txt or csv format ) in my >> desktop (win

[R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
Hi all scientists, Recently, I am dealing with big data ( >3G txt or csv format ) in my desktop (windows 7 - 64 bit version), but I can not read them faster, thought I search from internet. [define colClasses for read.table, cobycol and limma packages I have use them, but it is not so fast]. Cou

[R] Help me make faster R code for Kennard-Stone algorithm [My code is so slow from Matlab]

2013-04-24 Thread Kevin Hao
Hi all, Can you help me change my Kennard-Stone algorithm to faster one? [The original code can run fast in matlab, but when I change matlab code to R code, it is so slow.] Since my code so crude and too many loops (changed from matlab code), it is too slow. I hope that you can help to improve t

Re: [R] count ties after rank?

2011-11-21 Thread Hao, Zhaozhe
ult of table function? I.e., I want to get the tie number, t and use it in another equation. From: David Winsemius [dwinsem...@comcast.net] Sent: Monday, November 21, 2011 14:05 To: Peter Langfelder Cc: Hao, Zhaozhe; r-help@r-project.org Subject: Re:

[R] count ties after rank?

2011-11-21 Thread Hao, Zhaozhe
Hello! I need to use Kruskal-Wallis test and post-hoc test (Dunn's test) for my data. But when I searched around, I only found this function: kruskal.test. But nothing for Dunn's test. So I started to write one myself. But I do not know how to count ties in the data frame. I can use

[R] attribute name argument for getAttrib()

2011-08-11 Thread Wei Hao
Hi all: Having browsed Rinternals.h, it's a little unclear to me how to get attributes that aren't in the "Symbol Table Shortcuts" section of that file. In particular, I would like to extract the attribute "scaled:center" from a SEXP. Thanks [[alternative HTML version deleted]]

[R] Smooth monotone estimation on R&in-reply-to=3a822319eb35174ca3714066d590dcd504af8...@usrymx25.merck.com

2010-11-12 Thread Hao Li
arent.frame()) : numeric 'envir' arg not of length one Thanks in advance. Hao -- Hao Li [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posti

[R] bugs when using R-2.12.0 Please HELP!

2010-10-28 Thread Hao Wu
Hi, R-help group, I kinda meeting a question when using R-2.12.0(Previous version is 2.10.0): When I typed "library("Biobase")", everything is alright! But when I type "library("genefilter")", it doesn't work! And echo this: Error in library.dynam(lib, package, package.lib) : DLL 'R

Re: [R] ANNOUNCE--Rdsm package, a threads-like environment for R

2010-03-10 Thread Guo-Hao Huang
I am interested in Rdsm package, but I have no idea about how to use it. Where can I find examples? regards Guo-Hao Huang -- From: "Norm Matloff&q

Re: [R] Calling SAS from R

2010-03-01 Thread Guo-Hao Huang
SE) It' also easy to modify the example shown in help(system). with regards Guo-Hao Huang -- From: "

[R] how to write a function that remembers its state across its calls

2010-02-01 Thread Hao Cen
Hi, I wonder how to write a function that remembers its state across its calls. For example, I would like to compute the average of the pass three values the function has seen f(1) # NA f(2) # NA f(3) # 2 f(4) # 3 This would require f to keep track of the values it has seen. In other lan

Re: [R] ff package: ff objects don't reload completely on NFS drives from a different machine

2010-01-25 Thread Hao Cen
Hi Jens, Thanks for the suggestions. I tried closing the ff file on one nfs client and open that file from another client. It doesn't work. Jeff -Original Message- From: Jens Oehlschlägel [mailto:oehl_l...@gmx.de] Sent: Monday, January 25, 2010 5:07 PM To: h...@andrew.cmu.edu Cc: R-help@

[R] ff package: ff objects don't reload completely on NFS drives from a different machine

2010-01-23 Thread Hao Cen
Hi ff users and Jens, I am using the ff package and it has been working great. Recently I noticed an unexpected behavior in the ff package -- when I save an ff matrix on one machine to an NFS drive and load it on another machine from the save NFS drive, I got quote a lot of zeros in the matrix.

[R] "select: bad file descriptor" in the multicore package

2010-01-12 Thread Hao Cen
Hi, I wonder anyone knows what causes the error message "select: bad file descriptor" in the multicore package. This error sometimes occurs and sometimes doesn't. I couldn't find any documentation on this error about this package. thanks Jeff __ R-hel

Re: [R] how to organize a lot of R source files

2010-01-09 Thread Hao Cen
nt is passed to sourceTo()). > > /Henrik > > > On Fri, Jan 8, 2010 at 7:38 AM, Hao Cen wrote: > >> Hi, >> >> >> I wonder what is a better way to organize a lot of R source files. I >> have a lot of utility functions written and store them in several s

[R] how to organize a lot of R source files

2010-01-08 Thread Hao Cen
Hi, I wonder what is a better way to organize a lot of R source files. I have a lot of utility functions written and store them in several source files (e.g util1.R, util2.R,..utilN.R). I also have a master file in which the source command is used to load all the util.R files. When I need to use t

Re: [R] How to uninstall R packages

2010-01-04 Thread Guo-Hao Huang
?remove.packages Guo-Hao Huang -- From: "wenjun zheng" Sent: Monday, January 04, 2010 11:20 PM To: Subject: [R] How to uninstall R packages Dear all, I am puzzled that how can i uninstall a

[R] filehash - multiple indices via '[' not allowed when using RDS format

2010-01-02 Thread Hao Cen
Hi, I have been using filehash for a while. It has performed very well. However, recently I found filehash gives an error when I need to do something like db[c("a", "b")] when the db is in RDS format. Does any one know a way to get around that? The code below reproduces the error thanks Jeff f

Re: [R] pass functions and arguments to function

2009-12-29 Thread Hao Cen
n't work here process2(X) } On Tue, December 29, 2009 4:57 pm, Duncan Murdoch wrote: > On 29/12/2009 3:08 PM, Hao Cen wrote: > >> Hi, >> >> >> I wonder how to pass several functions and their arguments as arguments >> to a function. For e

[R] pass functions and arguments to function

2009-12-29 Thread Hao Cen
Hi, I wonder how to pass several functions and their arguments as arguments to a function. For example, the main function is f = function(X ) { process1(X) ... process2(X) } I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2), g3(X, par3). par1, par2 and par3 are

[R] (no subject)

2009-12-29 Thread Hao Cen
Hi, I wonder how to pass several functions and their arguments as arguments to a function. For example, the main function is f = function(X ) { process(X) ... process(X) } I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2), g3(X, par3). par1, par2 and par3 are para

[R] how to append new data to saved data on disk efficiently

2009-12-29 Thread Hao Cen
Hi, I currently combine multiple processed data (data frame) into a list and save the list as ".rda" using the save command. When new data come, I load the rda file, process the new data into a data frame, append the data frame to the end of the list, and save the whole list to the disk. The loadi

Re: [R] how can I use R functions in Fortran 90

2009-12-28 Thread Guo-Hao Huang
with regards, Guo-Hao Huang -- From: "Anny Huang" Sent: T

[R] how to do multiple responses in a linear regression

2009-12-24 Thread Hao Cen
Hi, I have multiple responses y1, y2, .., yn, and would like to do linear regression for each of them with x1, x2, ..., xm. Instead of doing regression n times, it it possible to do it all at once? I tried lm(y1+y2 ~ x1 + x2 + x3) and lm added y1 y2 and then did the regression. thanks Jeff ___

[R] foreach and deparse(substitute(x))

2009-12-11 Thread Hao Cen
Hi, I would like to get the actual object name passed as a parameter of a function and am using deparse(substitute(x)) to do that. It doesn't work when it is used along with the foreach package. Appreciate if any one can give some suggestions on how to make it work with foreach. FUN.aaa <- functi

[R] get the enclosing function name

2009-12-11 Thread Hao Cen
Hi, Is there a way to get the enclosing function name within a function? For example, I would like to have a function getEnclosingFunctionName(). It works like below f = function(){ print(getEnclosingFunctionName()) } f() # will print "f" Thanks Jeff __

[R] find the index of the next largest element in a sorted vector

2009-12-02 Thread Hao Cen
Hi, How can I find the index of the next largest element in a sorted vector if an element is not found. for example, searching 2 in c(0,3,4) would return 1 since 2 is not in the vector and 0 is the next largest element to 2. I tried which and match and neither returns such information. > which(

Re: [R] sort a data frame by a vector

2009-12-02 Thread Hao Cen
"), A2 = c(1,2,3)) >> >> >> dataDF[match(dataDF$A1,vec),] > A1 A2 > 3 C 3 > 2 A 2 > 1 B 1 > > > -Don > > > > At 10:36 PM -0500 12/1/09, Hao Cen wrote: > >> Hi, >> >> >> >> >> I have a a vector and

[R] sort a data frame by a vector

2009-12-01 Thread Hao Cen
Hi, I have a a vector and a data frame with two columns vec = c("C", "A", "B") dataDF = data.frame(A1 = c("B", "A", "C"), A2 = c(1,2,3)) I would like to sort the data frame by column A1 such that the order of elements in A1 is as the same as in vec. After the ordering, the data frame

Re: [R] questions on the ff package

2009-11-26 Thread Hao Cen
Hi Jens, Thanks for your prompt and informative answers. ff is a fabulous package and your suggestions helped me solve my problems at hands. As I need to incrementally increase each of several large matrices (about 1000 rows *1 columns, 1000 matrices) by a row every day. I wonder how efficien

Re: [R] ow to have R automatically print traceback upon errors

2009-11-26 Thread Hao Cen
.@gmail.com] Sent: Monday, November 23, 2009 11:00 PM To: Hao Cen Cc: r-help@r-project.org Subject: Re: [R] ow to have R automatically print traceback upon errors I use this: options(error=utils::recover) and anytime an error occurs in the interactive mode, it will print out the traceback and

[R] questions on the ff package

2009-11-24 Thread Hao Cen
Hi, I have two questions on using the ff package and wonder if anyone who used ff can share some thoughts. I need to save a matrix as a memory-mapped file and load it back later. To save the matrix, I use mat = matrix(1:20, 4, 5) matFF = ff(mat, dim=dim(mat), filename="~/a.mat", overwrite=TRUE,

[R] ow to have R automatically print traceback upon errors

2009-11-23 Thread Hao Cen
Hi, I wonder how to have R automatically print stack trace produced by traceback upon errors during interactive uses. I tried the suggestions on http://old.nabble.com/Automatically-execute-traceback-when-execution-of-script-causes-error--td22368483.html#a22368775 and used options(error = recover)

[R] how to link C code with gsl from R CMD and dyn.load

2009-11-19 Thread Hao Cen
Hi, I am writing a function in C that is meant to be called by R. In the C function, I used a gsl function gsl_stats_mean. The code is as simple as below void gsl(double *m, int *dim){ int r, c; r = dim[0]; c = dim[1]; double mean = gsl_stats_mean(&m[0], 1, r);

Re: [R] extracting the last row of each group in a data frame

2009-11-16 Thread Hao Cen
Thanks to all who helped. These are all great suggestions. Jeff -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Monday, November 16, 2009 6:27 PM To: Hao Cen Cc: r-help@r-project.org Subject: Re: [R] extracting the last row of each group in a data

[R] extracting the last row of each group in a data frame

2009-11-16 Thread Hao Cen
Hi, I would like to extract the last row of each group in a data frame. The data frame is as follows Name Value A 1 A 2 A 3 B 4 B 8 C 2 D 3 I would like to get a data frame as Name Value A 3 B 8 C 2 D 3 Thank you for your suggestions in advance Jeff __

Re: [R] how to pass matrices from C to R effectively

2009-11-12 Thread Hao Cen
ointer and generate the required matrix along the length of the array? If this is not what you meant, would you please give me a small example? Jeff On Thu, November 12, 2009 6:53 pm, Duncan Murdoch wrote: > On 12/11/2009 6:45 PM, Hao Cen wrote: > >> Hi, >> >> >> I

[R] how to pass matrices from C to R effectively

2009-11-12 Thread Hao Cen
Hi, I have C code to produce a lot of matrices to be analyzed. As these matrices are large (> 1000*1) and are a lot (> 1000), I am thinking about how to pass them from C to R effectively. Would you think about the following solution? In R, I create a wrapper function passDataFromCToR = funct

Re: [R] dividing a matrix by positive sum or negative sum depending on the sign

2009-11-12 Thread Hao Cen
unable to compare any of these methods to his > strategy. > > -- > David. > >> >> >>> system.time(replicate(1, t( apply(mat, 1, function(x) >> ifelse( x <0, -x/sum(x[x<0], na.rm=T), x/sum(x[x>0], na.rm=T) ) ) ) ) ) >> user system elapsed

[R] dividing a matrix by positive sum or negative sum depending on the sign

2009-11-11 Thread Hao Cen
Hi, I have a matrix with positive numbers, negative numbers, and NAs. An example of the matrix is as follows -1 -1 2 NA 3 3 -2 -1 1 1 NA -2 I need to compute a scaled version of this matrix. The scaling method is dividing each positive numbers in each row by the sum of positive numbers in that r

Re: [R] save an object by dynamicly created name

2009-11-08 Thread Hao Cen
all the binary files to /dev/shm (shared memory section in linux) but the speed of loadObject on /dev/shm remains the same as on the disk. Thanks Hao -Original Message- From: henrik.bengts...@gmail.com [mailto:henrik.bengts...@gmail.com] On Behalf Of Henrik Bengtsson Sent: Monday

Re: [R] save an object by dynamicly created name

2009-11-02 Thread Hao Cen
10) { assign( paste("m", i, sep=""), i:5) filename <- sprintf("m%02d.Rdta", i) pathname <- file.path(path, filename) save(list = paste("m", i, sep=""), file=pathname) } Thanks a lot Hao -Original Message- From: henrik.bengts...@gmai

[R] runmax function only for positive numbers?

2009-08-11 Thread Jiucang Hao
Hi All, I did a google search and could not find the answer. Thus I post this message. I found runmax only work for positive numbers. x = rep(-1,10) runmax(x,3) x = rep(0, 10) runmax(x,3) for 32-bit R, i got very small numbers: 2.121996e-314 for 64-bit R, i got NaN. Is it a bug in runm

[R] Is there any Gauss-newton library/function in R?

2009-07-10 Thread Hao Jiang
Hi,I am a newbie to R. I wrote a simple Gauss-newton method in least square minimization problems, but it looks not working well. Is there any Gauss-newton library/function in R? Appreciate in advance! Hao [[alternative HTML version deleted

Re: [R] Plot 2-d Polynomial without solving it

2009-07-04 Thread Hao Jiang
Thanks a lot! I got it! I haven't set the level before.Hao On Sat, Jul 4, 2009 at 6:33 PM, Duncan Murdoch wrote: > On 04/07/2009 3:31 PM, Hao Jiang wrote: > >> Hi Duncan,Thanks! >> >> But I still get a little confused about outer() func. Would give me a >> si

Re: [R] Plot 2-d Polynomial without solving it

2009-07-04 Thread Hao Jiang
Hi Duncan,Thanks! But I still get a little confused about outer() func. Would give me a simple example to contour it? Just like the formula x^2 + y^2 + x + y -5 = 0. (Sorry I am a newbie to R, found really hard to use the R manual) Thanks, Hao On Sat, Jul 4, 2009 at 7:10 AM, Duncan Murdoch

[R] Plot 2-d Polynomial without solving it

2009-07-03 Thread Hao Jiang
Hi, I want to plot a polynomial in the form like ax^2 + bxy + cy^2 + dx + ey + f =0 without solving it(since I may have 3 or 4 dimensional polynomial and it's really hard to solve). Is there any way to plot this kind of polynomial? Thanks a lot! Hao -- View this message in context:

[R] Please Help pairwise.t.test!!

2009-06-11 Thread Chun-Hao Tu
Hi R users, My question is, If I have 3 groups, A, B, C and I know mean of A =20, B=21, and C=20.5 and I also know the standard error of A =1.1, B=2.2, C=3.2. Plus, I know A has 30 observations, B has 78, C has 45. But I do not have the raw data. Can I use pairwise.t.test to conduct a Bon

Re: [R] Help How to use a loop to do pair comparison

2009-02-24 Thread Chun-Hao Tu
Hi Patrick, Thank you for your hint. I got it works. > x<-1:3 > result<-ifelse(test=outer(X=x,Y=x,FUN=">"), yes="Big", + ifelse(test=outer(X=x,Y=x,FUN="<"), yes="Small", "Equal")) > result [,1][,2][,3] [1,] "Equal" "Small" "Small" [2,] "Big" "Equal" "Small" [3,]

Re: [R] Help in writing my own function

2009-02-23 Thread Chun-Hao Tu
Hi Ted, I strongly recommend a book: S programming by W.N Venables and B.D Ripley ISBN: 0387-989668 It is easy to read. I love this book so much. Maybe someone has better idea. Super Chunhao > Date: Mon, 23 Feb 2009 04:56:18 -0800 > From: zengzhenx...@gmail.com > To: r-help@r-projec

Re: [R] Filtering a data frame using a string for colum header

2009-02-22 Thread Chun-Hao Tu
Hi Tony, I "GUESS" my.df[-"DrHorrible"] does not tell R which column "NUMBER" would like to remove. As we know, we could use my.df[-4] and it exactly tells R which column must remvoer from your data. > my.df[-4] Angel Buffy Firefly 1 7 8 9 2 8 9 9 3 6 4

Re: [R] 3D or 4D plot

2009-02-20 Thread Huang, Guo-Hao
You can try rgl package. It utilizes OpenGL library. Or, check the CRAN to find other gtk based package - Original Message - From: "kapo coulibaly" To: Sent: Friday, February 20, 2009 11:50 PM Subject: [R] 3D or 4D plot I have data on a regular grid in the format: x y z data. I wou

Re: [R] everybody loves R...

2009-02-20 Thread Huang, Guo-Hao
I also plan to create a R website in Taiwan (locale: Traditional Chinese). My reason is the same as you. Welcome people in taiwan to give me suggestion. - Original Message - From: "UsuarioR España" To: ; Cc: Sent: Friday, February 20, 2009 5:59 PM Subject: Re: [R] everybody loves R..

Re: [R] write.table

2009-02-20 Thread Huang, Guo-Hao
May you put your code and data in the internet? It will be easy for others to find your real problem. - Original Message - From: To: Sent: Friday, February 20, 2009 7:54 PM Subject: Re: [R] write.table Thank you for your advice, but I didn't manage to make it work... I tried carichi.

[R] Need Help for creating a new variable

2009-02-19 Thread Chun-Hao Tu
Hi R users, I did do the research and work on for hours, but I still don't know how to solve my silly problem. I try to creat a new variable in my dataset. such as if diet=="C" && vesl=="P" then trt="CP"; if diet=="C" && vesl=="A" then trt="CA";. The following is my code (It does not wo

[R] Please Help for Augmented Prediction Plot

2009-01-27 Thread Chun-Hao Tu
Hi R users,I have a question about augmented prediction plot (?augPred). The covariate of my data set is c(0, 0.01, 0.1, 1, 10, 100, 1000) and I have fitted a nonlinear mixed effects model.I use plot(augPred(out.nlme)) to get the augmented prediction plot. However, because the scale of th

[R] heatmap.2 color issue

2009-01-20 Thread Liu, Hao [CNTUS]
to make the heatmap more balanced between red and green, I tried to read the heatmap.2 help but could not get a clear idea. Thanks Hao [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listi

[R] glmnet : Error in validObject(.Object) :

2008-12-17 Thread Hao
Could any one help ? I start to learn the glmnet package. I tried with the example in the manual. x=matrix(rnorm(100*20),100,20) y=rnorm(100) fit1=glmnet(x,y) When I tried to fit the model, I received the error message: Error in validObject(.Object) : invalid class "dgCMatrix" object: row in

[R] more color choice with heatmap.2

2008-11-20 Thread Liu, Hao [CNTUS]
Dear All: I have a question on how to get more choices of color to show gene expression up or down regulation, like choosing the neutral color as yellow, any way to work with the color transition? I could not find any reference on those. Thanks for your help Hao [[alternative

[R] Error of exp() in a dll from Fortran

2008-07-12 Thread Hao Ren Sr
7 8 9 10 $A [1] 17066.21 58265.20 179948.41 390001.06 576529.12 0.00 0.00 [8] 0.00 0.00 0.00 I tried to figur out what happened, but confused. Any suggestion? Thanks Hao Ren __ R-help@r-project.org mailing list https://