Re: [unmarked] Formatting data

352 views
Skip to first unread message

Richard Chandler

unread,
Apr 18, 2013, 1:20:26 PM4/18/13
to Unmarked package
Hi,

Looks like a typo. Your object is called "ObsCovs" but you are trying
to create the unmarkedFrame with "obsCovs". If changing the case still
doesn't fix it, please show the results of:

str(ObsCovs)

Richard

On Wed, Apr 17, 2013 at 11:31 AM, <erynn...@maine.edu> wrote:
> Hello, I'm new to unmarked and I'm having trouble formatting my data. I
> have sites with different number of observations, does this require the data
> to be in long format? I'm following the example from Fiske and Chandler
> '12. My data are in wide format* and I received an error after the
> "unmarked FrameOccu" and "csvToUMF", I'm not sure what I'm doing wrong:
>
> *
> baea <- read.csv("C:\\RBHAB\\R\\spbaea10.csv", header=TRUE) #WIDE format
> like "widewt.csv" in example.
> head(baea)
>
> SITE_CODE PA5 PA6 PA7 PA8 PA9 PA10 PA11 AREASQM BRIDGE01 TRIB01 WIRES01
> RIVKM TIDAL01 R3D JULIAN5 JULIAN6 JULIAN7
> 1 1 0 0 0 0 0 0 NA 38684 1 0 0
> 8.54 0 0.80 97 112 126
> 2 2 0 0 0 0 0 0 NA 77798 1 0 1
> 8.34 1 0.40 97 112 126
> 3 3 NA 0 1 0 1 0 NA 18866 0 0 1
> 6.90 1 0.36 NA 115 129
>
>
>
> y <- baea[,2:8]
>> siteCovs <- baea[,c("AREASQM", "BRIDGE01", "TRIB01", "WIRES01", "RIVKM",
>> "TIDAL01", "R3D")]
>> ObsCovs <- list (julian=baea[,c("JULIAN5",
>> "JULIAN5","JULIAN6","JULIAN7","JULIAN8","JULIAN9","JULIAN10","JULIAN11" )],
> +
> watern=baea[,c("WATERN5","WATERN6","WATERN7","WATERN8","WATERN9","WATERN10","WATERN11")],
> + rockpa=baea[,c("ROCKPA5","ROCKPA6",
> "ROCKPA7","ROCKPA8","ROCKPA9","ROCKPA10","ROCKPA11")],
> +
> islpa=baea[,c("ISLPA5","ISLPA6","ISLPA7","ISLPA8","ISLPA9","ISLPA10","ISLPA11")],
> + rapa=baea[,c("RAPA5","RAPA6","RAPA7","RAPA8","RAPA9", "RAPA10","RAPA11")])
>
>> baea <- unmarkedFrameOccu(y=y, siteCovs=siteCovs, obsCovs=obsCovs)
> Error in validObject(.Object) :
> invalid class "unmarkedFrame" object: invalid object for slot "obsCovs" in
> class "unmarkedFrame": got class "standardGeneric", should be or extend
> class "optionalDataFrame"
>
> #Alternatively, the convenience function csvToUMF can be used:
>
>> baea <- csvToUMF(system.file("csv","spbaea10.csv",package="unmarked"),
>> long=FALSE, type="unmarkedFrameOccu")
> Error in read.table(file = file, header = header, sep = sep, quote = quote,
> :
> no lines available in input
> In addition: Warning message:
> In file(file, "rt") :
> file("") only supports open = "w+" and open = "w+b": using the former
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "unmarked" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to unmarked+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages