fan <- function ()
{
v.rates <- c(0.58,0.5,0.57,1,0.67,0.28,0.18,0.14,0.42,0.67,0.21,0.14,
0.1,0.11,0.57,0.07,0.11,0,0.33,0.25,0.05,0,0,0,0.04,0.02,0.01,0,0,0,0.01,
0.02,0,0,0,0.01,0.01,0.02,0,0)
v.cases <- c(7,7,4,4,2,11,18,8,5,2,16,14,11,3,4,
2,3,0,5,1,7,0,0,0,1,6,1,0,0,0,1,6,0,0,0,1,2,1,0,0)
row.names <- c("15-20", "21-25", "26-30, "31-35", "36-40")
col.names <- c("1946-1950", "1951-1955", "1956-1960", "1961-1965",
"1966-1970","1971-1975","1976-1980","1981-1985")
rates <- matrix(data = v.rates, nrow = 5, ncol = 8, byrow = TRUE,
dimnames = list(row.names, col.names))
cases <- matrix(data = v.cases, nrow = 5, ncol = 8, byrow = TRUE,
dimnames = list(row.names, col.names))
return(list(rates = rates, response = cases, dose = cases/rates,
data.format = "AP", age1 = 15, per1 = 1946, coh1 = NULL,
unit = 5, per.zero = NULL, per.max = NULL, time.adjust = 0))
}
运行结果:Error in source("C:\\Users\\Administrator\\Desktop\\fan.R") :
C:\Users\Administrator\Desktop\fan.R:8:47: unexpected numeric constant
7: 2,3,0,5,1,7,0,0,0,1,6,1,0,0,0,1,6,0,0,0,1,2,1,0,0)
8: row.names <- c("15-20", "21-25", "26-30, "31
为什么呢