[FLR-list] Bug in readFLIndex

Mark Payne mpa at aqua.dtu.dk
Fri Jan 27 16:25:54 CET 2012


Hi,

readFLIndex cannot be used to read a single file into an index object. e.g.

> IHLS.idxs <-  readFLIndex(file=file.path(data.source,"/mlai.txt"),type="ICA")
Error in file2 != "" : 'file2' is missing
>

The error is fairly obvious: readFLIndex farms out the hard work to readFLIndices, but only supplies it with a single file, instead of the two that readFLIndices requires e.g. see code below.

Currently running FLCore 2.4 on Mandriva.

Mark


> readFLIndex
function (file, type = "VPA", index.names, descs, desc = paste("Imported from ",
    type, " file '", file, "'", sep = ""))
{
    res <- readFLIndices(file, type = type, index.names = index.names,
        desc = desc)
    if (length(res) > 1)
        warning("The ", type, " file ", file, " contains more than 1 index. Returning the first")
    return(res[[1]])
}
<environment: namespace:FLCore>
>

> readFLIndices
function (file, file2, type = "VPA", index.names, descs, desc = paste("Imported from ",
    type, " file '", file, "'", sep = ""), na.strings = "NA",
    sep = "")
{




________________________________________
Fra: flr-list-bounces at r-forge.wu-wien.ac.at [flr-list-bounces at r-forge.wu-wien.ac.at] P&#229; vegne af Iago Mosqueira [iago.mosqueira-sanchez at jrc.ec.europa.eu]
Sendt: 24. januar 2012 10:51
Til: flr-list at r-forge.wu-wien.ac.at
Emne: Re: [FLR-list] [FLR-devel] FLCohort

That's right. It is always an issue with the kind of organic growth we
have had.

I would add a warning for FLCohort(FLQuant) indicating that the
conversion via as() should be used and that the method will be
deprecated in the future


Iago


On 01/24/2012 10:40 AM, Laurie wrote:
> I guess it raises the issue of consistency with FLR.
>
> Laurie
>
> On 01/24/2012 10:33 AM, Iago Mosqueira wrote:
>> I only say it would probably be the correct thing to do.
>>
>> Conversion vs. creation, i.e. starting from an element of the same
>> complexity, or a simpler one. Like as(FLBRP, 'FLStock') vs. FLStock(...)
>>
>>
>> Iago
>>
>>
>>
>> On 01/24/2012 10:17 AM, Laurie Kell wrote:
>>> So your suggestion is to add FLQuant-FLCohort alongside the
>>> as(,"FLQuant")
>>>
>>> I dont fancy explaining the difference between as and FLQuant in a
>>> course
>>>
>>>
>>> Laurie
>>>
>>> On Tue, Jan 24, 2012 at 10:13 AM, Iago Mosqueira
>>> <iago.mosqueira-sanchez at jrc.ec.europa.eu
>>> <mailto:iago.mosqueira-sanchez at jrc.ec.europa.eu>> wrote:
>>>
>>> The idea is that FLCohort to FLQuant is a conversion. For FLCohort
>>> the creator takes an FLQuant as we originally considered that to be
>>> the main (only) way of creating one. To be fully consistent we
>>> should turn the FLQuant-FLCohort route into a conversion, but we
>>> should probably keep as it is for compatibility reasons.
>>>
>>>
>>> Iago
>>>
>>>
>>>
>>> On 01/24/2012 10:06 AM, Laurie Kell wrote:
>>>
>>> thanks forgot about that, but an easy mistake to make if the inverse
>>> follows a different syntax. So shouldn´t this also work?
>>>
>>> FLQuant(FLCohort(m(ple4)))
>>>
>>> Laurie
>>>
>>>
>>> On Tue, Jan 24, 2012 at 9:40 AM, Ernesto Jardim
>>> <ernesto.jardim at jrc.ec.europa.__eu
>>> <mailto:ernesto.jardim at jrc.ec.europa.eu>
>>> <mailto:ernesto.jardim at jrc.ec.__europa.eu
>>> <mailto:ernesto.jardim at jrc.ec.europa.eu>>> wrote:
>>>
>>> __
>>>
>>> On 01/24/2012 09:21 AM, Laurie wrote:
>>>
>>> Shouldn´t this work?
>>>
>>> FLQuant(FLCohort(m(ple4)))
>>>
>>>
>>> Error in filldimnames(dimnames(object), dim = dim) :
>>> more than one vector of names given for the first
>>> dimension
>>>
>>> Laurie
>>>
>>> No, but this one does
>>>
>>> as(FLCohort(m(ple4)), "FLQuant")
>>>
>>> EJ
>>>
>>>
>>> _________________________________________________
>>> flr-list mailing list
>>> flr-list at flr-project.org <mailto:flr-list at flr-project.org>
>>> <mailto:flr-list at flr-project.__org
>>> <mailto:flr-list at flr-project.org>>
>>> https://lists.r-forge.r-__project.org/cgi-bin/mailman/__listinfo/flr-list
>>>
>>> <https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list>
>>>
>>>
>>>
>>>
>>>
>>> _________________________________________________
>>> flr-list mailing list
>>> flr-list at flr-project.org <mailto:flr-list at flr-project.org>
>>> https://lists.r-forge.r-__project.org/cgi-bin/mailman/__listinfo/flr-list
>>>
>>> <https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list>
>>>
>>>
>>>
>>> --
>>> Dr Iago Mosqueira
>>>
>>> European Commission – Joint Research Center
>>> Institute for the Protection and Security of the Citizen (IPSC)
>>> Maritime Affairs Unit FISHREG – Scientific Support to Fisheries
>>> TP 051, Via Enrico Fermi 2749
>>> I-21027 Ispra (VA), Italy
>>>
>>> Office : +39 0332 785413 <tel:%2B39%200332%20785413>
>>> Fax: +39 0332 789658 <tel:%2B39%200332%20789658>
>>>
>>> iago.mosqueira at jrc.ec.europa.__eu
>>> <mailto:iago.mosqueira at jrc.ec.europa.eu>
>>>
>>> http://fishreg.jrc.ec.europa.__eu/home
>>> <http://fishreg.jrc.ec.europa.eu/home>
>>>
>>>
>>> _________________________________________________
>>> flr-list mailing list
>>> flr-list at flr-project.org <mailto:flr-list at flr-project.org>
>>> https://lists.r-forge.r-__project.org/cgi-bin/mailman/__listinfo/flr-list
>>>
>>> <https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> flr-list mailing list
>>> flr-list at flr-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>
>>
>
> _______________________________________________
> flr-list mailing list
> flr-list at flr-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list


--
Dr Iago Mosqueira

European Commission – Joint Research Center
Institute for the Protection and Security of the Citizen (IPSC)
Maritime Affairs Unit FISHREG – Scientific Support to Fisheries
TP 051, Via Enrico Fermi 2749
I-21027 Ispra (VA), Italy

Office : +39 0332 785413
Fax: +39 0332 789658

iago.mosqueira at jrc.ec.europa.eu

http://fishreg.jrc.ec.europa.eu/home

_______________________________________________
flr-list mailing list
flr-list at flr-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list


More information about the flr-list mailing list