[R] import file formatted RFC-822

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Apr 14 19:33:30 CEST 2010


On Wed, Apr 14, 2010 at 6:20 PM, Sebastian Kruk <residuo.solow at gmail.com> wrote:
> I have a problem, In a few cases "robot-exclusion-useragent" have 2 or
> more values, is there a manner to fix it? For example, robot askjeeves
> has three names.

 use 'all=TRUE'?

test data:

foo: 1
bar: 2

foo: 1
foo: 2
bar: 4
baz: 7

> read.dcf("simple.txt",all=TRUE)
   foo bar  baz
1    1   2 <NA>
2 1, 2   4    7

 note that $foo is a *list* in order to handle multiple values in its elements:

 > m=read.dcf("simple.txt",all=TRUE)
 > m$foo
[[1]]
[1] "1"

[[2]]
[1] "1" "2"

 whereas $bar is a simple vector:

 > m$bar
[1] "2" "4"

 as is $baz (with NA where no baz record exists)

 > m$baz
[1] NA  "7"

sorted?

Barry



More information about the R-help mailing list