I'm relatively new to R and expecially to the unmarked
package. I'm trying to run a single-season occupancy analysis and I'm basically stuck at the beginning. I can't really understand why.
My data
library(tibble)
library(unmarked)
Newtdata <- tibble(`BASIC DATA` = c("DataID", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58"),
...2 = c("OriginalDataID", "1", "2", "4", "6", "7", "7", "8", "8", "9", "11", "12", "14", "38", "15", "16", "18", "19", "25", "27", "29", "30", "31", "32", "33", "34", "35", "36", "37", "50", "51", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "52", "53", "57", "64", "65", "66", "79", "80", "81", "88", "93", "94", "95", "101", "103", "105", "106"),
...3 = c("WP", "2", "2", "2", "2", "3", "3", "3", "3", "4", "4", "4", "4", "4", "5", "5", "5", "6", "6", "6", "7", "7", "7", "8", "8", "8", "8", "8", "9", "9", "9", "6", "6", "6", "2", "2", "2", "3", "3", "3", "3", "4", "4", "4", "4", "5", "5", "5", "7", "7", "7", "8", "8", "8", "8", "4", "9", "9", "9"),
...4 = c("Survey", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2"),
...5 = c("Julian day", "98", "98", "99", "99", "100", "100", "100", "100", "101", "101", "101", "101", "112", "102", "102", "102", "103", "104", "104", "105", "105", "105", "107", "107", "107", "107", "107", "111", "118", "118", "112", "112", "112", "115", "115", "115", "115", "115", "117", "117", "117", "118", "119", "119", "120", "120", "120", "123", "123", "124", "125", "126", "126", "126", "128", "131", "131", "131"),
`POND DATA` = c("Pond", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "17", "18", "19", "2", "31", "4", "8", "7", "6", "5", "9", "10", "11", "12", "15", "14", "16", "21", "20", "22", "23", "26", "32", "27", "13", "29", "30", "28"),
...7 = c("Gewässer Typ", "BüffelOverg", "BüffelOverg", "BüffelOverg", "Artificial", "Natural", "BüffelOverg", "BüffelOverg", "Büffel", "NaturalStream", "NaturalStream", "NaturalBüffel", "Natural", "Artificial", "Flooded", "GrabenFlooded", "NaturalStream", "NaturalStream", "Natural", "Tränke", "Artificial", "Flooded", "Artificial", "Büffel", "Natural", "NaturalBüffel", "Büffel", "Büffel", "NaturalBüffel", "Natural", "NaturalBüffel", "NaturalStream", "Natural", "Tränke", "BüffelOverg", "BüffelOverg", "Artificial", "Büffel", "BüffelOverg", "BüffelOverg", "Natural", "Natural", "BüffelOverg", "NaturalBüffel", "Natural", "GrabenFlooded", "Flooded", "NaturalStream", "Flooded", "Artificial", "Artificial", "Büffel", "Büffel", "Büffel", "Büffel", "Artificial", "Natural", "NaturalBüffel", "NaturalBüffel"),
...8 = c("Longitud", "302127", "302118", "302169", "302491", "301270", "301191", "300423", "300312", "349762", "349747", "349690", "349131", "349405", "359034", "358290", "358353", "330880", "330107", "330225", "341994", "342026", "342166", "362626", "362836", "362865", "362946", "362981", "377907", "379119", "377809", "330883", "330111", "330220", "302120", "302104", "302491", "300309", "300423", "301193", "301279", "349764", "349763", "3499686", "349128", "358282", "359041", "358358", "342026", "341997", "342172", "362634", "362958", "362879", "362969", "349407", "379119", "377806", "377891"),
...9 = c("Latitud", "5092494", "5092491", "5092591", "5092446", "5080893", "5080904", "5081256", "5081306", "5123415", "5123762", "5123840", "5123719", "5123665", "5109048", "5109554", "5109197", "5134272", "5134250", "5134332", "5085805", "5085861", "5085601", "5096887", "5097251", "5097501", "5097343", "5097605", "5110035", "5109662", "5109625", "5134277", "5134251", "5134331", "5092490", "5092491", "5092446", "5081308", "5081261", "5080900", "5080894", "5123414", "5123750", "5123838", "5123723", "5109556", "5109081", "5109200", "5085854", "5085800", "5085579", "5096879", "5097361", "5097508", "5097609", "5123662", "5109662", "5109625", "5110034"),
...10 = c("Observation", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "Substitut of Pond 1", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "Substitut of Pond 25", NA, NA, NA, NA, NA),
OCCURRENCE = c("L. vulgaris", "0", "0", "0", "1", "0", "1", "0", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "0", "0", "0", "1", "0", "0", "1", "1", "0", "1", "1", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "1", "1", "1", "1", "1", "1", "1", "0", "0", "0", "0", "1", "0", "0", "0", "1", "1", "0", "0", "0"),
...12 = c("T. cristatus", "0", "0", "0", "1", "0", "1", "0", "0", "0", "1", "1", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "1", "0", "0", "1", "1", "0", "1", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"),
`WOODPASTURE LEVEL DATA` = c("Exposition", "0.5", "34", "0.33", "0.38", "189", "75", "53", "80", "327", "335", "354", "347", "342", "318", "166", NA, "339", "305", "344", "15", "36", "66", "29", "353", "324", "350", "358", "306", "296", "330", "10", "289", "2", "24", "32", "58", "106", "81", "90", "106", "340", "338", "16", "66", "135", "308", "215", "3", "337", "56", "6", "265", "337", "358", "290", "328", "3", "339"),
...14 = c("Cattle", "1", "1", "1", "1", "1;2", "2", "2", "2", "1;3", "2", "2;3", "2;3", "1,3,4", "2;3", "2;3", "3", "1", "1", "1", "1;2;3", "1;3", "1;3", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "3", "1;2;3", "1;2;3", "1", "1", "1", "1", "1", "1", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "1", "1;2;3", "1;2;3", "1;2;3", "2", "1;3", "1;3", "1;3", "1;3", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "1;3, 4;5", "2;3; 5", "2;3;5", "2;3;5"),
...15 = c("Grazing", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "0", "1"),
`ABIOTIC CONDITIONS` = c("Weather", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "SunnyWindy", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "PartCloudy", "Cloudy", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "PartCloudy", "PartCloudy", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Cloudy", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "PartCloudy", "PartCloudy", "PartCloudy"),
...17 = c("AvgGroundT", "15.3", "13.75", "16.6", "17.9", "14.06", "21.2", "23.4", "23.4", "21.82", "24.063", "20.65002", "14.53", "8.9982", "22.364", "19.25", "20.32", "21.566", "24.82", "21.8", "24.66", "20.13", "18.996", "23.895", "22.58332", "26.668", "23.16", "23.42", "17.469", "17.797", "20.94", "19.92", "15.367", "16.7", "16.21", "18.85001", "18.7", "18.969", "15.13", "16.92", "16.2", "14.217", "17.42", "16.563", "15.9", "13.42", "15.95001", "15.4", "17.94", "23.364", "25.85", "21.5", "19", "23.44", "26.969", "22.566", "18.32", "19.098", "16.05" ),
...18 = c("AvgWaterT", "18.848", "16.598", "12.568", "14.65", "13.867", "16.65002", "27.266", "24.395", "24.24", "22.42", "20.08336", "19.766", "9.7989", "17.867", "22.38329", "22.51", "21.797", "25.2", "16.82", "15.9", "26.864", "18.74", "23.32", "25.16", "25.598", "24.168", "24.71", "18.668", "22.8", "22.566", "17.3", "22.01", "15.73", "17.516", "18.867", "19.598", "17.32", "20.168", "15.568", "13.467", "19.66", "17.266", "11.967", "19.969", "19.7", "20.01", "14.766", "20.8", "14.666", "15.63", "24", "21.2", "29.098", "28.51", "15.568", "27", "22.92", "21.469"),
...19 = c("HumidityMin", NA, NA, NA, NA, "41", "28.89", "32.65", "26.66", "15.91", "31.58", NA, "38.89", "38.84003", "30.76", "20.27", "27.3", "31.9", "28.45", "33.36", "26.22", "25.39", "31.32", "27.75", "17.07", "23.38", "22.06", "26.64", "32.02003", "40.227", "35.67", "26.12", "21.44", "18.01002", "52.43", "40.43", "39.32", "48.82", "51.11", "43.22", "20.34", "37.64", "28.83", "37.46", "15.63", "27.61", "31.56", "38.17", "36.73", "30.77", "39.94", NA, "38.82", "32.27003", "26.32", "44.82", "25.17", "27.91", "30.75"),
...20 = c("HumidityMax", NA, NA, NA, NA, "42.49", "31.23", "35.95003", "31.94", "20.26002", "33.85", NA, "40.797", "93.35", "37.547", "23.38", "35.09003", "37", "32.367", "37.22", "28.75", "27.85", "33.99", "33.04", "22.09", "28.11", "26.7", "33.09003", "38.21", "45.71", "41.55", "30.66", "24.21", "19.57", "57.47", "45.82", "49.66", "52.08", "53.5", "52.02", "27.53", "45.46", "32.03", "41.66", "20.76", "30.16", "35.477", "45.64", "42.8", "32.49", "46.12", NA, "45.17", "37.657", "30.42", "48.88", "27.92", "32.89", "34"),
...21 = c("AvgWaterDepth(m)", "8.56E-2", "0.11166", "0.08", "0.2984", "0.18", "0.23669", "0.17667", "5.2999E-2", "8.6656E-2", "0.2681", "0.2132", "0.24", "0.45", "5.33E-2", "0.11", "4.6669E-2", "0.38", "0.03", "0.283", "0.8377", "6.325E-2", "0.5232", "0.141", "0.105", "0.13", "0.1134", "0.17", "0.15665", "0.06", "0.09", "0.40662", "0.08", "0.2631", "9.51E-2", "0.1033", "0.38", "5.33E-2", "0.3236", "0.36664", "0.1933", "0.125", "0.28668", "0.24167", "0.21667", "8.343E-2", "5.6671E-2", "3.6667E-2", "5.33E-2", "0.53663", "0.64", "7.334E-2", "0.16", "7.334E-2", "0.1633", "0.51", "7.334E-2", "7.07E-2", "0.12"),
`POND GEOMETRY` = c("Pond area (m²)", "15.16248", "9.42", "20.43649", "6.44", "9.210328", "13.065", "10.56", "10.199", "92.71", "161.477", "21.82503", "20.16", "10.199", "1.41", "18.195", "10.353", "15.21", "0.554", "4.625701", "14.28", "8.25", "15.3", "18.7209", "4.5449", "8.19", "141", "48.09747", "6.24", "143.26731", "21.295", "12.3354", "1.2236", "4.625701", "32.61624", "23.96544", "9.244797", "11.61759", "86.43", "22.263", "11.56548", "102.4", "158.3583", "70.60595", "16.6567", "9.179393", "2.1461", "3.133", "1.75", "11.7478", "19.27261", "1.3", "63.999066671", "21.11401", "46.94689", "10.4", "36.19109", "6.1875", "4.83"),
...23 = c("Pond size (m³)", "1.2888124999", "1.051901", "1.634919", "1.921269", "1.657859", "3.092054", "1.865601", "0.54057", "8.034859", "43.329661667", "4.656006", "4.8384", "4.59", "7.4673E-2", "2.001452", "0.4831401", "5.779807", "1.651E-2", "1.2951962", "11.95712", "0.52246", "8.0067", "2.6209263", "0.4772245", "1.0647", "15.98", "8.1765749997", "0.97751", "8.5960381", "1.916639", "5.0163959994", "9.788803E-2", "1.218100", "3.0985421668", "2.4764312", "3.5130239997", "0.619605323", "27.94576", "8.163464", "2.235994", "12.8", "45.396074664", "17.06311", "3.608954", "0.7649502", "0.121618", "0.114889", "9.324E-2", "6.3046526658", "12.334464001", "9.539E-2", "10.239850667", "1.54836", "7.6679936668", "5.304003", "2.6540141", "0.4331254", "0.5796"),
`POND BIOTIC PARAMETERS` = c("Herbs<30cm", "52.5", "52.5", "55", "46", "48", "35", "51", "53", "25.5", "25", "52.5", "54", "37", "60", "48.5", "61", "65", "75", "12", "7", "25", "40", "50", "46", "38", "55", "25", "55", "27", "51", "61", "66", "12", "69.5", "60.5", "25", "44", "50", "53", "48", "39", "47", "38.5", "65", "50", "40", "62", "40", "6", "12", "10", "40", "35", "8", "41", "20", "65", "40"),
...25 = c("Herbs40-80cm", "29", "10", "15", "15", "0", "20", "6", "1", "8.5", "5", "5.5", "1", "3", "20", "15", "0", "1", "7", "2", "29", "0", "0", "2", "26.5", "12", "0", "0", "0", "0", "3", "1", "8", "2", "8", "6", "7", "1", "4", "7", "0", "6", "0", "5.5", "2", "25", "48", "4", "1", "1", "1", "0", "0", "1", "0", "2", "0", "2", "0"),
...26 = c("Herbs>90cm", "1", "0", "0.5", "1", "0", "0", "0", "0", "5", "0", "1.5", NA, "0", "3", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"), ...27 = c("Woody<2m", "0", "0", "0", "3", "2", "0", "0", "0", "0", "0", "2.5", "0", "0", "0", "2", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "2", "0", "2", "8.5", "0", "0", "0", "1", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0" ),
...28 = c("Woody>2m", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "7.5", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"),
...29 = c("Dry_leaves", "0", "0", "0", "0", "0", "0", "0", "7", "0", "0", "1", "2", "15", "1", "5", "2", "0", "0", "0", "2", "0", "0", "1", "0", "0", "1", "0", "0", "0", "0", "0", "1", "0", "0.5", "0", "0", "5", "0", "0", "0", "0.5", "1", "0.5", "0", "5", "0", "1", "0", "0", "0", "0", "0", "0", "0", "20", "0", "1", "0"),
...30 = c("Rock_trunks", "0", "0", "0", "0", "0", "0", "0", "0", "2.5", "0", "1.5", "0", "5", "0", "0.5", "0", "0", "0", "1", "3", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "1", "0", "0", "4", "0", "0", "0", "0", "4.5", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0"),
...31 = c("Bare soil", "0", "0", "2", "10", "7", "5", "3", "9", "1", "0", "5.5", "3", "5", "8", "4", "12", "3", "13", "70", "27", "35", "22", "7", "7.5", "15", "17", "35", "15", "13", "6", "5", "12", "70", "2.5", "1.5", "34", "6", "2", "5", "7", "1.5", "0", "2", "17", "1", "6", "20", "52", "72", "42", "85", "28", "18", "37", "7", "19", "10", "30" ),
...32 = c("Herbs<30cm", "1.5", "3.5", "0.5", "3", "0", "7", "12", "15", "12.5", "0", "1", "1", "0", "1", "5", "4", "6", "1", "5", "0", "3", "13", "4", "1.5", "1", "3", "0", "15", "20", "10", "6", "1", "5", "7.5", "4.5", "3", "20", "10", "2", "0", "3", "1", "0.5", "1", "2", "0", "5", "0", "0", "12", "0", "2", "5", "1", "1", "4", "9", "2"),
...33 = c("Herbs40-80cm", "3", "16", "5.5", "0", "0", "5", "0", "0", "2", "10", "5.5", "3", "0", "0", "0.5", "0", "1", "0", "0", "0", "0", "5", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "4", "6.5", "1", "0", "0", "10", "0", "0", "10", "7.5", "1", "5", "0", "0", "0", "0", "2", "0", "0", "0", "0", "0", "0", "0", "0"),
...34 = c("Herbs>90cm", "0", "0", "0", "0", "0", "0", "0", "0", "2", "0", "0", "15", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", NA), ...35 = c("Rock_trunks", "0", "0", "0", "2", "2", "0", "0", "0", "10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "2", "0", "0", "0", "0", "5", "0", "0", "0", "2", "13", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"),
...36 = c("Floating", "3.5", "2.5", "1.5", "10", "3", "7", "1", "15", "26.5", "28", "3", "5", "15", "1", "3.5", "1", "2", "0", "1", "1", "1", "0", "1", "3.5", "12", "3", "0", "5", "0", "0", "0", "0", "1", "3.5", "13.5", "5", "0", "1", "3", "3", "38.5", "2", "2", "3", "2", "0", "0", "0", "1", "3", "0", "0", "0", "0", "12", "2", "1", "0"),
...37 = c("Submerged", "1", "4.5", "3.5", "0", "5", "7", "1", "0", "0", "38", "15.5", "8", "10", "1", "10.5", "1", "4", "2", "0", "0", "0", "20", "1", "12", "5", "0", "0", "15", "0", "7", "3", "1", "0", "7.5", "2", "1", "24", "0", "20", "5", "20", "27", "19", "4", "0", "0", "1", "0", "0", "6", "0", "0", "0", "0", "26", "0", "0", "0" ),
...38 = c("water", "8.5", "11", "16.5", "10", "30", "18", "26", "0", "4.5", "22", "18.5", "16", "15", "5", "5.5", "19", "17", "2", "9", "29", "36", "0", "34", "3", "16", "20", "40", "10", "40", "23", "22", "8", "9", "0", "11.5", "15", "0", "33", "0", "30", "2", "10", "17.5", "7", "10", "6", "6", "7", "20", "25", "5", "30", "40", "54", "0", "55", "12", "28")
)
My code
y<-Newtdata[11:12]
siteCovs<-Newtdata[1:10, 14:15]
obsCovs<-Newtdata[16:38]
umf<-unmarkedFrameOccu(y = y, siteCovs = siteCovs, obsCovs = obsCovs)
I get this error:
Error: Incorrect number of rows in obsCovs data frame
I really can't figure out what it means. The number of rows for the columns I called obsCovs is the same as the rest of the table, I tried shrinking them or putting less columns but I keep getting the same error! There's probably an easy solution but I couldn't find anything around the internet for it. Thank you in advance for reading this far :)
UPDATE!
I've tried, unsucessfully, to split up my data into 3 sheets as follows:
SiteCovariatesDF<-as.data.frame(SiteCovariates)
ObservationCovariatesDF<-as.data.frame(ObservationCovariates)
OccurenceMatrix<-as.matrix(Occurrence)
y<-Occurrence
siteCovs<-SiteCovariatesDF
obsCovs<-ObservationCovariatesDF
I still get the same error.
I'm relatively new to R and expecially to the unmarked
package. I'm trying to run a single-season occupancy analysis and I'm basically stuck at the beginning. I can't really understand why.
My data
library(tibble)
library(unmarked)
Newtdata <- tibble(`BASIC DATA` = c("DataID", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58"),
...2 = c("OriginalDataID", "1", "2", "4", "6", "7", "7", "8", "8", "9", "11", "12", "14", "38", "15", "16", "18", "19", "25", "27", "29", "30", "31", "32", "33", "34", "35", "36", "37", "50", "51", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "52", "53", "57", "64", "65", "66", "79", "80", "81", "88", "93", "94", "95", "101", "103", "105", "106"),
...3 = c("WP", "2", "2", "2", "2", "3", "3", "3", "3", "4", "4", "4", "4", "4", "5", "5", "5", "6", "6", "6", "7", "7", "7", "8", "8", "8", "8", "8", "9", "9", "9", "6", "6", "6", "2", "2", "2", "3", "3", "3", "3", "4", "4", "4", "4", "5", "5", "5", "7", "7", "7", "8", "8", "8", "8", "4", "9", "9", "9"),
...4 = c("Survey", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2"),
...5 = c("Julian day", "98", "98", "99", "99", "100", "100", "100", "100", "101", "101", "101", "101", "112", "102", "102", "102", "103", "104", "104", "105", "105", "105", "107", "107", "107", "107", "107", "111", "118", "118", "112", "112", "112", "115", "115", "115", "115", "115", "117", "117", "117", "118", "119", "119", "120", "120", "120", "123", "123", "124", "125", "126", "126", "126", "128", "131", "131", "131"),
`POND DATA` = c("Pond", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "17", "18", "19", "2", "31", "4", "8", "7", "6", "5", "9", "10", "11", "12", "15", "14", "16", "21", "20", "22", "23", "26", "32", "27", "13", "29", "30", "28"),
...7 = c("Gewässer Typ", "BüffelOverg", "BüffelOverg", "BüffelOverg", "Artificial", "Natural", "BüffelOverg", "BüffelOverg", "Büffel", "NaturalStream", "NaturalStream", "NaturalBüffel", "Natural", "Artificial", "Flooded", "GrabenFlooded", "NaturalStream", "NaturalStream", "Natural", "Tränke", "Artificial", "Flooded", "Artificial", "Büffel", "Natural", "NaturalBüffel", "Büffel", "Büffel", "NaturalBüffel", "Natural", "NaturalBüffel", "NaturalStream", "Natural", "Tränke", "BüffelOverg", "BüffelOverg", "Artificial", "Büffel", "BüffelOverg", "BüffelOverg", "Natural", "Natural", "BüffelOverg", "NaturalBüffel", "Natural", "GrabenFlooded", "Flooded", "NaturalStream", "Flooded", "Artificial", "Artificial", "Büffel", "Büffel", "Büffel", "Büffel", "Artificial", "Natural", "NaturalBüffel", "NaturalBüffel"),
...8 = c("Longitud", "302127", "302118", "302169", "302491", "301270", "301191", "300423", "300312", "349762", "349747", "349690", "349131", "349405", "359034", "358290", "358353", "330880", "330107", "330225", "341994", "342026", "342166", "362626", "362836", "362865", "362946", "362981", "377907", "379119", "377809", "330883", "330111", "330220", "302120", "302104", "302491", "300309", "300423", "301193", "301279", "349764", "349763", "3499686", "349128", "358282", "359041", "358358", "342026", "341997", "342172", "362634", "362958", "362879", "362969", "349407", "379119", "377806", "377891"),
...9 = c("Latitud", "5092494", "5092491", "5092591", "5092446", "5080893", "5080904", "5081256", "5081306", "5123415", "5123762", "5123840", "5123719", "5123665", "5109048", "5109554", "5109197", "5134272", "5134250", "5134332", "5085805", "5085861", "5085601", "5096887", "5097251", "5097501", "5097343", "5097605", "5110035", "5109662", "5109625", "5134277", "5134251", "5134331", "5092490", "5092491", "5092446", "5081308", "5081261", "5080900", "5080894", "5123414", "5123750", "5123838", "5123723", "5109556", "5109081", "5109200", "5085854", "5085800", "5085579", "5096879", "5097361", "5097508", "5097609", "5123662", "5109662", "5109625", "5110034"),
...10 = c("Observation", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "Substitut of Pond 1", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "Substitut of Pond 25", NA, NA, NA, NA, NA),
OCCURRENCE = c("L. vulgaris", "0", "0", "0", "1", "0", "1", "0", "0", "0", "1", "1", "1", "0", "0", "1", "0", "1", "0", "0", "0", "1", "0", "0", "1", "1", "0", "1", "1", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "1", "1", "1", "1", "1", "1", "1", "0", "0", "0", "0", "1", "0", "0", "0", "1", "1", "0", "0", "0"),
...12 = c("T. cristatus", "0", "0", "0", "1", "0", "1", "0", "0", "0", "1", "1", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "1", "0", "0", "1", "1", "0", "1", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"),
`WOODPASTURE LEVEL DATA` = c("Exposition", "0.5", "34", "0.33", "0.38", "189", "75", "53", "80", "327", "335", "354", "347", "342", "318", "166", NA, "339", "305", "344", "15", "36", "66", "29", "353", "324", "350", "358", "306", "296", "330", "10", "289", "2", "24", "32", "58", "106", "81", "90", "106", "340", "338", "16", "66", "135", "308", "215", "3", "337", "56", "6", "265", "337", "358", "290", "328", "3", "339"),
...14 = c("Cattle", "1", "1", "1", "1", "1;2", "2", "2", "2", "1;3", "2", "2;3", "2;3", "1,3,4", "2;3", "2;3", "3", "1", "1", "1", "1;2;3", "1;3", "1;3", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "3", "1;2;3", "1;2;3", "1", "1", "1", "1", "1", "1", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "1", "1;2;3", "1;2;3", "1;2;3", "2", "1;3", "1;3", "1;3", "1;3", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "1;2;3", "1;3, 4;5", "2;3; 5", "2;3;5", "2;3;5"),
...15 = c("Grazing", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "0", "0", "1", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "1", "0", "0", "0", "1"),
`ABIOTIC CONDITIONS` = c("Weather", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "SunnyWindy", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "PartCloudy", "Cloudy", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "PartCloudy", "PartCloudy", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "Cloudy", "Sunny", "Sunny", "Sunny", "Sunny", "Sunny", "PartCloudy", "PartCloudy", "PartCloudy"),
...17 = c("AvgGroundT", "15.3", "13.75", "16.6", "17.9", "14.06", "21.2", "23.4", "23.4", "21.82", "24.063", "20.65002", "14.53", "8.9982", "22.364", "19.25", "20.32", "21.566", "24.82", "21.8", "24.66", "20.13", "18.996", "23.895", "22.58332", "26.668", "23.16", "23.42", "17.469", "17.797", "20.94", "19.92", "15.367", "16.7", "16.21", "18.85001", "18.7", "18.969", "15.13", "16.92", "16.2", "14.217", "17.42", "16.563", "15.9", "13.42", "15.95001", "15.4", "17.94", "23.364", "25.85", "21.5", "19", "23.44", "26.969", "22.566", "18.32", "19.098", "16.05" ),
...18 = c("AvgWaterT", "18.848", "16.598", "12.568", "14.65", "13.867", "16.65002", "27.266", "24.395", "24.24", "22.42", "20.08336", "19.766", "9.7989", "17.867", "22.38329", "22.51", "21.797", "25.2", "16.82", "15.9", "26.864", "18.74", "23.32", "25.16", "25.598", "24.168", "24.71", "18.668", "22.8", "22.566", "17.3", "22.01", "15.73", "17.516", "18.867", "19.598", "17.32", "20.168", "15.568", "13.467", "19.66", "17.266", "11.967", "19.969", "19.7", "20.01", "14.766", "20.8", "14.666", "15.63", "24", "21.2", "29.098", "28.51", "15.568", "27", "22.92", "21.469"),
...19 = c("HumidityMin", NA, NA, NA, NA, "41", "28.89", "32.65", "26.66", "15.91", "31.58", NA, "38.89", "38.84003", "30.76", "20.27", "27.3", "31.9", "28.45", "33.36", "26.22", "25.39", "31.32", "27.75", "17.07", "23.38", "22.06", "26.64", "32.02003", "40.227", "35.67", "26.12", "21.44", "18.01002", "52.43", "40.43", "39.32", "48.82", "51.11", "43.22", "20.34", "37.64", "28.83", "37.46", "15.63", "27.61", "31.56", "38.17", "36.73", "30.77", "39.94", NA, "38.82", "32.27003", "26.32", "44.82", "25.17", "27.91", "30.75"),
...20 = c("HumidityMax", NA, NA, NA, NA, "42.49", "31.23", "35.95003", "31.94", "20.26002", "33.85", NA, "40.797", "93.35", "37.547", "23.38", "35.09003", "37", "32.367", "37.22", "28.75", "27.85", "33.99", "33.04", "22.09", "28.11", "26.7", "33.09003", "38.21", "45.71", "41.55", "30.66", "24.21", "19.57", "57.47", "45.82", "49.66", "52.08", "53.5", "52.02", "27.53", "45.46", "32.03", "41.66", "20.76", "30.16", "35.477", "45.64", "42.8", "32.49", "46.12", NA, "45.17", "37.657", "30.42", "48.88", "27.92", "32.89", "34"),
...21 = c("AvgWaterDepth(m)", "8.56E-2", "0.11166", "0.08", "0.2984", "0.18", "0.23669", "0.17667", "5.2999E-2", "8.6656E-2", "0.2681", "0.2132", "0.24", "0.45", "5.33E-2", "0.11", "4.6669E-2", "0.38", "0.03", "0.283", "0.8377", "6.325E-2", "0.5232", "0.141", "0.105", "0.13", "0.1134", "0.17", "0.15665", "0.06", "0.09", "0.40662", "0.08", "0.2631", "9.51E-2", "0.1033", "0.38", "5.33E-2", "0.3236", "0.36664", "0.1933", "0.125", "0.28668", "0.24167", "0.21667", "8.343E-2", "5.6671E-2", "3.6667E-2", "5.33E-2", "0.53663", "0.64", "7.334E-2", "0.16", "7.334E-2", "0.1633", "0.51", "7.334E-2", "7.07E-2", "0.12"),
`POND GEOMETRY` = c("Pond area (m²)", "15.16248", "9.42", "20.43649", "6.44", "9.210328", "13.065", "10.56", "10.199", "92.71", "161.477", "21.82503", "20.16", "10.199", "1.41", "18.195", "10.353", "15.21", "0.554", "4.625701", "14.28", "8.25", "15.3", "18.7209", "4.5449", "8.19", "141", "48.09747", "6.24", "143.26731", "21.295", "12.3354", "1.2236", "4.625701", "32.61624", "23.96544", "9.244797", "11.61759", "86.43", "22.263", "11.56548", "102.4", "158.3583", "70.60595", "16.6567", "9.179393", "2.1461", "3.133", "1.75", "11.7478", "19.27261", "1.3", "63.999066671", "21.11401", "46.94689", "10.4", "36.19109", "6.1875", "4.83"),
...23 = c("Pond size (m³)", "1.2888124999", "1.051901", "1.634919", "1.921269", "1.657859", "3.092054", "1.865601", "0.54057", "8.034859", "43.329661667", "4.656006", "4.8384", "4.59", "7.4673E-2", "2.001452", "0.4831401", "5.779807", "1.651E-2", "1.2951962", "11.95712", "0.52246", "8.0067", "2.6209263", "0.4772245", "1.0647", "15.98", "8.1765749997", "0.97751", "8.5960381", "1.916639", "5.0163959994", "9.788803E-2", "1.218100", "3.0985421668", "2.4764312", "3.5130239997", "0.619605323", "27.94576", "8.163464", "2.235994", "12.8", "45.396074664", "17.06311", "3.608954", "0.7649502", "0.121618", "0.114889", "9.324E-2", "6.3046526658", "12.334464001", "9.539E-2", "10.239850667", "1.54836", "7.6679936668", "5.304003", "2.6540141", "0.4331254", "0.5796"),
`POND BIOTIC PARAMETERS` = c("Herbs<30cm", "52.5", "52.5", "55", "46", "48", "35", "51", "53", "25.5", "25", "52.5", "54", "37", "60", "48.5", "61", "65", "75", "12", "7", "25", "40", "50", "46", "38", "55", "25", "55", "27", "51", "61", "66", "12", "69.5", "60.5", "25", "44", "50", "53", "48", "39", "47", "38.5", "65", "50", "40", "62", "40", "6", "12", "10", "40", "35", "8", "41", "20", "65", "40"),
...25 = c("Herbs40-80cm", "29", "10", "15", "15", "0", "20", "6", "1", "8.5", "5", "5.5", "1", "3", "20", "15", "0", "1", "7", "2", "29", "0", "0", "2", "26.5", "12", "0", "0", "0", "0", "3", "1", "8", "2", "8", "6", "7", "1", "4", "7", "0", "6", "0", "5.5", "2", "25", "48", "4", "1", "1", "1", "0", "0", "1", "0", "2", "0", "2", "0"),
...26 = c("Herbs>90cm", "1", "0", "0.5", "1", "0", "0", "0", "0", "5", "0", "1.5", NA, "0", "3", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"), ...27 = c("Woody<2m", "0", "0", "0", "3", "2", "0", "0", "0", "0", "0", "2.5", "0", "0", "0", "2", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "2", "0", "2", "8.5", "0", "0", "0", "1", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0" ),
...28 = c("Woody>2m", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "7.5", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"),
...29 = c("Dry_leaves", "0", "0", "0", "0", "0", "0", "0", "7", "0", "0", "1", "2", "15", "1", "5", "2", "0", "0", "0", "2", "0", "0", "1", "0", "0", "1", "0", "0", "0", "0", "0", "1", "0", "0.5", "0", "0", "5", "0", "0", "0", "0.5", "1", "0.5", "0", "5", "0", "1", "0", "0", "0", "0", "0", "0", "0", "20", "0", "1", "0"),
...30 = c("Rock_trunks", "0", "0", "0", "0", "0", "0", "0", "0", "2.5", "0", "1.5", "0", "5", "0", "0.5", "0", "0", "0", "1", "3", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "1", "0", "0", "4", "0", "0", "0", "0", "4.5", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", "0", "0", "0"),
...31 = c("Bare soil", "0", "0", "2", "10", "7", "5", "3", "9", "1", "0", "5.5", "3", "5", "8", "4", "12", "3", "13", "70", "27", "35", "22", "7", "7.5", "15", "17", "35", "15", "13", "6", "5", "12", "70", "2.5", "1.5", "34", "6", "2", "5", "7", "1.5", "0", "2", "17", "1", "6", "20", "52", "72", "42", "85", "28", "18", "37", "7", "19", "10", "30" ),
...32 = c("Herbs<30cm", "1.5", "3.5", "0.5", "3", "0", "7", "12", "15", "12.5", "0", "1", "1", "0", "1", "5", "4", "6", "1", "5", "0", "3", "13", "4", "1.5", "1", "3", "0", "15", "20", "10", "6", "1", "5", "7.5", "4.5", "3", "20", "10", "2", "0", "3", "1", "0.5", "1", "2", "0", "5", "0", "0", "12", "0", "2", "5", "1", "1", "4", "9", "2"),
...33 = c("Herbs40-80cm", "3", "16", "5.5", "0", "0", "5", "0", "0", "2", "10", "5.5", "3", "0", "0", "0.5", "0", "1", "0", "0", "0", "0", "5", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "4", "6.5", "1", "0", "0", "10", "0", "0", "10", "7.5", "1", "5", "0", "0", "0", "0", "2", "0", "0", "0", "0", "0", "0", "0", "0"),
...34 = c("Herbs>90cm", "0", "0", "0", "0", "0", "0", "0", "0", "2", "0", "0", "15", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "1", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", NA), ...35 = c("Rock_trunks", "0", "0", "0", "2", "2", "0", "0", "0", "10", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "2", "0", "0", "0", "0", "5", "0", "0", "0", "2", "13", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"),
...36 = c("Floating", "3.5", "2.5", "1.5", "10", "3", "7", "1", "15", "26.5", "28", "3", "5", "15", "1", "3.5", "1", "2", "0", "1", "1", "1", "0", "1", "3.5", "12", "3", "0", "5", "0", "0", "0", "0", "1", "3.5", "13.5", "5", "0", "1", "3", "3", "38.5", "2", "2", "3", "2", "0", "0", "0", "1", "3", "0", "0", "0", "0", "12", "2", "1", "0"),
...37 = c("Submerged", "1", "4.5", "3.5", "0", "5", "7", "1", "0", "0", "38", "15.5", "8", "10", "1", "10.5", "1", "4", "2", "0", "0", "0", "20", "1", "12", "5", "0", "0", "15", "0", "7", "3", "1", "0", "7.5", "2", "1", "24", "0", "20", "5", "20", "27", "19", "4", "0", "0", "1", "0", "0", "6", "0", "0", "0", "0", "26", "0", "0", "0" ),
...38 = c("water", "8.5", "11", "16.5", "10", "30", "18", "26", "0", "4.5", "22", "18.5", "16", "15", "5", "5.5", "19", "17", "2", "9", "29", "36", "0", "34", "3", "16", "20", "40", "10", "40", "23", "22", "8", "9", "0", "11.5", "15", "0", "33", "0", "30", "2", "10", "17.5", "7", "10", "6", "6", "7", "20", "25", "5", "30", "40", "54", "0", "55", "12", "28")
)
My code
y<-Newtdata[11:12]
siteCovs<-Newtdata[1:10, 14:15]
obsCovs<-Newtdata[16:38]
umf<-unmarkedFrameOccu(y = y, siteCovs = siteCovs, obsCovs = obsCovs)
I get this error:
Error: Incorrect number of rows in obsCovs data frame
I really can't figure out what it means. The number of rows for the columns I called obsCovs is the same as the rest of the table, I tried shrinking them or putting less columns but I keep getting the same error! There's probably an easy solution but I couldn't find anything around the internet for it. Thank you in advance for reading this far :)
UPDATE!
I've tried, unsucessfully, to split up my data into 3 sheets as follows:
SiteCovariatesDF<-as.data.frame(SiteCovariates)
ObservationCovariatesDF<-as.data.frame(ObservationCovariates)
OccurenceMatrix<-as.matrix(Occurrence)
y<-Occurrence
siteCovs<-SiteCovariatesDF
obsCovs<-ObservationCovariatesDF
I still get the same error.
Share Improve this question asked Nov 20, 2024 at 11:23 Leonardo VillaLeonardo Villa 11 Answer
Reset to default 0I've never used the unmarked
package but I hope this can help.
Part of the issue is that the column headers are in the first row of data - the very first row of the file just contains some meta-titles. I recommend addressing this when you first import the file, for example using readr::read_csv("filename.csv", skip = 1)
which would skip the first row. You should end up with a data.frame
in this format:
DataID | OriginalDataID | WP | ... |
---|---|---|---|
1 | 1 | 2 | ... |
... | ... | ... | ... |
If you run help(unmarkedFrameOccu)
, the documentation will tell you that if obsCovs
is a data.frame
(like in your case), it should have RxJ number of rows, where R are the rows of y
(sites) and J are the columns of y
(sampling periods per site). Your y
has 2 columns and 58 rows, so the package is expecting obsCovs
to have 116 rows.
So this might either be an issue with the way your data is shaped, or with the way you're using the function.
Side note
Indexing columns by column number (y<-Newtdata[11:12]
) is not a good idea: if the underlying data changes, the code will silently break. Also, it's not very easy to read. I recommend insted explicitly using the column names:
library(dplyr)
y <- Newtdata |> select(`L. vulgaris`, `T. cristatus`)