Thanks All,
Henrique, gave me the solution is was looking for, the indexing was a
mistake on my part.
Thanks again
On 23 June 2011 16:37, David Winsemius wrote:
>
> On Jun 23, 2011, at 11:19 AM, Uwe Ligges wrote:
>
>
>>
>> On 23.06.2011 16:39, Michael Pearmain wrote:
>>
>>> Hi All,
>>>
>>> I'v
On Jun 23, 2011, at 11:19 AM, Uwe Ligges wrote:
On 23.06.2011 16:39, Michael Pearmain wrote:
Hi All,
I've been given a data file of the form:
1: 3,4,5,6
2:1,2,3
43: 5,7,8,9,5
and i want to read this data in as a list to create the form:
(guessing final look)
my.list
[[1]]
[1] 3 4 5 6
[[2]
Try this:
sapply(lapply(strsplit(l, ":"), strsplit, ","),
function(x)structure(lapply(x[2], as.numeric), .Names = x[1]))
On Thu, Jun 23, 2011 at 11:39 AM, Michael Pearmain
wrote:
> Hi All,
>
> I've been given a data file of the form:
> 1: 3,4,5,6
> 2:1,2,3
> 43: 5,7,8,9,5
>
> and i want to read
Thanks Uwe,
The list elements was a mistake on my part, i just wanted everything before
the : to be the name of the element.
Thanks for the help, i can play around with this to get what i want.
M
2011/6/23 Uwe Ligges
>
>
> On 23.06.2011 16:39, Michael Pearmain wrote:
>
>> Hi All,
>>
>> I've b
l <- readLines(textConnection("1: 3,4,5,6
2:1,2,3
43: 5,7,8,9,5"))
On Thu, Jun 23, 2011 at 12:28 PM, Henrique Dallazuanna wrote:
> Try this:
>
> sapply(lapply(strsplit(l, ":"), strsplit, ","),
> function(x)structure(lapply(x[2], as.numeric), .Names = x[1]))
>
> On Thu, Jun 23, 2011 at 11:39 AM,
On 23.06.2011 16:39, Michael Pearmain wrote:
Hi All,
I've been given a data file of the form:
1: 3,4,5,6
2:1,2,3
43: 5,7,8,9,5
and i want to read this data in as a list to create the form:
(guessing final look)
my.list
[[1]]
[1] 3 4 5 6
[[2]]
[1] 1 2 3
[[43]]
[1] 5 7 8 9 5
I can get to a s
Hi All,
I've been given a data file of the form:
1: 3,4,5,6
2:1,2,3
43: 5,7,8,9,5
and i want to read this data in as a list to create the form:
(guessing final look)
my.list
[[1]]
[1] 3 4 5 6
[[2]]
[1] 1 2 3
[[43]]
[1] 5 7 8 9 5
I can get to a stage using scan:
scan("my.data", what = character
7 matches
Mail list logo