[R] patterns in numeric vector

2016-06-20 Thread C Lin
Hello, Can someone help me with this? I am trying to find the start and end positions in a vector where numbers less than x is surrounded by number(s) greater than x. For example: try = c(7,223,42,55,30,25,61,5,70) x=40 The desired output would be: > loc     start end 1 5  6 2    

[R] merging tables based on both row and column names

2015-09-28 Thread C Lin
Dear R users, I am trying to merge tables based on both their row names and column names. My ultimate goal is to build a distribution table of values for each combination of row and column names. I have more test tables, more x's and y's than in the toy example below. Thanks in advance for your

Re: [R] How can I overwrite a method in R?

2014-10-09 Thread C Lin
I posted similar question a while ago. Search for "modify function in a package". In your case, the following should work. source('plot.histogram.R') assignInNamespace('plot.histogram',plot.histogram,ns='graphics') environment(plot.histogram) <- asNamespace('graphics'); Assuming you have your ow

Re: [R] modify function in a package

2014-09-30 Thread C Lin
mcast.net > Date: Thu, 25 Sep 2014 17:14:30 -0700 > CC: r-help@r-project.org > To: bac...@hotmail.com > > > On Sep 25, 2014, at 11:21 AM, C Lin wrote: > >> Dear R users, >> There is a package called NanoStringNorm with a function called >> NanoStringNorm. >&g

[R] modify function in a package

2014-09-25 Thread C Lin
Dear R users,  There is a package called NanoStringNorm with a function called NanoStringNorm. What I want to do is to change the NanoStringNorm function from the package with my own copy that is written in my.nanostringnorm.R.  But if I do the following:  source('my.nanostringnorm.R") unlockBind

Re: [R] regular expression help

2014-06-30 Thread C Lin
itespace characters. The pattern '[a-c[:space:]z[:digit:]]' matches > 'a', 'b', 'c', any decimal digit, and any whitespace character. > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Fri, Jun 27, 2014 at 6:27 AM, C Lin wrote:

Re: [R] regular expression help

2014-06-27 Thread C Lin
> > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > > On Thu, Jun 26, 2014 at 10:12 PM, David Winsemius > wrote: >> >> On Jun 26, 2014, at 6:11 PM, C Lin wrote: >> >>> Hi Duncan, >>> >>> Thanks for trying to help. Sorry for

Re: [R] regular expression help

2014-06-26 Thread C Lin
partment of Agronomy and Soil Science > University of New England > Armidale NSW 2351 > Email: home: mac...@northnet.com.au > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of C Lin > Sent: Friday, 27 June 2014 10:

[R] regular expression help

2014-06-26 Thread C Lin
Dear R users, I need to match a string. It can be followed or preceded by whitespace or // or nothing. How do I code it in R? For example: test <- c('AARSD11','AARSD1-','AARSD1//','AARSD1 //','//AARSD1'); grep('AARSD1(\\s*//*)',test); should return 3,4,5 and 6. Thanks in advance for your help.

Re: [R] converting a list with named member to a vector maintaining original names

2014-06-24 Thread C Lin
iginal names > To: bac...@hotmail.com > CC: r-help@r-project.org > > How about > > x <- unlist(test) > (names(x) <- rep(names(test), times = sapply(test, length))) > > ? > > See also unlist2 from > http://www.bioconductor.org/packages/release/bioc/html/AnnotationDbi.h

[R] converting a list with named member to a vector maintaining original names

2014-06-24 Thread C Lin
Dear R users, I have a list that I'd like to convert to a vector while preserving the original names. For example: test <- list(ABCC2=37280,ABCC5=c(12268,13308)); If I do unlist, it automatically renamed the ABCC5 to ABCC51 and ABCC52 > unlist(test)  ABCC2 ABCC51 ABCC52   37280  12268  13308 

Re: [R] creating list of variables description

2013-12-19 Thread C Lin
Sorry the link should be this one:http://www.thearda.com/pals/researchers/VARIABLE_DESCRIPT_LIST%20-%20public.pdf > From: bac...@hotmail.com > To: r-help@r-project.org > Date: Thu, 19 Dec 2013 13:20:54 -0500 > Subject: [R] creating list of variables description > > Dear R-users, > > Can someone

[R] creating list of variables description

2013-12-19 Thread C Lin
Dear R-users, Can someone suggest a good way to keep a list of variables description in R? Something to provide more detailed information on the variables that I have. Kind of like this list: http://www.thearda.com/pals/researchers/VARIABLE_DESCRIPT_LIST%20-%20public.pdfI'd like to be able to o

[R] using cvlm to do cross-validation

2013-03-28 Thread C Lin
Hello, I did a cross-validation using cvlm from DAAG package but wasn't sure how to assess the result. Does this result means my model is a good model? I understand that the overall ms is the mean of sum of squares. But is 0.0987 a good number? The response (i.e. gailRel5yr) has min,1st Quantile

Re: [R] error installing RcppClassic

2013-03-26 Thread C Lin
; Subject: Re: [R] error installing RcppClassic > From: dwinsem...@comcast.net > Date: Mon, 25 Mar 2013 11:36:28 -0700 > CC: r-help@r-project.org > To: bac...@hotmail.com > > > On Mar 25, 2013, at 9:09 AM, C Lin wrote: > > > > > Anyone knows what does this error

[R] error installing RcppClassic

2013-03-25 Thread C Lin
Anyone knows what does this error means? > library(RcppClassic) Error in gzfile(file, "rb") : cannot open the connection I thought I installed the package successfully: > install.packages('RcppClassic') Installing package(s) into ‘C:/Program Files/R/library’ (as ‘lib’ is unspecified) also in

[R] CVlim

2013-02-15 Thread C Lin
Can anyone help explain to me why the two codes below have different result? I thought I can use log(time)~. to replace log(time)~dist+climb+timef.I am using CVlm from DAAG package. I think nihills is preloaded with the package. Thanks in advance. > CVlm(df=nihills, form.lm=formula(log(time)~.)

Re: [R] ignore error getting next result

2012-03-27 Thread C Lin
NULL); } I cannot get the p-value of the test for i=2. any other input? anyone? Thanks, Lin CC: r-help@r-project.org From: dwinsem...@comcast.net To: bac...@hotmail.com Subject: Re: [R] ignore error getting next result Date: Tue, 27 Mar 2012 14:26:40 -0400 On Mar 27, 2012, at 2:18 PM,

