-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCategoryF.R
More file actions
44 lines (23 loc) · 805 Bytes
/
CategoryF.R
File metadata and controls
44 lines (23 loc) · 805 Bytes
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
## CategoryF.R ##
#' @export
#'
##############################################
## Author Information ##
# * Author: E.Frolli
# * Orginization: Univeristy of Texas Marine Science Institute
# * Contact: frolli.erin@utexas.edu
# * Date: 19 Jun 2017
##############################################
## The Code ##
CategoryF <- function (CategoryName,CategoryNum){
# create the Category vector
Category = c()
# fill the vector with repeated values in order of the data set
for (i in 1:length(CategoryName)){
Category2 = c(rep(CategoryName[i],CategoryNum[i]))
Category = c(Category,Category2)
}
Category = as.factor(Category)
# Return the data
return(Category)
}