Displaying 20 results from an estimated 10000 matches similar to: "Parsing variable-length delimited strings into a matrix"
2007 May 03
2
Parsing data with an uneven number of delimiters
I have a list of data that is delimited by a / and, as long as there is an equal number of delimiters, I can parse the data and put it into a data frame:
> t1<-c("a/a/a","b/bb/bbb","ccc/cc/c")
> t2<-strsplit(t1,"/")
> t3<-data.frame(t2)
> t3
c..a....a....a.. c..b....bb....bbb.. c..ccc....cc....c..
1 a
2008 Mar 13
3
Splitting a set of vectors in a list
I have a set of character vectors of uneven length
that I have stored in a list. I can easily enough get
any column of them using lapply but what I want is to
be able to create a matrix of them. Other than some
kind of brute force looping approach I have drawn a
blank.
Would somebody please suggest something? Thanks
Example.
mylist <- list(aa=c("cat","peach" ),
2012 May 02
5
uneven vector length issue with read.zoo?
I truncated and simplified my code and the read in data that I'm working with
to isolate the issue. Here is the read in data and R script respectively:
http://r.789695.n4.nabble.com/file/n4604287/test.csv test.csv
http://pastebin.com/rCdaDqPm
Here is the terminal/R shell output that I hope the above replicates on your
screen:
> source("elecLoad.r", echo = TRUE)
> #Load
2007 Jun 18
3
String manipulation, insert delim
Hello All,
I've been using R for two years now and I am happy to say this is the
first time I could not find the answer to my problem in the R-help
archives. Here is the pending problem:
I want to be able to insert delimiters, say commas, into a string of
characters at uneven intervals such that:
foo<-c("haveaniceday")#my string of character
bar<-c(4,1,4,3) # my vector of
2011 May 26
4
Applying "toupper" to only portions of text strings
Colleagues
Assume that I have a vector containing some text strings, some of which contain a particular character. I could like to apply "toupper" to the text before the character. For example (in this case, "|" is the particular character):
ORIGINAL:
TEXT <- c("aaaa", "bbb|cc", "|ddd")
AFTER APPLICATION OF toupper:
TEXT <-
2010 Jul 07
1
Batch files process and String parsing
Here are what i am going to accomplish:
I have 400 files named as xxx.txt. the content of the file looks like the
following:
name count
1. aaa 100
2. bbb 2000
3. ccc 300
4. ddd 3000
........
more that 1000 rows in each files.
these are the areas i need help:
1. how can i only read in the files with the string patterns ggg or fff as
part of the file names?
for instance, I
2007 Dec 13
6
spliting strings ...
Hi everyone,
I have a vector of strings, each string made up by different number of words. I want to get a new vector which has only the first word of each string in the first vector. I came up with this:
str <- c('aaa bbb', 'cc', 'd eee aa', 'mmm o n')
str1 <- rep(1, length(str))
for (i in 1:length(str)) {
str1[i] <- strsplit(str, "
2012 Aug 08
1
time series, uneven length
I have 4 univariate time series that I believe have correlation between them,
I want to create a VAR model between them all.
However I have an issue as 3 of them are the same length, however the 4th is
smaller. meaning that i cannot use the 4th variable , is there anyway R can
get round this issue?
> length(tstemp)
[1] 746
> length(tspres)
[1] 746
> length(tswind)
[1] 746
>
2009 Nov 21
1
R strings, null-terminated or size delimited?
Hello.
I've been looking at vecsexps for my binding.
Concerning strings, I'm wondering: are they supposed to be
null-delimited? Are they delimited by the info in the SEXPHEADER macro
in Rinternals.h?
Basically, what are the macros or functions to access the values of the
vecsexps? I'm thinking of CHARSXPs and INTSXPs for the moment...
All the best,
--
Guillaume Yziquel
2010 Nov 24
2
Create new string of same length as entry in dataframe
I suspect that this is simple, but thanks in advance for any advice...
I have a dataframe, t2:
V1 V2
aaa 3
aaaa 4
aaaaaa 6
a 1
aa 2
V2 is the length of the string in V1 using nchar(as.character(t1$V1))
I'd like to create a third column, that contains a string of the length of
V2, but containing an alternate text, e.g.
V1 V2 V3
2005 Jul 22
3
Question regarding subsetting
I run R 2.1.1 in a Linux environment (RedHat 9) although my question
is not platform-specific.
Consider the following:
> A <- c("Prefix-aaa", "Prefix-bbb", "Prefix-ccc")
> B <- strsplit(A, "-")
> B
[[1]]
[1] "Prefix" "aaa"
[[2]]
[1] "Prefix" "bbb"
[[3]]
[1] "Prefix" "ccc"
How
2008 Mar 31
2
convert delimited string to vector
Hi R Users,
Simple question: How might I convert the text "a, b, c" (or for that matter "a
b c" with any delimiter - space, comma, etc.) into a 3-element character
vector?
[1] a b c
Thanks,
Brad
2011 May 05
6
Averaging uneven measurements by time with uneven numbers of measurements
I have a new device that takes measurements anywhere from every second, to
every 15 minutes (depending on changes). The matrix has a date, time and Y
column (Y is the measurement). For three days it is 25,000 rows. How do I
average the measurements by every 30 minutes so my matrix is 48 rows per
day? I have been working on this and cannot figure out a simple method. Any
ideas? Thank you.
-----
In
2004 Jan 09
1
degree-min-sec data
Hello -
Have both astronomic and geodetic data sets with values in the form
"ddd:mm:ss.sssss", where dd is an integer between -180 and 180, mm is an
integer between 0 and 60, and ss is a floating-point
number between 0 and 60.0. In order to do anything useful with these
values they need to be turned into their "decimal degree" equivalent.
Assuming the data is a vector y, the
2011 Mar 16
4
fetch uneven
Hi
I have a vector m:
m
[1] "ABC transporters"
[2] "2"
[3] "Acetyl-CoA"
[4] "1"
[5] "Energie"
[6] "1"
[7] "FAD Biosynthese"
2006 Jun 18
1
about the analysis of strings, thanks
Dear R-helpers:
thank your for your attention.
i am a newer to R and i am doing some protein category classification based on
the amino acid sequence.while i have some question urgent.
1. any packages for analysis amino acid sequence
2. given two sequences "AAA" and "BBB",how can i combine them into "AAABBB"
3. based on "AAABBB",how can i get some
2010 Jul 07
3
how to process this in R
Here are what i am going to accomplish:
I have 400 files named as xxx.txt. the content of the file looks like the
following:
name count
1. aaa 100
2. bbb 2000
3. ccc 300
4. ddd 3000
........
more that 1000 rows in each files.
these are the areas i need help:
1. how can i only read in the files with the string patterns ggg or fff as
part of the file names?
for
2016 Nov 24
3
shared/public mailbox application
I'm new to Dovecot and I need help configuring a shared or public mailbox -
I'm not sure which is appropriate. I've read the wiki and Peer's book and
neither appears to cover what I'd like to do. So I could use some specific
help on how to configure a solution for the following:
I'd like to create two real mailboxes, let's call them AAA and BBB. Let's
call
2016 Nov 28
2
shared/public mailbox application
Hi Michael,
we migrated from Cyrus Shared Folders to Dovecot Public Folder.
Our setup with Dovecot:
- Public Namespace type=public
- prefix=NAMESPACE
- location=maildir:/var/vmail/public/domain.com/folder:INDEXPVT=~/public/domain.com/NAME
- list=children to show NAMESPACE only if acl is given
- Restart Dovecot
- cd /var/vmail/public/domain.com/NAMESPACE
- mkdir .NAME
- We utilise one user
2012 Dec 17
11
[Puppet Upgrade] Puppet agent does not work
I upgraded Puppet master from 2.7.6 to 2.7.20 on CentOS5.8_x86_64.
But when I tried to launch ''puppet agent -t'' on one of staging servers, the
puppet daemon did not work and got heaps errors.
I have no idea what made it wrong and how to fix it.
Retrieving plugin [0m
Failed to generate additional resources using ''eval_generate: Error 500 on
SERVER: <!DOCTYPE HTML