Displaying 20 results from an estimated 1000 matches similar to: "expression, strsplit, ..."
2007 Dec 28
1
unit attribute to list elements
Hi,
I've started my own (first) package, part of which consists in
listing common physical constants (Planck's constant, the speed of
light in vacuum, etc). I'm wondering what would be a good way of
dealing with pairs of value/unit.
> constants <- list( cel = 2.99792458e8 , #m/s
> Z0 = 376.730313461, #ohm
> eps0 = 8.854187817e-12,#F/m
> mu0 = 4*pi*1e-7,#N/A^2
2009 Apr 12
1
looking for one-liner for strsplit and regex
Hi,
I have a line such as:
myline <- " 0.100000 1.5000 0.6000 538
0.369404"
and I would like to put the numbers into a vector. Some combination of
tabs and spaces occur between the numbers.
I tried:
try1 <- strsplit(myline,"[[:blank:]]+")
> try1
[[1]]
[1] "" "0.100000" "1.5000"
1999 Apr 06
1
seg fault with strsplit (PR#158)
Try the following with R 63.3:
test <- function(z){
ch1 <- deparse(z,width=500)
ch <- NULL
for(i in 1:length(ch1))ch <- paste(ch,ch1[i],collapse=" ")
a <- gsub("(\\[(0|1|2|3|4|5|6|7|8|9|:|,)+\\])|([][+*/^():!<>%&|~,{}\"\\\=-])|( [0-9]+)|(^[0-9]+)"," ",ch)
print("here")
strsplit(a," ")
}
test(glm)
Jim
1999 Dec 18
1
strsplit does not conform to documentation (PR#379)
Description:
Split the Strings in `x' into substrings according to
the presence of substring `split' within them.
--------------------
> strsplit("acbdefgSPLIThigkilmnSpPqrst","SPLIT")
[[1]]
[1] "acbdefg" "higkilmn" "p" "qrst"
--------------------
Apparently, it will
Split the Strings in `x' into
2000 Feb 08
1
strsplit (PR#424)
In R.99, when you strsplit with a space (split=" ") as separator and
the string contains two consecutive spaces, "" is returned.
strsplit(" "," ")
returns
[[1]]
[1] "" ""
whereas it used to return character(0)
Is this really useful like this?? It certainly messes all my code up. Jim
2006 Apr 17
1
strsplit does not return correct value when spliting "" (PR#8777)
Full_Name: Charles Dupont
Version: 2.2.0
OS: linux
Submission from: (NULL) (160.129.129.136)
when
strsplit("", " ")
returns character(0)
where as
strsplit("a", " ")
returns "a".
these return values are not constiant with each other.
Charles Dupont
2006 Apr 17
0
(PR#8777) strsplit does [not] return correct value when spliting ""
Prof Brian Ripley wrote:
> On Mon, 17 Apr 2006, Charles Dupont wrote:
[...]
> > The man page states in the value section that strsplit returns:
> > A list of length 'length(x)' the 'i'-th element of which contains
> > the vector of splits of 'x[i]'.
> >
> > It mentions no change in behavior if the value of x[i] = "".
>
2011 Oct 24
1
strsplit convert data
I am using the following code but I do not know the debug and run for
correct errors
library (tcltk)
file <-tclvalue (tkgetOpenFile ())
if (nchar (file))
{
tkmessageBox ("Select the file")
}
else
{
tkmessageBox (message = paste ("Was select file", file))
Dataset <- read.table (file, header = FALSE, sep = "", na.strings =
2017 Jan 06
0
strsplit(perl=TRUE), gregexpr(perl=TRUE) very slow for long strings
While doing some speed testing I noticed that in R-3.2.3 the perl=TRUE
variants of strsplit() and gregexpr() took time proportional to the
square of the number of pattern matches in their input strings. E.g.,
the attached test function times gsub, strsplit, and gregexpr, with
perl TRUE (PCRE) and FALSE (TRE), when the input string contains 'n'
matches to the given pattern. Notice the
2019 Dec 18
0
A weird behaviour of strsplit?
On 18/12/2019 9:42 a.m., IAGO GIN? V?ZQUEZ wrote:
> Hi all,
>
> In the help of strsplit one can read
>
> split character vector (or object which can be coerced to such) containing regular expression<http://127.0.0.1:39783/help/library/base/help/regular%20expression>(s) (unless fixed = TRUE) to use for splitting. If empty matches occur, in particular if split has length 0,
2003 Nov 07
2
opposite function of strsplit() ?
Hi,
I what to solve this problem:
>alfab <- "ABCEDFG" #[1] "ABCEDFG"
>chara <- strsplit(alfab, "") #[1] "A" "B" "C" "E" "D"
>"F" "G"
Then I do some changes before I want the character together again, say,
remove two letters.
Now,
2005 Nov 15
1
strsplit
I'm stuck on what I feel should be a minor problem.
I have a dataseries obtained from a MS Access database that consists of
a series of numbers seperated by carridge returns (\r)
Currently this data is in R as mode numeric???
I want to separate this into a vector of the componant numbers.
Perhaps a little code will help describe what I've got here!!
library(rodbc)
s_sql<-'SELECT
2005 Dec 22
1
strsplit with dataframes
Hello fellow R people,
I can not figure out a pretty way to use strplit with vectors
Imagine that I got the following data from someone with ID's
representing several factors
ID data
A1-B1-t1 0
A1-B1-t2 1
A1-B2-t1 5
A1-B2-t2 10
A1-B10-t1 0
A1-B10-t2 1
A1-B20-t1 5
A1-B20-t2 10
...
I would like to turn this dataframe to
station substation time data
A1 B1 t1 0
A1 B1 t2 1
A1 B2 t1 5
2007 Sep 09
2
Problems with strsplit
Hello,
I would like to know what can I do if I use strplit with a string and I want to use the middle left,I mean I have this:
strsplit("bA531F16-rep","\\-")
[[1]]
[1] "bA531F16" "rep"
I would like to work just with bA531F16 in another variable, what could I do?, Thank you
---------------------------------
Sé un Mejor Amante
2008 Jun 14
2
strsplit, keeping delimiters
Hi all,
Does anyone have a version of strsplit that keeps the string that is
split by. e.g. from
x <- "A: 123 B: 456 C: 678"
I'd like to get
c("A:", "123 ", "B: ", "456 ", "C: ", 678)
but
strsplit(x, "[A-Z]+:")
gives me
c("", " 123 ", " 456 ", " 678")
Any ideas?
Thanks,
2008 Aug 30
1
strsplit and regexp
Dear list,
I am trying to split a string using regexp:
x <- "2 Value 34 a-c 45 t"
strsplit(x, "[0-9]")
[[1]]
[1] "" " Value " "" " a-c " "" " t"
But I don't want to lose the digits (pattern), the result
should be:
[[1]]
[1] "2" " Value " "34" " a-c "
2009 Jun 11
2
need help with strsplit function
Hi, if I have this string: "a.b.c.d" and I use this function:
unlist(strsplit("a.b.c.d", "\\.")), I get this as my output: "a", "b", "c",
and "d". Is there a way to just split on the first period so I obtain only
two pieces like: "a" and "b.c.d"? Anyways, thanks in advance!
--
View this message in context:
2009 Aug 16
1
What is the returned type of strsplit?
Hi,
I run the following program. I thought that 'b' was a matrix. But it
is actually not, right? Can somebody elaborate more on the type
difference between 'b' and 'c' to help me understand it better?
Why 'c' is what it is now? Why 'c' is not the transpose of what it is now?
Regards,
Peng
$ Rscript split.R
>
2009 Oct 29
1
strsplit() and Windows file paths
There are two ways to express file paths with the Windows environment:
> a=file.choose()
> a
[1] "C:\\Documents and Settings\\rbaer\\Desktop\\_VNT_Test\\coordFocused 20k F5 0ng Ki8751 t20.txt"
and
>b= paste(getwd(),"/",dir()[1],sep="")
>b
[1] "C:/Documents and Settings/rbaer/Desktop/_VNT_Test/coordFocused 20k F5 0ng Ki8751 t20.txt"
I have 2
2010 Sep 10
1
faster unlist,strsplit,gsub,for
Hi,
I perform the operations unlist,strsplit,gsub and the for loop on a lot of
strings and its heavily slowing down the overall system. Is there some way
for me to speeden up these operations..maybe like alternate versions that
exist which use multiprocessors etc.
--
Rajesh.J
[[alternative HTML version deleted]]