Great, thanks all for your help!
I'm currently trying to use merge_design.covariates with one dataframe of precipitation data. Again, I have 4 separate elevations that I'm interested in, so I have cumulative precipitation (in mm) for each elevation of interest across the season, collected using rain gauges. The dataframe for my precipitation data looks like this:
- Code: Select all
> str(precipit)
'data.frame': 292 obs. of 5 variables:
$ Date : Factor w/ 73 levels "5/18/2019","5/19/2019",..: 1 2 3 4 5 6 7 8 9 10 ...
$ site : Factor w/ 2 levels "BEF","JEFF": 1 1 1 1 1 1 1 1 1 1 ...
$ elevation: int 281 281 281 281 281 281 281 281 281 281 ...
$ precip : num 1.2 0 19.7 0 0 0 4.2 0 2.2 0 ...
$ time : int 1 2 3 4 5 6 7 8 9 10 ...
And for my nest survival data, is as such:
- Code: Select all
> str(nestdata1)
'data.frame': 32 obs. of 9 variables:
$ NestID : Factor w/ 33 levels "","BEFDK2","BEFHT6",..: 19 4 9 18 32 17 21 13 24 12 ...
$ FirstFound : int 11 12 8 1 17 13 25 21 21 32 ...
$ LastPresent: int 19 18 22 24 26 26 30 26 26 32 ...
$ LastChecked: int 22 24 25 27 28 28 30 31 31 32 ...
$ Fate : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 1 2 2 1 ...
$ Year : Factor w/ 3 levels "2016","2018",..: 1 3 2 1 3 3 1 3 3 2 ...
$ elevation : int 577 329 746 638 730 869 779 567 881 1094 ...
$ AgeFound : int 5 5 5 8 2 6 11 18 17 27 ...
$ NestAge : int -6 -7 -3 7 -15 -7 -14 -3 -4 -5 ...
I'm getting an error when I'm running the code that was given in the example in the last post:
- Code: Select all
> nestdata1.pr<- process.data(nestdata1, nocc=59, model="Nest")
> nestdata.ddl=make.design.data(nestdata1.pr)
> #by precip
> nestdata.ddl$S=merge_design.covariates(nestdata.ddl$S, precipit) #getting errors
Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length
I'm thinking this is because of the way I have my precipitation dataframe organized/structured. I'm unsure of how to proceed. I thought I should make each elevation its own column, because currently, this is how my data is loaded in the dataframe:
Date site elevation precip time
5/18/2019 BEF 281 1.2 1
5/19/2019 BEF 281 0.0 2
5/20/2019 BEF 281 19.7 3
5/21/2019 BEF 281 0.0 4
5/22/2019 BEF 281 0.0 5
5/23/2019 BEF 281 0.0 6
5/24/2019 BEF 281 4.2 7
5/25/2019 BEF 281 0.0 8
5/26/2019 BEF 281 2.2 9
5/27/2019 BEF 281 0.0 10
5/28/2019 BEF 281 0.1 11
5/29/2019 BEF 281 0.0 12
5/30/2019 BEF 281 0.0 13
5/31/2019 BEF 281 0.0 14
6/1/2019 BEF 281 0.0 15
6/2/2019 BEF 281 0.6 16
6/3/2019 BEF 281 3.6 17
6/4/2019 BEF 281 0.0 18
6/5/2019 BEF 281 4.3 19
6/6/2019 BEF 281 13.1 20
6/7/2019 BEF 281 0.0 21
6/8/2019 BEF 281 0.0 22
6/9/2019 BEF 281 0.0 23
6/10/2019 BEF 281 0.0 24
6/11/2019 BEF 281 24.5 25
6/12/2019 BEF 281 0.0 26
6/13/2019 BEF 281 4.3 27
6/14/2019 BEF 281 0.7 28
6/15/2019 BEF 281 0.0 29
6/16/2019 BEF 281 0.0 30
6/17/2019 BEF 281 0.0 31
6/18/2019 BEF 281 0.0 32
6/19/2019 BEF 281 0.0 33
6/20/2019 BEF 281 27.1 34
6/21/2019 BEF 281 2.1 35
6/22/2019 BEF 281 0.0 36
6/23/2019 BEF 281 0.0 37
6/24/2019 BEF 281 0.0 38
6/25/2019 BEF 281 14.8 39
6/26/2019 BEF 281 6.0 40
6/27/2019 BEF 281 2.4 41
6/28/2019 BEF 281 0.0 42
6/29/2019 BEF 281 0.0 43
6/30/2019 BEF 281 6.9 44
7/1/2019 BEF 281 0.1 45
7/2/2019 BEF 281 0.0 46
7/3/2019 BEF 281 0.0 47
7/4/2019 BEF 281 0.0 48
7/5/2019 BEF 281 0.0 49
7/6/2019 BEF 281 12.8 50
7/7/2019 BEF 281 0.1 51
7/8/2019 BEF 281 0.0 52
7/9/2019 BEF 281 0.0 53
7/10/2019 BEF 281 0.0 54
7/11/2019 BEF 281 27.6 55
7/12/2019 BEF 281 29.7 56
7/13/2019 BEF 281 0.0 57
7/14/2019 BEF 281 0.0 58
7/15/2019 BEF 281 0.0 59
7/16/2019 BEF 281 0.0 60
7/17/2019 BEF 281 0.0 61
7/18/2019 BEF 281 0.0 62
7/19/2019 BEF 281 0.0 63
7/20/2019 BEF 281 0.0 64
7/21/2019 BEF 281 0.0 65
7/22/2019 BEF 281 1.7 66
7/23/2019 BEF 281 11.6 67
7/24/2019 BEF 281 0.0 68
7/25/2019 BEF 281 0.0 69
7/26/2019 BEF 281 0.0 70
7/27/2019 BEF 281 0.0 71
7/28/2019 BEF 281 0.0 72
7/29/2019 BEF 281 1.4 73
5/18/2019 JEFF 528 0 1
5/19/2019 JEFF 528 6.1 2
5/20/2019 JEFF 528 4.7 3
5/21/2019 JEFF 528 0.7 4
5/22/2019 JEFF 528 0 5
5/23/2019 JEFF 528 0.4 6
5/24/2019 JEFF 528 1.1 7
5/25/2019 JEFF 528 1.1 8
5/26/2019 JEFF 528 6.4 9
5/27/2019 JEFF 528 0 10
5/28/2019 JEFF 528 8.3 11
5/29/2019 JEFF 528 0 12
5/30/2019 JEFF 528 0 13
5/31/2019 JEFF 528 0 14
6/1/2019 JEFF 528 0 15
6/2/2019 JEFF 528 1.9 16
6/3/2019 JEFF 528 0.3 17
6/4/2019 JEFF 528 0 18
6/5/2019 JEFF 528 7.9 19
6/6/2019 JEFF 528 8.3 20
6/7/2019 JEFF 528 0 21
6/8/2019 JEFF 528 0 22
6/9/2019 JEFF 528 0 23
6/10/2019 JEFF 528 0 24
6/11/2019 JEFF 528 5.2 25
6/12/2019 JEFF 528 0 26
6/13/2019 JEFF 528 0.8 27
6/14/2019 JEFF 528 0.2 28
6/15/2019 JEFF 528 0 29
6/16/2019 JEFF 528 0.2 30
6/17/2019 JEFF 528 0 31
6/18/2019 JEFF 528 0 32
6/19/2019 JEFF 528 0 33
6/20/2019 JEFF 528 10.2 34
6/21/2019 JEFF 528 1 35
6/22/2019 JEFF 528 0 36
6/23/2019 JEFF 528 0 37
6/24/2019 JEFF 528 0 38
6/25/2019 JEFF 528 5.2 39
6/26/2019 JEFF 528 2.3 40
6/27/2019 JEFF 528 0.1 41
6/28/2019 JEFF 528 0 42
6/29/2019 JEFF 528 1.6 43
6/30/2019 JEFF 528 6.9 44
7/1/2019 JEFF 528 0 45
7/2/2019 JEFF 528 0 46
7/3/2019 JEFF 528 0 47
7/4/2019 JEFF 528 0 48
7/5/2019 JEFF 528 0 49
7/6/2019 JEFF 528 8.7 50
7/7/2019 JEFF 528 0 51
7/8/2019 JEFF 528 0 52
7/9/2019 JEFF 528 0 53
7/10/2019 JEFF 528 0 54
7/11/2019 JEFF 528 13.8 55
7/12/2019 JEFF 528 4.5 56
7/13/2019 JEFF 528 2.1 57
7/14/2019 JEFF 528 0.3 58
7/15/2019 JEFF 528 0 59
7/16/2019 JEFF 528 0 60
7/17/2019 JEFF 528 2.1 61
7/18/2019 JEFF 528 0 62
7/19/2019 JEFF 528 0 63
7/20/2019 JEFF 528 0 64
7/21/2019 JEFF 528 0 65
7/22/2019 JEFF 528 2.2 66
7/23/2019 JEFF 528 1.9 67
7/24/2019 JEFF 528 0 68
7/25/2019 JEFF 528 0 69
7/26/2019 JEFF 528 0 70
7/27/2019 JEFF 528 0 71
7/28/2019 JEFF 528 5.6 72
7/29/2019 JEFF 528 0.1 73
I'm unsure if I should put each rain gauge (with its respective elevation) into its own column so that this clears up the confusion R is having with my data.
Thanks so much for your time & patience!! I'm teaching myself this and trying to learn, so your help is always appreciated.