[R] ERROR - non-conformable arguments

PIKAL Petr petr.pikal at precheza.cz
Mon Sep 21 12:38:27 CEST 2015


Hi

Do not use attachment, copy result of dput(object) to your mail instead. This enables us to see how your data really look like.

I get different error.
> widesII(used, available, avknown = TRUE, alpha = 0.05)
Error in widesII(used, available, avknown = TRUE, alpha = 0.05) :
  used and available matrices should have the same number of habitats

The error is due to fact that row names were read as column of data frame. After correcting this I got the same error as you.

> widesII(used, available, avknown = TRUE, alpha = 0.05)
Error in as.vector(X) %*% t(as.vector(Y)) : non-conformable arguments

I checked the help page and I noticed that

a
for widesI and widesII, a vector with named elements describing the sample or the proportion of available resource units. For widesIII a matrix or a data frame giving the number or the proportion of available resource units for each animal (in rows) in each resource category (in columns)

but your "available" is a data frame.


When I change it to named vector (as required)

> dput(avail)
structure(c(0.06, 0.13, 0.16, 0.15, 0.06, 0.17, 0.12, 0.04, 0.09,
0.02), .Names = c("Riparian", "Conifer", "MtShrub1", "Aspen",
"RockOutcrop", "Bitterbrush", "Windblown", "MtShrub2", "PresBurn",
"Clearcut"))

widesII came with result without complain.

> widesII(used, avail, avknown = TRUE, alpha = 0.05)


************** Manly's Selection ratios for design II ********

1. Test of identical use of habitat by all animals
   (Classical Khi-2 performed on the used matrix):
      Khi2L1           df       pvalue

So the lesson is:

1. Read the help page.
2. Look to your data by ?str
3. When your data are as expected by the function, check if there is no syntax problem.
4. Try to simplify the example and send it to help list preferably by ?dput.

Cheers
Petr

> -----Original Message-----
> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of
> Alexander Moßbrucker
> Sent: Monday, September 21, 2015 8:58 AM
> To: r-help at r-project.org; jdnewmil at dcn.davis.ca.us
> Subject: Re: [R] ERROR - non-conformable arguments
>
> Hi all,
>
> I am sorry I forgot to attach the excel file and txt files with the
> test data I used for this example.....
>
> I am almost sure the problem was caused by the way R is reading this
> data,
>
> Hope to get some help, best, Alex
>
> 2015-09-20 14:03 GMT+07:00 Alexander Moßbrucker
> <islandelephants at gmail.com>:
>
> >
> > Hi,
> >
> > I am using adehabitatHS for habitat selection analysis using
> > widesII(), when running the script I get the error message: Error in
> > as.vector(X) %*%
> > t(as.vector(Y)) : non-conformable arguments
> >
> > Here the script I am using including the data
> >
> > > #dataset (read from tab deliminated text file)
> > >
> > > available
> >   Riparian Conifer MtShrub1 Aspen RockOutcrop Bitterbrush Windblown
> > MtShrub2
> > PresBurn
> > 1     0.06    0.13     0.16  0.15        0.06        0.17      0.12
> >  0.04
> > 0.09
> >   Clearcut
> > 1     0.02
> > > used
> >      Riparian Conifer MtShrub1 Aspen RockOutcrop Bitterbrush
> Windblown
> > MtShrub2 PresBurn
> > Ani1        0       0        0     2           0          16
> 5
> > 14       28
> > Ani2        0       2        1     2           2           5
> 10
> > 10       35
> > Ani3        0       1        2     1           0          14
> 9
> > 8       40
> > Ani4        0       1        3     7           5           3
> 6
> > 9       31
> > Ani5        0       0        2     2           5          18
> 10
> > 6       25
> > Ani6        0       2        1     4           2           7
> 6
> > 15       19
> >      Clearcut
> > Ani1        8
> > Ani2        9
> > Ani3        4
> > Ani4        9
> > Ani5        0
> > Ani6       19
> > >
> > > #analysis
> > >
> > > widesII(used, available, avknown = TRUE, alpha = 0.05)
> > Error in as.vector(X) %*% t(as.vector(Y)) : non-conformable arguments
> >
> > Note: I am using an example dataset to test out a script I want to
> use
> > to analyse my own dataset, for this I exported the example dataset to
> > excel, converted it to tab deliminated text file, then imported it.
> >
> > All worked well when using the example dataset provided by
> > adehabitatHS, thus I suspect that somhow my test dataset is not
> > correctly read in or something similar.
> >
> > I am quite new to R, thus apologize for any shortcomings in reporting
> etc..
> >
> > Many thanks, best, Alex
> >
> >
> >
> > --
> > View this message in context:
> > http://r.789695.n4.nabble.com/ERROR-non-conformable-arguments-
> tp471251
> > 6.html Sent from the R help mailing list archive at Nabble.com.
> >
> >
> >
> >

________________________________
Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system.
If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient.


More information about the R-help mailing list