[R] Lower bound and upper bound in maximum likelihood

2018-05-19 Thread Siow Yun Tan
Dear all, I need to simulate data which fit to a double poisson time series model with certain parameters. Then, check whether the estimated parameter close to the true parameter by using maximum likelihood estimation. Simulation: set.seed(10) library("rmutil") a0 = 1.5; a1 = 0.4; b1

[R] Is there a way to prevent Rscript from opening help page when given an error

2016-10-14 Thread Tan, Johnny
I posted this on stackoverflow but there hasn't been any replies, does anyone know a solution for this? I am running a script via command line using Rscript nameOfmyRscript. I notice that when there is an error, my browser would open with the help page. Now my script contained repeated erro

[R] VGAM - complementary log-log Model

2016-10-03 Thread Teck Kiang Tan
While running the vglm() with specification of cumulative(link=cloglog) with a more complicated model, the following errors appeared. How to go about solving it? Error in if ((temp <- sum(wz[, 1:M, drop = FALSE] < wzepsilon))) warning(paste(temp, : argument is not interpretable as logical In

[R] R: use switch or function in connecting different cases.

2016-04-24 Thread tan sj
HI, I am trying to use switch () function to connect the three distribution (normal ,gamma with equal skewness and gamma with unequal skewness. But i am losing my ideas since i have sample sizes-(10,10),(10,25),(25,25),(25,50),(25,100),50,25),(50,100), (100,25),(100,100) standard deviation rat

Re: [R] R [coding : do not run for every row ]

2016-04-18 Thread tan sj
2016 10:03 AM To: tan sj; r-help@r-project.org Subject: Re: [R] R [coding : do not run for every row ] Always keep the mailing list in cc. The code runs for each row in the data. However I get the feeling that there is a mismatch between what you think that is in the data and the actual data. i

Re: [R] R [coding : do not run for every row ]

2016-04-18 Thread tan sj
a and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2016-04-17 19:59 GMT+02:00 tan sj : > i have combined all the variables in a matrix, and i wish to conduct a > simulation row by row. > > But i found out

[R] R [coding : do not run for every row ]

2016-04-17 Thread tan sj
i have combined all the variables in a matrix, and i wish to conduct a simulation row by row. But i found out the code only works for the every first row after a cycle of nine samples. But after check out the code, i don know where is my mistake... can anyone pls help #For gamma disribu

[R] R [loop statement ]

2016-04-15 Thread tan sj
hi, i am new in this field. I am now writing a code in robustness simulation study. I have written a brief code "for loop" for the factor (samples sizes d,std deviation ) , i wish to test them in gamma distribution with equal and unequal skewness, with the above for loop in a single code if pos

[R] [R ] help in if else in connect the simulation in normal and gamma distribution.

2016-04-07 Thread tan sj
I am new in R. I have to conduct simulation study on the robustness of 2 sample tests on several combination of factors (sample sizes ,variance and distribution). I have been completed write a code in normal distribution, and now i wish to add if -else in the code so that the code can simulate

Re: [R] R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]

2016-04-06 Thread tan sj
elements of vectors. You could also use a matrix and then convert it into a vector using as.vector: testmat3<-matrix(0,nrow=5,ncol=5) for(i in 1:5) { for(j in 1:5) { testmat3[i,j]<-i+j } } as.vector(testmat3) Jim On Wed, Apr 6, 2016 at 8:04 PM, tan sj wrote: > Hi, i am sorry to inter

[R] R simulation help pls

2016-04-06 Thread tan sj
Hi, i am student from malaysia, i am new in r programming field, now i am trying to conduct a robustness study on 2 sample test under several combination of factors such as sample sizes ,standard deviation ratio and also distribution.. but now i am stucking in how to use for loop or apply fun

[R] R-dvel [robustness Simulation study of 2 sample test on several combination of factors ]

2016-04-04 Thread tan sj
hi, i am new in this field. do favorite If I wish to conduct a simulation on the robustness of two sample test by using R language, is that any ways in writing the code? There ar

Re: [R] lme4 package installation

2015-08-14 Thread Teck Kiang Tan
at 1:29 PM, Uwe Ligges wrote: > > > On 13.08.2015 22:52, Teck Kiang Tan wrote: > >> Hi all >> >> I have problem in installation lme4 and have tried over the past 2 days. >> It >> failed to install from the various countries. >> >> install.p

Re: [R] lme4 package installation

2015-08-13 Thread Teck Kiang Tan
Hi all I have problem in installation lme4 and have tried over the past 2 days. It failed to install from the various countries. > install.packages("lme4") Warning: unable to access index for repository http://cran.stat.nus.edu.sg/src/contrib Warning: unable to access index for repository http://

[R] R-project on App-V 5

2015-07-08 Thread Gilfred Tan
questions you may have on my requests, otherwise thanks in advance for the assistance. Regards Gilfred Tan Discovery Engineer Aberdeen Asset Management Asia Limited (Reg. No. 199105448E) Tel: +65 6395 2642 aberdeen-asset.com<http://www.aberdeen-asset.com/> Find out how aspects of everyda

Re: [R] get latest dates for different people in a dataset

2015-01-26 Thread Tan, Richard
Thank you! From: William Dunlap [mailto:wdun...@tibco.com] Sent: Friday, January 23, 2015 7:14 PM To: Tan, Richard Cc: r-help@R-project.org Subject: Re: [R] get latest dates for different people in a dataset Here is one way. Sort the data.frame, first by Name then break ties with CheckInDate

Re: [R] get latest dates for different people in a dataset

2015-01-26 Thread Tan, Richard
Thank you! -Original Message- From: Chel Hee Lee [mailto:chl...@mail.usask.ca] Sent: Friday, January 23, 2015 8:09 PM To: Tan, Richard; 'r-help@R-project.org' Subject: Re: [R] get latest dates for different people in a dataset > do.call(rbind, lapply(split(data, data$Name

Re: [R] get latest dates for different people in a dataset

2015-01-26 Thread Tan, Richard
Thank you! -Original Message- From: David Barron [mailto:dnbar...@gmail.com] Sent: Saturday, January 24, 2015 7:56 AM To: Tan, Richard; r-help@R-project.org Subject: Re: [R] get latest dates for different people in a dataset Hi Richard, You could also do it using the package dplyr

[R] get latest dates for different people in a dataset

2015-01-23 Thread Tan, Richard
Hi, Can someone help for a R question? I have a data set like: NameCheckInDate Temp John 1/3/2014 97 Mary 1/3/2014 98.1 Sam 1/4/2014 97.5 John 1/4/2014 99 I'd like to return a dataset that for each Name, get the ro

[R] Datamatrix in R - extracting data from scatterplot

2013-08-15 Thread BoonFei Tan
Say I have a dataframe for plotting scatterplot. The dataframe would be organized in the following fashion (in CSV format): name ABC EFG132 45256 67 to, say 200 000 entries I am going to first do a scatterplot, after which I am going to subset a portion of the dataset into A using alpha

[R] Seeking help re: ? single apply command or an alternative

2011-04-21 Thread Min-Han Tan
Dear R-help list, Sorry to trouble everyone. This seems like it could be achieved with a single command (? variant of apply), but I am not quite seeing it. I am trying to multiply one vector (a1 below) by corresponding values in a3 (as determined by matching element in a vector a2). The example b

Re: [R] Deleting the last value of a vector

2011-04-17 Thread Min-Han Tan
Or perhaps even more parsimoniously (by a couple of characters) - r <- c(1, 2, 3, 4, 5) r2<-r[-length(r)] Min-Han On Sun, Apr 17, 2011 at 10:23 PM, Daisy Englert Duursma < daisy.duur...@gmail.com> wrote: > A easier solution: > > r <- c(1, 2, 3, 4, 5) > r2<-r[1:length(r)-1] > > > > > On Mon, Apr

[R] categorize a character column

2011-01-05 Thread Tan, Richard
> result item loc cat 1 item 1.1: earnings item 1.2: w2 shelf 1 AB 2 item 1.3: deductions drawer 1 C 3 item 1.1: earnings shelf 2 A Thanks, Richard From: Tan, Richard Sent: Wednesday, January 05,

[R] categorize a character column

2011-01-05 Thread Tan, Richard
Hi, I know I can do this with a for loop with strsplit and grep, but is there more efficient way? Given a data dataframe (input) and a category column (lst), > input item loc 1 item 1.1: earnings item 1.2: w2 shelf 1 2

Re: [R] aggregate a Date column does not work?

2010-11-22 Thread Tan, Richard
onday, November 22, 2010 3:58 PM To: Tan, Richard Cc: r-help@r-project.org Subject: Re: [R] aggregate a Date column does not work? On Nov 22, 2010, at 3:54 PM, Tan, Richard wrote: > Thanks, add as.Date('1970-01-01') to the result column works. But that should make them all the same d

Re: [R] aggregate a Date column does not work?

2010-11-22 Thread Tan, Richard
Thanks, add as.Date('1970-01-01') to the result column works. Richard -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Monday, November 22, 2010 3:51 PM To: Tan, Richard Cc: r-help@r-project.org Subject: Re: [R] aggregate a Date column does not

[R] aggregate a Date column does not work?

2010-11-22 Thread Tan, Richard
Hi, I am trying to aggregate max a Date type column but have weird result, how do I fix this? > a <- rbind( + data.frame(name='Tom', payday=as.Date('1999-01-01')), + data.frame(name='Tom', payday=as.Date('2000-01-01')), + data.frame(name='Pete', payday=as.Date('1998-01-01')), + data.frame(n

Re: [R] aggregate text column by a few rows

2010-10-07 Thread Tan, Richard
Thank you! Richard -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: Thursday, October 07, 2010 12:08 PM To: Tan, Richard Cc: r-help@r-project.org Subject: Re: [R] aggregate text column by a few rows try this using sqldf: > a id name hobby 1 1 Tom fishin

[R] aggregate text column by a few rows

2010-10-07 Thread Tan, Richard
Hi, R function aggregate can only take summary stats functions, can I aggregate text columns? For example, for the dataframe below, > a <- rbind(data.frame(id=1, name='Tom', hobby='fishing'),data.frame(id=1, name='Tom', hobby='reading'),data.frame(id=2, name='Mary', hobby='reading'),data.fram

Re: [R] get top n rows group by a column from a dataframe

2010-09-16 Thread Tan, Richard
Thanks, it works. Richard From: Henrique Dallazuanna [mailto:www...@gmail.com] Sent: Thursday, September 16, 2010 1:56 PM To: Tan, Richard Cc: RICHARD M. HEIBERGER; r-help@r-project.org Subject: Re: [R] get top n rows group by a column from a dataframe You can try this: (Using

Re: [R] get top n rows group by a column from a dataframe

2010-09-16 Thread Tan, Richard
Hi Richard Thanks for the suggestion, but I want top 5 salary for each company, not the whole list. I don't see how your way can work? Thanks, Richard From: RICHARD M. HEIBERGER [mailto:r...@temple.edu] Sent: Thursday, September 16, 2010 11:53 AM To: Tan, Richard Cc: r-h

[R] get top n rows group by a column from a dataframe

2010-09-16 Thread Tan, Richard
Hi, is there an R function like sql's TOP key word? I have a dataframe that has 3 columns: company, person, salary How do I get top 5 highest paid person for each company, and if I have fewer than 5 people for a company, just return all of them? Thanks, Richard [[alternati

[R] coxph and ordinal variables?

2010-09-08 Thread Min-Han Tan
Dear R-help members, Apologies - I am posting on behalf of a colleague, who is a little puzzled as STATA and R seem to be yielding different survival estimates for the same dataset when treating a variable as ordinal. Ordered() is used to represent an ordinal variable) I understand that R's coxph

[R] pdf indifferent to lwd after some small number<1 (e.g. 0.18)

2010-08-06 Thread Chuen Tan
Hi, To plot a figure, I used lwd=0.18 in the function lines() to plot very fine lines. However, using png() or pdf() to save the figure, it appears that lwd has no effect on pdf() beyond some small number (e.g. 0.18) and the lines looks much thicker than png(). Setting lwd<0.18 does not make th

Re: [R] Scatterplot_row match

2010-07-15 Thread Yanwei Tan
; df1 <- subset(dframe,select=c("id2c","2c")) > df2 <- subset(dframe,select=c("id1c","1c")) > > merged <- merge(df1,df2,by.x="id2c",by.y="id1c",all=TRUE) > > plot(merged$1c,merged$2c) > > Cheers, > > Jonath

[R] Scatterplot_row match

2010-07-15 Thread Yanwei Tan
Dear all, I would like to make a scatter plot using "plot" function. I have two sample 1c and 2c, the 1st and 3rd are the ID of each gene, the 2nd and 3rd are the values. But as you can see some genes are not in the same row, i.e: ENSMUSG0001020 is in the 4th row in sample 2c and 7th row

Re: [R] How to delete the previously saved workspace restored

2010-05-31 Thread Yanwei Tan
Thanks a lot David! I use MacOSX and deleted the .RData file, then everything is fine. Best wishes, Wei On 5/31/10 2:49 PM, David Winsemius wrote: On May 31, 2010, at 5:10 AM, Yanwei Tan wrote: Dear all, I am a new user of R, here I have a question about remove the previous restored

[R] How to delete the previously saved workspace restored

2010-05-31 Thread Yanwei Tan
Dear all, I am a new user of R, here I have a question about remove the previous restored workspace. I saved the workspace last time, but R always automatically load the workspace when I open it. I try to remove the object and then close R without saving. But next time when I open R, it alw

[R] Installation problem with "geepack"

2010-05-20 Thread Xianming Tan
Hi there, I just installed the package under windows, and it works very well. However, as I tried to install it on a cluster which uses linux OS, "Linux lionxc.aset.psu.edu 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux" I always failed. The message during

Re: [R] Compiling R with --enable-R-shlib for rpy2 error

2010-05-18 Thread Padma TAN
Thanks for the help! :) Regards, Padma Tan Genome Institute of Singapore 60 Biopolis Street, Genome #02-01 Singapore 138672 DID : 6478 8671 Fax : 6478 9058 email: ta...@gis.a-star.edu.sg

Re: [R] Compiling R with --enable-R-shlib for rpy2 error

2010-05-17 Thread Padma TAN
Hi, Thanks! :) I'll install the newer version of R. However do I have to recompile all the modules that I did for my previous version of R? Regards, Padma Tan Genome Institute of Singapore 60 Biopolis Street, Genome #02-01 Singapore 138672 DID : 6478 8671 Fax : 6478 9058 email: ta...@

Re: [R] Compiling R with --enable-R-shlib for rpy2 error

2010-05-14 Thread Padma TAN
et_rconfig raise Exception(cmd + '\nreturned\n' + rconfig) Exception: "/usr/local/R/R-2.9.2/lib64/R/bin/R" CMD config --cppflags returned Thanks again :) Regards, Padma On 5/13/10 11:30 PM, "Uwe Ligges" wrote: On 13.05.2010 11:45, Padma TAN wrote: > Hi

[R] Compiling R with --enable-R-shlib for rpy2 error

2010-05-13 Thread Padma TAN
Hi, I am trying to compile R with the command below in order to install rpy2. ./configure --prefix=/usr/local/R/R-2.9.2 --with-gnu-ld --with-cairo --with-x --enable-R-shlib However, error the I have gotten was: /usr/bin/ld: CConverters.o: relocation R_X86_64_32S against `R_FunTab' can not be us

Re: [R] Apologies : question on transforming a table

2010-05-06 Thread Min-Han Tan
6, 2010 at 3:38 PM, William Dunlap wrote: > > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > -Original Message- > > From: r-help-boun...@r-project.org > > [mailto:r-help-boun...@r-project.org] On Behalf Of Min-Han Tan > > Sent:

[R] Apologies : question on transforming a table

2010-05-06 Thread Min-Han Tan
Dear R-help list, Apologies. I am trying to convert one table to another. It feels that it should be a very straightforward answer with a single (or two) commands with the right extensions, but I really can't figure this out right now. I have several hundred pheno factors actually, so manually do

[R] R Anova Analysis

2010-04-29 Thread Yanwei Tan
Dear all, I have a quite basic questions about anova analysis in R, sorry for this, but I have no clue how to explain this result. I have two datasets which are named: nmda123, nmda456. Each dataset has three samples which were measured three times. And I would like to compare means of them

[R] Problem with parsing a dataset - help earnestly sought

2010-04-22 Thread Min-Han Tan
Dear fellow R-help members, I hope to seek your advice on how to parse/manage a dataset with hundreds of columns. Two examples of these columns, 'cancer.problems', and 'neuro.problems' are depicted below. Essentially, I need to parse this into a useful dataset, and unfortunately, I am not familiar

Re: [R] tapply syntax

2010-03-26 Thread Min-Han Tan
Min-Han On Fri, Mar 26, 2010 at 12:40 PM, Min-Han Tan wrote: > Dear R-help members, > > Apologies for the trouble. > > I have a question : > > Essentially, I have a dataset which stores genetic variations for > individual patients. Each individual patient can have more t

[R] tapply syntax

2010-03-26 Thread Min-Han Tan
Dear R-help members, Apologies for the trouble. I have a question : Essentially, I have a dataset which stores genetic variations for individual patients. Each individual patient can have more than one variation, and each new record corresponds to a new variation (thus, both individual patients

Re: [R] data frame select max group by like function

2010-03-09 Thread Tan, Richard
Thanks all for the help! -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Tuesday, March 09, 2010 5:58 PM To: Phil Spector; Tan, Richard Cc: r-help@r-project.org Subject: RE: [R] data frame select max group by like function And yet another way is > isLastIn

[R] data frame select max group by like function

2010-03-09 Thread Tan, Richard
Hi, I have a data frame with 3 columns: ID, year and score. How can I select for each unique ID, the year that has the max score? For example, for data frame ID, year, score tom, 1995, 88 rick, 1994, 90 mary, 2000, 97 tom, 1998, 60 mary, 1998,100 I shall have ID, year, score tom, 1995, 88 ric

[R] Average regions of non-zeros

2010-03-07 Thread Daren Tan
x <- c(0,0,1,2,3,0,0,4,5,6) How to identify the regions of non-zeros and average c(1,2,3) and c(4,5,6) to get 2 and 5. Thanks _ Hotmail: Trusted email with Microsoft¡¯s powerful

[R] gsub does not support \b?

2009-11-10 Thread Tan, Richard
Hello, can someone help? How come > gsub("\bINDS\b","INDUSTRIES","ADVANCED ENERGY INDS") [1] "ADVANCED ENERGY INDS" not ADVANCED ENERGY INDUSTRIES Thanks. Richard [[alternative HTML version deleted]] __ R-help@r-project.org mailing li

Re: [R] gsub does not support \b?

2009-11-10 Thread Tan, Richard
Ok, I figured it out. My stupid mistake, should be \\b instead of \b. From: Tan, Richard Sent: Tuesday, November 10, 2009 3:36 PM To: 'r-help@r-project.org' Subject: gsub does not support \b? Hello, can someone help? How come > g

Re: [R] Regex question to find a string that contains 5-9 alpha-numeric characters, at least one of which is a number

2009-06-09 Thread Tan, Richard
e- From: Wacek Kusnierczyk [mailto:waclaw.marcin.kusnierc...@idi.ntnu.no] Sent: Tuesday, June 09, 2009 1:06 PM To: Greg Snow Cc: Marc Schwartz; Barry Rowlingson; r-help@r-project.org; Tan, Richard Subject: Re: [R] Regex question to find a string that contains 5-9 alpha-numeric characters, at least one of

[R] Regex question to find a string that contains 5-9 alpha-numeric characters, at least one of which is a number

2009-06-08 Thread Tan, Richard
Hi, This is not exactly an R question but I am trying to use gsub to replace a string that contains 5-9 alpha-numeric characters, at least one of which is a number. Is there a good way to write it in a one line regex? Thanks, Richard __ R-help@r-proj

[R] How to run Rcmdr in Mac Os X Tiger?

2009-05-17 Thread Jenny Tan (Dr J)
This question might been asked previously (I googled), but I can't find a workable solution in the archives. My question is: how to run Rcdmr in Mac Os X? The error message when I launched Rcmdr fresh from a R session is: Version of R: R 2.8.1 GUI 1.27 Tiger build 32-bit (5301) > library(Rcmdr)

[R] Subsetting a vector of numerics such that standard deviation is less than 0.5 ?

2009-04-21 Thread Daren Tan
> set.seed(999) > abs(rnorm(20)) [1] 0.28174016 1.31255963 0.79518398 0.27007049 0.27730642 0.56602374 1.87865826 1.26679114 0.96774968 1.12100936 1.32546371 0.13397739 0.93874945 [14] 0.17253810 0.95765045 1.36268625 0.06833513 0.10065765 0.90134475 2.07435711 > v <- abs(rnorm(20)) > v [1] 1.228

[R] Turning off warnings from cor.test

2009-04-17 Thread Daren Tan
I would like to turn off the warnings from cor.test while retaining exact=NULL. Is that possible ? > cor.test(c(1,2,3,3,4,5), c(1,2,3,3,4,5), method = "spearman") Spearman's rank correlation rho data: c(1, 2, 3, 3, 4, 5) and c(1, 2, 3, 3, 4, 5) S = 0, p-value < 2.2e-16 alternative hypo

[R] geometric mean to handle large number and negative values

2009-04-15 Thread Daren Tan
I have created two functions to compute geometric means. Method 1 can handle even number of negative values but not large number, vice versa for method 2. How can I merge both functions so that both large number and negative values can be handled ? > geometric.mean1 <- function(x) prod(x)^(1/lengt

Re: [R] toupper does not work in sub + regex

2009-04-13 Thread Tan, Richard
m: William Dunlap [mailto:wdun...@tibco.com] Sent: Monday, April 13, 2009 1:17 PM To: Tan, Richard; r-help@r-project.org Subject: Re: [R] toupper does not work in sub + regex You could also use \\U and \\L in the replacement with perl=TRUE. \\U "converts the rest of the replacement to upper case&

Re: [R] toupper does not work in sub + regex

2009-04-13 Thread Tan, Richard
Thanks, Martin. I did not realize that. I never used perl compatible regex before but seems now I should! Richard -Original Message- From: Martin Morgan [mailto:mtmor...@fhcrc.org] Sent: Monday, April 13, 2009 12:08 PM To: Tan, Richard Subject: Re: [R] toupper does not work in sub

[R] toupper does not work in sub + regex

2009-04-13 Thread Tan, Richard
Hi, I don't know what I am doing wrong to the toupper does not seem working in sub + regex. The following returns 's' not the upper class 'S' as I expect: sub("q_([a-z])[a-zA-Z]*",toupper('\\1'),"q_sviRaw") Can someone tell me where I did wrong? Thanks, Richard [[alternative HTML ve

[R] Colour each letter of a text string in a plot

2009-04-08 Thread Daren Tan
I am inserting a DNA sequence into a plot, and hope to colourize each of the four nucleotide of the DNA sequence with a unique colour i.e., A ("red"), C ("green"), G ("blue", and T ("yellow"). I use the following codes, but the DNA sequence only shows as "red" DNA <- "ACGT" plot(1, xlim = c(0,1)

[R] How to preserve NULL in vector

2009-04-06 Thread Daren Tan
I have a vector containing NULL. Referencing to that NULL gives me NA instead, which disrupt my codes. How can i preserve NULL as it is ? > res <- c(1,2,NULL) > res[1] [1] 1 > res[2] [1] 2 > res[3] [1] NA __ R-help@r-project.org mailing list https://sta

Re: [R] line argument in mtext for axis ?

2009-04-06 Thread Daren Tan
ging the default to the value of your choice > might do what you want. > > Hope that helps, > Annette > > Daren Tan schrieb: >> >> Previously, I wasn't aware that axis() supports "las" arguments, and >> as a result, I used axis() for the ticks an

Re: [R] line argument in mtext for axis ?

2009-04-06 Thread Daren Tan
is that much of my mtext() codes set the "line" argument to some values. The "line" argument in axis() doesn't work the same way according to the help page, is there an equivalent argument in axis() that functions identically to the "line" argument in mtext() ? 200

[R] line argument in mtext for axis ?

2009-04-05 Thread Daren Tan
Is there a similar argument for axis that controls the position of labels via line argument in mtext ? __ 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-gui

[R] Passing parameters to R script in Rgui

2009-03-27 Thread Daren Tan
How do I pass parameters to R script in Rgui ? Currently, I am using source("foo.R"). Thanks __ 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 a

[R] Combining multiple dataframes in a list

2009-03-26 Thread Daren Tan
I have a list containing multiple dataframes. Depending on whether the dataframes have 1 column or more than 1 columns, the column names are named differently. How can I force single column dataframes to have prefixed column names ? > m<- list(fc=data.frame(A=1:3)) > do.call(cbind, m) A 1 1 2 2

[R] Warning messages from quantreg

2009-03-26 Thread Daren Tan
Hi, I keep getting warning messages from quantreg about "tiny diagonals replaced with Inf when calling blkfct". Is there any cause for concern like improper codes, NAs in datasets or missing values ? Thanks Stanley __ R-help@r-project.org mailing list h

Re: [R] Legend containing maths symbol and values of variables

2009-03-24 Thread Daren Tan
Down", "NA") > legend("top", leg = as.expression(L)) > > > On Tue, Mar 24, 2009 at 7:18 AM, Gabor Grothendieck > wrote: >> Try this: >> >> L <- list(bquote("Up (" >= .(threshold) ~ ")"), "Normal", "Down",

Re: [R] Legend containing maths symbol and values of variables

2009-03-23 Thread Daren Tan
expression(c(sprintf("Up (>= %d)", threshold), >        "Normal", "Down", "NA")) > > or use paste in place of sprintf. > > On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan wrote: >> I need to have the maths symbol for >= in the legend, and t

[R] Legend containing maths symbol and values of variables

2009-03-23 Thread Daren Tan
I need to have the maths symbol for >= in the legend, and to substitute threshold variable with its value. Somehow, various attempts weren't successful. Please help. threshold <- 0.5 plot(NA, xlab="", ylab="", main="", axes=F, xlim=c(0,1), ylim=c(0,1), xaxs="i", yaxs="i") legend(x=0, y=1, fill=c(

[R] Summarizing each row into a frequency table

2009-03-23 Thread Daren Tan
I have a matrix containing -1, 0, 1, however certain rows will not have all 3 numbers. I have written some codes to compute the frequency table of how many -1s, 0s, 1s per row, but it is very ugly and not efficient if there are more than 3 numbers. Please suggest. m <- rbind(sample(0:1, replace=T,

[R] Capitalizing first letter of word or phrase

2009-03-23 Thread Daren Tan
I managed to find toupper() which translates all letters to uppercase. Is there a function to capitalize only the first letter of word or phrase ? Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

[R] gsub and regex to tidy comma-limited values

2009-03-14 Thread Daren Tan
I am cleaning up comma-limited values, so that only one comma separates each value. Using the example below, as much as I try with regex, I can't remove the last comma. I hope to have a one-liner solution, if possible. gsub("^,*|,*$|(,)*", "\\1", ",,,apple,,orange,lemon,strawberry") [1] "a

Re: [R] search for string insider a string

2009-03-13 Thread Tan, Richard
That works. I want the position just for the purpose of my later manual check. Thanks a lot Gabor. -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Friday, March 13, 2009 2:18 PM To: Tan, Richard Cc: r-help@r-project.org Subject: Re: [R] search for

[R] search for string insider a string

2009-03-13 Thread Tan, Richard
Hi, sorry if it is a too stupid question, but how do I a string search in R: I have a dataframe A with A$test like: test1 bcdtestblabla2.1bla cdtestblablabla3.88blabla and I want to search for string that start with 'dtest' and ends with number and return the location of that substring and th

[R] heatmap and colour key

2009-03-11 Thread Daren Tan
I would like to visualize my data via heatmap so that the value range c(-2,2) corresponds to greenred(75). However, heatmap uses the min and max from my dataset instead. How to solve this ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

[R] Review my upgrade plan from 2.8.0 to 2.8.1

2009-02-28 Thread Daren Tan
Hi, On my laptop, R is installed on windows XP SP2 at D:\Program Files\R\R-2.8.0, and all add-on packages are installed at D:\Program Files\R\R-2.8.0.libs. In addition, I have created two environment enviroment to ease upgrading and installation of packages. Packages installed is a mix of those fr

[R] Mutiple ColSideColors for heatmap.2

2009-02-27 Thread Daren Tan
I am in a situation needing 3 ColSideColors for heatmap.2. How can I do that? TIA Daren __ 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 pr

[R] reading text files compressed by gzip

2009-02-24 Thread Daren Tan
I have a number of text files that were archived by gzip. To save the trouble of uncompressing them, I used the following command. Then I checked the dimension of m, the number of rows is 14 which should be 1. How can I "force" the remaining rows to be read into m ? >m <- read.delim(gzfile("Sa

[R] Get top cluster for each item in a correlation matrix

2009-02-23 Thread Tan, Richard
Hi, I posted a question a few days ago and got extremely well response. https://stat.ethz.ch/pipermail/r-help/2009-February/188225.html. Now I have a somewhat related question: I have a correlation matrix of about 3000 items, with 1 on diagonal ( for example, cor.mat <- cor(matrix(rnorm(3000*1

[R] How to parse text file into a table?

2009-02-22 Thread Daren Tan
I am given a text file of records to be converted into a table format. I have searched related topics or packages, but can't find any similar cases. Please help. Sample record is given below. Take note the last element doesn't have a semi colon. ###-Start of record--

[R] How to reshape this data frame from long to wide ?

2009-02-21 Thread Daren Tan
I tried cast and melt in reshape package, but still can't convert this data frame m m [,1] [,2] [1,] "A" "1" [2,] "A" "2" [3,] "B" "3" to this form. m1 [,1] [,2] [1,] "A" "B" [2,] "1" "3" [3,] "2" NA Please help. [[alternative HTML version deleted]] _

[R] Convert a list to matrix

2009-02-21 Thread Daren Tan
I would like to convert a list to matrix. This can be easily achieved via do.call. The only problem is each element of the list has different length, which causes the recycling of values. How can I have NA instead of recycled values ? m <- list() m[["A"]] <- 1 m[["B"]] <- 2:3 do.call(rbind, m) [

Re: [R] transform key value pair to column

2009-02-19 Thread Tan, Richard
Thank you, works! -Original Message- From: Rowe, Brian Lee Yung (Portfolio Analytics) [mailto:b_r...@ml.com] Sent: Thursday, February 19, 2009 5:52 PM To: Wacek Kusnierczyk; Tan, Richard Cc: r-help@r-project.org Subject: RE: [R] transform key value pair to column Try this: > du

[R] transform key value pair to column

2009-02-19 Thread Tan, Richard
Hi, is there a good way (instead of a time-consuming for loop) to transfer a key/value pair dataframe to a dataframe with key as column and value as row? For example, I have a dataframe with three columns: id, code, value: id,code,value 1,hi,10.3 1,lo,5.2 2,hi,19.4 3,hi,20 3,lo,12 4,lo,5.8 I w

Re: [R] get top 50 correlated item from a correlation matrix for each item

2009-02-12 Thread Tan, Richard
Works like a charm, thank you! -Original Message- From: Dimitris Rizopoulos [mailto:d.rizopou...@erasmusmc.nl] Sent: Thursday, February 12, 2009 12:11 PM To: Tan, Richard Cc: r-help@r-project.org Subject: Re: [R] get top 50 correlated item from a correlation matrix for each item a

[R] get top 50 correlated item from a correlation matrix for each item

2009-02-12 Thread Tan, Richard
Hi, I have a correlation matrix of about 3000 items, i.e., a 3000*3000 matrix. For each of the 3000 items, I want to get the top 50 items that have the highest correlation with it (excluding itself) and generate a data frame with 3 columns like ("ID", "ID2", "cor"), where ID is those 3000 items

[R] Problem in clustering a large data

2009-02-04 Thread tan lin
Dear all, Can anyone help me? I'm having some programming command problems with R. I applied R in my task to cluster a group of 839 protein spot data. The data obtained from 6 different cell lines. Unfortunately, the dendogram doesn't clearly stated the clusters due to abundance of data

Re: [R] Large file size while persisting rpart model to disk

2009-02-03 Thread tan
a better/recommended way of reducing the size? Thanks, Tan On Feb 3, 4:56 pm, Prof Brian Ripley wrote: > On Tue, 3 Feb 2009, tan wrote: > > I am using rpart to build a model for later predictions. To save the > > prediction across restarts and share the data across nodes I have

[R] Large file size while persisting rpart model to disk

2009-02-03 Thread tan
.sav") What is the reason behind it? The functions themselves seem small, so where it all the bulk coming from? Thanks, Tan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://ww

[R] heatmap.2 and three colours for specific r anges‏

2009-01-06 Thread Daren Tan
Hi, I hope to show a heatmap with thre colours, no gradation. How to specify heatmap.2 to map "green" for values less than -1, "gray" for values between -1 and 1, and "red" for values greater than 1 ? Thanks [[alternative HTML version deleted]] __

[R] Generating GUI for r-scripts

2009-01-06 Thread Daren Tan
Hi, I have developed some scripts that basically ask for input tab-limited format files, do some processing, and output several pictures or csv. Now I need to have some gui to wrap on top of the scripts, so that end-users can select their input files, adjust some parameters for processing, a

[R] What packages have impute method ?

2008-12-12 Thread Daren Tan
Besides the impute package, are there others that have alternative impute approaches ? I hope to compare their performances. Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] setting the R_Libs gives warning message from Rgui.exe

2008-12-12 Thread Daren Tan
> CC: r-h...@stat.math.ethz.ch > Subject: Re: [R] setting the R_Libs gives warning message from Rgui.exe > > > > Daren Tan wrote: >> Hi, >> >> I keep getting the error message and a pop-up window for selecting CRAN >> mirror server from Rgui.exe after setting the

[R] setting the R_Libs gives warning message from Rgui.exe

2008-12-11 Thread Daren Tan
Hi, I keep getting the error message and a pop-up window for selecting CRAN mirror server from Rgui.exe after setting the R_Libs Warning in install.packages(necessary[!installed], dep = T) : argument 'lib' is missing: using 'D:/Program Files/R/R-2.8.0.libs' --- Please select a CRAN mirror

[R] errors with compilation

2008-12-09 Thread Jason Tan
* [R] Error 1 make[1]: Leaving directory `/lus/nid00036/jasont/R-2.8.0/src' make: *** [R] Error 1 Jason Tan Senior Computer Support Officer Western Australian Supercomputer Program (WASP) The University of Western Australia M024 35 Stirling Highway CRAWLEY WA 6009 Ph: +618 64888742 Fax: +618

  1   2   >