search for: charmatch

Displaying 20 results from an estimated 45 matches for "charmatch".

2010 Jan 25
3
Matching a character in a string
Hello. Sorry for this very basic question but I didn't find (of didn't understand) the answer either in the help or in the online guide. I have a string, let's say "hello". I want to know if there is some character in it, let's say an 'o'. I tried > charmatch("o", strstplit("hello","")) but it gives NA (why??) Thinking it may be a type problem, I tried > charmatch("o",as.character(strsplit("hello",""))) but it gives NA too (why???) So how can I know if a given string contains a given ch...
2001 May 08
1
ASCII map?
Is there a way to convert between and integer and a character and vice versa? For instance i <- 65; ch <- intToChar(i); # "A" i <- charToInt(ch); # 65 or even better i <- c(65, 66); ch <- intToChar(i); # c("A", "B") i <- charToInt(ch); # c(65, 66) I have tried to do a ASCII map myself, and I figured out that the ASCII
2003 Aug 26
3
matching-case sensitivity
Hi All, I am trying to match two character arrays (email lists) using either pmatch(), match() or charmatch() functions. However the function is "missing" some matches due to differences in the cases of some letters between the two arrays. Is there any way to disable case sensitivity or is there an entirely better way to match two character arrays that have identical entries but written in diff...
2002 Oct 22
3
Loading packages at startup
...uot;) pad <- function(x,n) c( rep(NA,n-length(x)), x ) current.search <- search()[-1] saved.search <- .save.session.search[-1] identical <- pad(current.search, length(saved.search)) == saved.search for( i in saved.search[!identical] ) { if( charmatch( "file:", i, nomatch=FALSE) ) attach(sub( "file:", "", "file:test" ) ) else if (charmatch( "package:", i, nomatch=FALSE) ) stop(paste("Somehow we missed loading package",i)) else {...
2011 Jun 30
1
Match strings across two differently sized dataframes and copy corresponding row to dataframe
...nt to look up the string in the smaller dataframe, and then use that row number to copy across the code for the string into the larger dataframe. Here's my idea so far: # comments is the smaller dataframe with the codes, mydata is the larger dataframe to which I would like to copy it. commvec=charmatch(comments$ImproveOne, mydata$Improve) # this is the match between the strings one way datavec=charmatch(mydata$Improve, comments$ImproveOne) # this is the match the other way mydata$ImproveCat1=NA # produce a variable to hold the copied codes mydata$ImproveCat1[datavec[!is.na(datavec)]]= comments...
2004 Jul 08
7
Problem with the grep function
Let me present to you my problem : I have a character vector x and I would like to obtain the indices of the elements of this vector that yielded exactly a match. For example, x=nom, pattern="b", I would to obtain 2 because "b" is on the second position. First program : nom <- c("a","b","ab") grep("b",nom) 2 3 Then I try the
2004 Nov 24
2
an R function to search on Prof. Baron's site
...=htdigrun1", sep="") ## replace spaces with "%20" in the query string <- paste("words=", gsub(" ", "%20", string), sep="") mpp <- paste("matchesperpage=", matchesPerPage, sep="") format <- charmatch(format, c("long", "short")) if (format == 0) stop("format must be either long or short") format <- paste("format=builtin-", switch(format, "long", "short"), sep="") sortby <- charmatch(sortby, c("score&quo...
2006 Mar 07
3
Expanding partial names
...er(longname = 3) longname = 3 But it fails if I try to use partial argument matching: > wrapper(long=4) Error in lowlevel(longname = 2, long = 4) : unused argument(s) (long ...) because long isn't matched to longname. Is there a reasonable way to do this (e.g. using pmatch or charmatch) other than listing all the low level arguments in the argument list to wrapper? Duncan Murdoch
2004 Dec 23
1
searching Jonathan Baron's R Site
...ot;score", matchesPerPage=10) { string <- paste("http://finzi.psych.upenn.edu/cgi-bin/namazu.cgi?query=", gsub(" ", "+", string), sep="") mpp <- paste("max=", matchesPerPage, sep="") format <- charmatch(format, c("normal", "short")) if (format == 0) stop("format must be either normal or short") format <- paste("result=", switch(format, "normal", "short"), sep="") sortby <- charmatch(sortby, c("score"...
2002 Apr 18
5
Two problems
Hello! Two questions: 1: I have to import a matrix of adjacency from a file of a software that is not R (for example "bloc notes" of Windows). The problem is that the matrix is not in the explicit form as 0 1 1 1 0 0 1 0 0 but it is a scattered matrix where in each row there are two nodes that have a direct path. The matrix is a b a c b a c a For example, the first row
2007 Jul 09
2
parsing strings
...2, desired parsing result: AB10 and CD12 A10CD2EF3, desired parsing result: A10, CD2, and EF3 I assume that it is possible to search a string for letters and digits and then break the string where letters are followed by digits, however I am a bit clueless about how I could use, e.g., the 'charmatch' or 'parse' commands to achieve this. Thanks a lot in advance for your help. Best, Michael Michael Drescher Ontario Forest Research Institute Ontario Ministry of Natural Resources 1235 Queen St East Sault Ste Marie, ON, P6A 2E3 Tel: (705) 946-7406 Fax: (705) 946-...
2008 Jun 27
1
Similarity matching with probabilities
Hello, It's just a strange coincidence that someone posted just very recently a question about matching. I know there are several match function in the base package (such as match, pmatch, charmatch, and the gsub etc) but I can't seem to use them wisely to be able to get what I need. suppose I have the following strings: "tets" "estt" "rtes7" "gstes" "tes5t" Is there an R procedure to determine how related each string is to the reference...
2005 Jan 14
1
how to produce 2-d color plots in R
Hello 'R' Users, I am very new on 'R', so excuse me if I ask something wrong. I have ASCII data and the colums of the data are looks like :- !------------------------- time,yr,mo,dy,hr,min,sec,lat,lon,ht,co2obs,sigma,co2model -- - -- !---------------------------- Each column has data value. Now I want to produce 2-d color maps, for example the plot should look like :- on
2006 Sep 06
1
How to get multiple partial matches?
...le to select out all rows with, for example, "5S_F_" in the Probe column (there are non-"5S_F_" containing values in the real, larger data set). I think pmatch does this for instances where there is only 1 match, but I would like to recover all the matches. I have tried to use charmatch, match, pmatch, agrep and grep for this purpose, but with no luck. When I grep for "5S_F_" with value = T, I get "character(0)" Adding wildcards (either "*" or ".") does not change this outcome. I thought maybe the underscores were messing it up, so I tried...
2004 Feb 27
2
Is there a way to deactivate partial matching in R?
Dear R-experts, I just tracked down a nasty bug in a dynamically parametrized function to wrong argument matching. As we get more and more complex applications build on top of R (like bioconductor) partial matching gets more and more dangerous. I would like to deactivate partial matching in R (partial argument matching as well as partial matching of list elements), e.g. using an environment
2004 Feb 27
2
Is there a way to deactivate partial matching in R?
Dear R-experts, I just tracked down a nasty bug in a dynamically parametrized function to wrong argument matching. As we get more and more complex applications build on top of R (like bioconductor) partial matching gets more and more dangerous. I would like to deactivate partial matching in R (partial argument matching as well as partial matching of list elements), e.g. using an environment
2011 Oct 18
1
Function to "lump" factors together?
...one of 6 values to "factor" depending on the value of "branch" -- using "UNK" as a default if nothing else matched. Mind, the patterns there are "Shell Patterns" ("globs"), not regular expressions. I've looked at R functions match(), pmatch(), charmatch(), and switch(); while each looks as it it might be coercable to get the result I want, it also looks to require iteration over the thousands of entries I have -- as well as using the functions in question in a fairly "unnatural" way. I could also write my own function that iterates over...
2007 Feb 01
3
Can this loop be delooped?
...p out of numgroups groups of equal size, totalength%/%numgroups # there are totalength%%numgroups number of groups of length 1+totalength%/%numgroups, with the large groups all to one side, left if place=LEFT # totalength >= numgroups >= groupnum all integers, or it won't work right if(charmatch(toupper(place),"RIGHT",nomatch=FALSE)==1){ extra1_1=max((groupnum-1)+((totalength%%numgroups)-numgroups),0) extra1_2=(groupnum>numgroups-totalength%%numgroups) } else{ extra1_1=min(totalength%%numgroups,groupnum-1) extra1_2=(groupnum<=totalength%%numgroups) } gsize=total...
2000 Sep 29
0
Is it R or I?
...ate the main data object cat("Reading in data", "\n") xd <- read.table(dataset, header=T,as.is=T) xd <- read.table(dataset,header=T, as.is=T, row.names=as.character(1:nrow(xd))) cat("DONE Reading in data", "\n") attach(xd) xd <- xd[, -c(charmatch(paste(resp), names(xd)))] assign(resp, get(resp)) ndf <- as.data.frame(get(resp)) names(ndf) <- "addcolx" xd <- data.frame(xd, ndf) names(xd)[charmatch("addcolx", names(xd))] <- resp cat("Lm Model", "\n") lmexp <-...
2012 Feb 26
1
Matrix problem to extract animal associations
...ID9_ID10_" "ID10_ID10_" > > (AMatrix <- as.character(unique(AssocMatrix[which(DMTF==TRUE)]))) [1] "ID2_ID6" "ID6_ID2" "ID6_ID10" "ID10_ID6" > > ##Extract those individuals not in any interactions > nonassoc <- IDs[is.na(charmatch(inassoc,AMatrix))] > > (NGroups <- data.frame(ID=nonassoc,Group=1:length(nonassoc))) ID Group 1 ID1 1 2 ID3 2 3 ID4 3 4 ID5 4 5 ID7 5 6 ID8 6 7 ID9 7 > [[alternative HTML version deleted]]