: Friday, January 18, 2013 5:21 AM
To: r-help@r-project.org
Subject: [R] reading multiple key=value pairs per line
Hi,
Thanks for a great environmentfor statistical computing :-)
I have some input data in a file (input_kvpairs.csv) of the form
key1=23, key2=67, key3=hello there
key1=7
: [R] reading multiple key=value pairs per line
Hi,
Thanks for a great environmentfor statistical computing :-)
I have some input data in a file (input_kvpairs.csv) of the form
key1=23, key2=67, key3=hello there
key1=7, key2=22, key3=how are you
key1=2, key2=77, key3=nice day, thanks
Now in my
variables:
# $ key1: num 23 7 2
# $ key2: num 67 22 77
# $ key3: chr hello there how are you nice day, thanks
A.K.
- Original Message -
From: Frank Singleton b17fly...@gmail.com
To: r-help@r-project.org
Cc:
Sent: Thursday, January 17, 2013 11:21 PM
Subject: [R] reading multiple key=value
You could use the strapply function from the gsubfn package to extract the
data from strings. This will return a list that you could use with
do.call(rbind(
The stringr package may have something similar or an alternative (but I am
less familiar with that package).
On Thu, Jan 17, 2013 at 9:21
Singleton b17fly...@gmail.com
To: r-help@r-project.org
Cc:
Sent: Thursday, January 17, 2013 11:21 PM
Subject: [R] reading multiple key=value pairs per line
Hi,
Thanks for a great environmentfor statistical computing :-)
I have some input data in a file (input_kvpairs.csv) of the form
key1=23
Hi,
Thanks for a great environmentfor statistical computing :-)
I have some input data in a file (input_kvpairs.csv) of the form
key1=23, key2=67, key3=hello there
key1=7, key2=22, key3=how are you
key1=2, key2=77, key3=nice day, thanks
Now in my head I wish it was of the form (input.csv)
Maybe you can use ',=' as separators. ( I don't have R to check).
Otherwise, I would clean the file with an editor or tool like 'sed' to
replace the regular expression /key[0-9]=/ by nothing.
On Jan 18, 2013 8:05 AM, Frank Singleton b17fly...@gmail.com wrote:
Hi,
Thanks for a great
7 matches
Mail list logo