8 11.69 43
#2 2010-12-26 00:01:52 696.19 11.69 43
#3 2010-12-26 00:02:52 712.26 11.69 43
#4 2010-12-26 00:03:52 720.70 11.69 43
#5 2010-12-26 00:04:52 726.16 11.69 43
#6 2010-12-26 00:05:52 713.26 11.69 43
A.K.
________
From: Simonas Kecorius
To: arun
Sent: Monday, Dec
On Mon, Dec 17, 2012 at 4:43 PM, Simonas Kecorius wrote:
> Hey Sarah,
> thanks for quick response and your kind help. I appreciate it a lot.
> You are completely right. When I input data as Arun suggested, there is no
> problems. But when I try to read it from txr file - something wrong happens.
>
boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of arun
> Sent: Monday, December 17, 2012 2:35 PM
> To: Simonas Kecorius
> Cc: R help
> Subject: Re: [R] split character line into rows
>
> Hi,
> This could also work:
> max(nchar(txt))
> #
:01:52 696.19 11.69 43
A.K.
- Original Message -
From: David Winsemius
To: Simonas Kecorius
Cc: r-help@r-project.org
Sent: Monday, December 17, 2012 3:15 PM
Subject: Re: [R] split character line into rows
On Dec 17, 2012, at 4:04 AM, Simonas Kecorius wrote:
> Hey R users,
>
> suppos
On Dec 17, 2012, at 4:04 AM, Simonas Kecorius wrote:
> Hey R users,
>
> suppose we have data:
>
txt <- readLines(textConnection("[1] 2010.12.26 00:00:52688,88
11,69 43,00
[2] 11,69 43,00
[3] 11,69 43,00
[4] 11,69 43,00
[5] 11,69 43,00
[6] 11,69 43,00
69 43
#6 2010-12-26 00:01:52 696.19 11.69 43
A.K.
- Original Message -
From: Simonas Kecorius
To: r-help@r-project.org
Cc:
Sent: Monday, December 17, 2012 7:04 AM
Subject: [R] split character line into rows
Hey R users,
suppose we have data:
[1] 2010.12.26 00:00:52 688,88 11,69
From: Simonas Kecorius
To: r-help@r-project.org
Cc:
Sent: Monday, December 17, 2012 7:04 AM
Subject: [R] split character line into rows
Hey R users,
suppose we have data:
[1] 2010.12.26 00:00:52 688,88 11,69 43,00
[2] 11,69 43,00
[3] 11,69 43,00
[4] 11,69 43,00
[5] 1
Certainly.
But you'd be better advised to use dput(head(yourdata, 20)) to provide
data, since we don't actually know what's in your data after it has
passed through print, copy, and email. How you got it into R may also
be relevant.
Also, I don't see how you get from the given data to the desired
Hey R users,
suppose we have data:
[1] 2010.12.26 00:00:52688,88 11,69 43,00
[2] 11,69 43,00
[3] 11,69 43,00
[4] 11,69 43,00
[5] 11,69 43,00
[6] 11,69 43,00
[7] 11,69 43,00
[8] 11,69 43,00
[9] 11,69 43,00
[10] 11,69 43,00
[11]
Andrew Robinson-6 wrote:
>
> A hack would be to use gsub() to prepend e.g. XXX to the keywords that
> you want, perform a strsplit() to break the lines into component
> strings, and then substr() to extract the pieces that you want from
> those strings.
>
> Cheers
>
> Andrew
>
Thanks, that go
-project.org] On
Behalf Of sunny
Sent: Wednesday, May 04, 2011 5:09 PM
To: r-help@r-project.org
Subject: [R] split character vector by multiple keywords simultaneously
Hi. I have a character vector that looks like this:
> temp <- c("Company name: The first company General Manager:
A hack would be to use gsub() to prepend e.g. XXX to the keywords that
you want, perform a strsplit() to break the lines into component
strings, and then substr() to extract the pieces that you want from
those strings.
Cheers
Andrew
On Wed, May 04, 2011 at 04:08:40PM -0700, sunny wrote:
> Hi. I
Hi. I have a character vector that looks like this:
> temp <- c("Company name: The first company General Manager: John Doe I
> Managers: John Doe II, John Doe III","Company name: The second company
> General Manager: Jane Doe I","Company name: The third company Managers:
> Jane Doe II, Jane Doe II
ginal Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Kim Milferstedt
> Sent: Wednesday, May 21, 2008 1:11 PM
> To: [EMAIL PROTECTED]
> Subject: [R] split character string in matrix into character
> vector and numeric vector
>
> Hello,
>
>
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
Yes, now that you mention it, I probably overlooked this option. As a
matter of fact, I did try interaction outside the split function. As he
did give me the same 'list' of elements as paste, I reject it... it is
only now that I realize that interaction returns a factor and that split
uses the
Recall that I had suggested you try interaction in place of paste if
paste was not
what you wanted.
On Nov 26, 2007 3:08 PM, Sébastien <[EMAIL PROTECTED]> wrote:
> One additionnal question about a problem that I just noticed in my script:
> the list created by my split function is sorted in the in
Thank you very much Jim.
jim holtman a écrit :
> You can reorder like this:
>
> y <- unique(do.call(paste,c(mydata[,1:2],sep = ":")))
> ordered.mydata <- mydata.split[y]
>
> On Nov 26, 2007 3:08 PM, Sébastien <[EMAIL PROTECTED]> wrote:
>
>> One additionnal question about a problem that I just n
Sure, it helps ! I did not get that my 'do.call' was coerced to a factor
and that the levels of the factor were used to order the list...
Thank you very much.
Dimitris Rizopoulos a écrit :
> one way is the following:
>
> vals <- do.call(paste, c(mydata[1:2], sep = ":"))
> fc <- factor(vals, leve
You can reorder like this:
y <- unique(do.call(paste,c(mydata[,1:2],sep = ":")))
ordered.mydata <- mydata.split[y]
On Nov 26, 2007 3:08 PM, Sébastien <[EMAIL PROTECTED]> wrote:
> One additionnal question about a problem that I just noticed in my script:
> the list created by my split function is
one way is the following:
vals <- do.call(paste, c(mydata[1:2], sep = ":"))
fc <- factor(vals, levels = unique(vals))
mydata.split <- split(mydata, fc, drop = TRUE)
names(mydata.split)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public
One additionnal question about a problem that I just noticed in my script:
the list created by my split function is sorted in the increasing order
and not in the current order of the elements of the do.call argument
(see the results of the two last lines of the following script). I was
unsuccesf
This work fine with paste. Thanks Gabor.
Seb
Gabor Grothendieck a écrit :
> Try this using the BOD data frame that comes with R or
> try using interaction in place of paste:
>
> split(BOD, do.call(paste, c(BOD, sep = ":")), drop=TRUE)
>
>
> On Nov 25, 2007 10:23 AM, <[EMAIL PROTECTED]> wrote:
>
Try this using the BOD data frame that comes with R or
try using interaction in place of paste:
split(BOD, do.call(paste, c(BOD, sep = ":")), drop=TRUE)
On Nov 25, 2007 10:23 AM, <[EMAIL PROTECTED]> wrote:
>
>
> Thanks Jim and Herinque for you reply.
>
> The substitution you are both proposing
Thanks Jim and Herinque for you reply.
The substitution you are both proposing works fine, except when a or b contains
decimal numbers (which is mostly my case in a real dataset). In this case, there
is no distinction between the decimal point and the one introduced by the split
function.
If the
Here is one way:
> a<-1:10
> b<-21:30
> mydata<-data.frame(a,b)
> mydata.split<-split(mydata,(mydata[,1:2]),drop=TRUE)
> x <- mydata.split
> # customize the names
> names(x) <- sapply(strsplit(names(x), "\\."), paste, collapse="-my
> character-")
> x
$`1-my character-21`
a b
1 1 21
$`2-my cha
Dear R-users,
The following code splits a very simple dataframe into a list, each element of
the list being one line of the dataframe. You will see that the split function
names each element of the list by using uses the content of a and b and merging
them with a "." character. Is there a way to
27 matches
Mail list logo