Displaying 20 results from an estimated 10000 matches similar to: "character occurence within a string"
2004 Nov 23
2
sorting without order
Hello,
In order to increase the performance of a script I'd like to sort very large vectors containing repeated integer values.
I'm not interesting in having the values sorted, but only grouped.
I also need the equivalent of index.return from the standard "sort" function:
f(c(10,1,10,100,1,10))
=>
grouped: c(10,10,10,1,1,100)
ix: c(1,3,6,2,5,4)
is there a way
2005 Jan 12
2
mydataframe$colname: using substring of colname may also match some column (PR#7496)
Full_Name: Marc Mamin
Version: 1.8, 2.0.0
OS: Windows & Linux
Submission from: (NULL) (217.17.202.254)
Using only the beginning of a column name will match it:
>aaa<-1
>df<-as.data.frame(aaa)
>names(df)
[1] "aaa"
>df$a
[1] 1 !!!!!!!!! (I expect df$a to be undefind)
>df$x
>NULL
Compare with:
> df["aaa"]
aaa
1 1
> df["a"]
2004 Oct 20
2
does R provides a wait or pause function?
Hello,
I'd like to insert a "wait" function in my code.
The reason is that I output timestamped files and I want to ensure that at least 1 second separes 2 files to avoid overwriting the previous file.
Thanks,
Marc Mamin
2004 Oct 27
1
regexp,grep: capturing more than one substring
Hello,
I would like to have a function that retrieve matching strings in the same way as with java.util.regex (java 1.4.2).
Example:
f('^.*(xx?)\\.([0-9]*)$','abcxx.785')
=>
c('xx','785')
First of all: Is it possible to achiev this with grep(... perl=TRUE,value=TRUE )?
As I would call this function very often with large data, I'm reluctant to use Sjava
2004 Sep 29
4
multiple match question
Hello,
I'm looking for a fast way to retrieve the position of elements from a vector which match element in another vector.
Example
va<-c('a','e')
vb<-c('a','b','c','d','e','f','e')
f(va,vb) should return c(1,5,7)
I have 2 different cases:
I) my vector vb contains only distinct values
II) my vector vb may
2006 May 19
5
Converting character strings to numeric
I assume that I have missed something fundamental and that it is there in front of me in "An Introduction to R", but I need someone to point me in the right direction.
> x1 <- "1159 1129 1124 -5 -0.44 -1.52"
> x2 <- c("1159","1129","1124","-5","-0.44","-1.52")
> x3 <- unlist(strsplit(x1,"
2003 Jul 09
2
RODBC and Oracle: error "table does not exist"
Dear r-helpers!
I have trouble reading data from an Oracle data base using
RODBC Version 1.0-3,
R Version 1.7.1,
Windows XP,
Oracle8 ODBC Driver Version 8.1.6.4.0:
> library(RODBC)
> channel <- odbcConnect(dsn="PAV32", case="oracle", believeNRows=FALSE)
> # ok, this was succesful
> x <- sqlTables(channel)
> x[37, ]
TABLE_CAT TABLE_SCHEM TABLE_NAME
2003 Sep 18
1
lattice, trellis.device, dev.off() within a condition (seems t o be a bug)
Hi,
I have a strange issue under W2K;
consider these two code extracts:
1)
if(condition a){
trellis.device(png,filename = filename_a,...
xyplot(...
dev.off()
}
2)
if(condition a){
trellis.device(png,filename = filename_a,...
xyplot(...
}
dev.off()
In 1), The png file is generated, but empty; in 2), where I've taken the
dev.off clause out of the condition block, my plot is
2003 Jul 28
3
http://www.omegahat.org/RSXML
Hi,
As the server www.omegahat.org seems to be down since quite a while,
could someone send me the RSXML library for Windows2000 ?
Many thanks,
Marc Mamin
2007 Oct 11
2
Identifying and characterizing strings of NA in a vector
Dear R users,
I was wondering if someone could suggest a few lines of code for my problem.
I want to count the number and the length of strings of NA in a vector.
For example:
vec <- c(1, 2, 1, NA, NA, 1, 2, NA, NA, NA, 3, 4, NA, NA)
has 2 strings of NA's of length 2 and 1 string of NA' of length 3.
I can easily count the number of NA's per vector, but I am having a hard
time
2004 Nov 04
5
Conversion of strings to expressions
Hello,
I'm not sure how to state my question in a technically accurate manner, so
I'll use a short example to clarify my problem:
Say I have a vector,
vec<-c(1,2,3,2)
I would like to be able to "reference" the vector by using the string
containing the name of the vector - that is, I would like to know of some
function which is able to convert the string "vec"
2003 Sep 09
2
lattice.xyplot: adding grid lines
Hallo,
I'd like to add grid lines to a lattice graph having 2 series of Y data.
See these 2 examples:
data(iris)
[1]
xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
data = iris, allow.multiple = TRUE, scales = "same",type="l",
)
[2]
xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
data = iris, allow.multiple = TRUE, scales =
2009 Aug 29
2
RFE: vectorize URLdecode
In R 2.9.2,
> URLdecode(c("a%20b", "b%20c"))
[1] "a b"
Warning message:
In charToRaw(URL) : argument should be a character vector of length 1
all but the first element will be ignored
Could URLdecode be modified to actually process all elements of the vector, not
just the first?
Thanks in advance
2008 Dec 02
1
merge character strings
Hi,
how can I do the following in R?:
vec <- c("a", "b", "c")
....magic.....
print(str)
"abc"
or even better:
"(a,b,c)"?
Cheers
--
View this message in context: http://www.nabble.com/merge-character-strings-tp20790116p20790116.html
Sent from the R help mailing list archive at Nabble.com.
2008 May 21
1
split character string in matrix into character vector and numeric vector
Hello,
I've got a matrix consisting of one column with n rows. Each field in
the matrix is filled with a character vector.
I would like to convert this matrix into a character vector containing
the B03_MAH-type entries from the beginning of each row and a data.frame
that contains the numeric data, but I am stuck.
I have tried to use textConnection with sep = " " but since
2006 Nov 01
4
splitting very long character string
Hello,
I've a very long character array (>500k characters) that need to split by '\n' resulting in an array of about 60k numbers. The help on strsplit says to use perl=TRUE to get better formance, but still it takes several minutes to split this string.
The massive string is the return value of a call to xmlElementsByTagName from the XML library and looks like this:
...
12345
2003 Jul 18
0
line colors in lattice.xyplot with png device
On Friday 18 July 2003 12:28, r-help-request at stat.math.ethz.ch wrote:
> Message: 9
> Date: Thu, 17 Jul 2003 13:50:29 +0200
> From: Marc Mamin <M.Mamin at intershop.de>
> Subject: [R] line colors in lattice.xyplot with png device.
> To: r-help at stat.math.ethz.ch
>
> Hi,
>
> R is very new for me, so excuse if my questions are too basic...
>
> ????????BTW,
2008 May 09
2
which.max2()
Hello,
which.max() only returns one index value, the one for the
maximum value. If I want the two index values for the two
largest values, is this a decent solution, or is there a
nicer/better R'ish way?
max2 <-function(v)
{
m=which.max(v)
v[m] = -v[m]
m2=which.max(v)
result=c(m, m2)
result
}
Seems to work ok.
Thanks,
Esmail
2004 Sep 16
3
Estimating parameters for a bimodal distribution
For several years, I have been using Splus to analyze an ongoing series of
datasets that have a bimodal distribution. I have used the following
functions, in particular the ms() function, to estimate the parameters: two
means, two standard deviations, and one proportion. Here is the code I've
been using in S:
btmp.bi <- function(vec, p, m1, m2, sd1, sd2)
{
2008 Mar 02
3
elegant way to minus on each row of a matrix
How to do this in an elegant way formatrix/data frame/zoo?
mat=
1 2 3
4 5 6
7 8 9
vector=
1
2
3
result=
0 1 2
2 3 4
4 5 6
ie
1-1 2-1 3-1
4-2 5-2 6-2
7-3 8-3 9-3
Thanks in advance.
_________________________________________________________________
08
[[alternative HTML version deleted]]