Re: [R] ignore error getting next result

2012-03-27 Thread C Lin
ignore error getting next result > Date: Tue, 27 Mar 2012 13:40:39 -0400 > > > On Mar 27, 2012, at 12:56 PM, C Lin wrote: > > > > > Dear All, > > > > How do I ignore an error and still getting result of next iteration. > > I am trying to do wilcox.test on

[R] ignore error getting next result

2012-03-27 Thread C Lin
Dear All, How do I ignore an error and still getting result of next iteration. I am trying to do wilcox.test on a loop, when the test fail, I would like to continue doing the next iteration and getting the p-value. I tried to do tryCatch or try but I cannot retrieve the p-value if the test is

[R] help with apply function for 3D array

2012-02-24 Thread C Lin
Dear R users, I am trying to use apply function on a 3D array (get rid of any loop) but wasn't successfull. Below is a toy example of what I am trying to do: refID_remNoCat = 1:30; s_remNoCat = sample(1:length(refID_remNoCat),size=length(refID_remNoCat)); s.sort_remNoCat = sort(s_remNoCat,ind

Re: [R] sequential sum

2012-02-14 Thread C Lin
Dan, Thank you very much. That is exactly what I need. What a clever solution. David, thanks for trying. Thank you all. I would never be able to figure it out on my own. Lin > From: dwinsem...@comcast.net > To: nord...@dshs.wa.gov > Date: Tue, 14 Feb 2012 14:28:21 -0500 > CC: r-help@r