我有以下文本文件:
SELECT MONTH(CURRENT DATE), -- returns 10
CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS, --return first day of current month
CASE WHEN
MOD(MONTH(CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS), 3) = 0
THEN 3
ELSE MOD(MONTH(CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS), 3)
END, --months into the quarter, so 1 for first month, 2 for second month, 3 for last month
CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS +
(4 - CASE WHEN
MOD(MONTH(CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS), 3) = 0
THEN 3
ELSE MOD(MONTH(CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS), 3)
END) MONTHS, --returns first day of next quarter
CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS +
(4 - CASE WHEN
MOD(MONTH(CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS), 3) = 0
THEN 3
ELSE MOD(MONTH(CURRENT DATE - (DAY(CURRENT DATE) - 1) DAYS), 3)
END) MONTHS
- 1 DAY -- returns last day of current quarter
FROM SYSIBM.SYSDUMMY1
标题后面的列继续。我想阅读ENTERED: m
TAG TIME: 06/14/13 16:49:53
DEPLOYED: 06/27/12 07:40:25
TAG DELAY DAYS: 0
INIT COUNTER: 460 AM
COM TIME: 03/29/00 01:17:06
COM DELAY DAYS: 0
0 33
1 33
2 129
3 44
4 129
5 5
列,所以我打电话给:
as.numeric
并获得以下错误:
tag.raw <- read.table("tag612.txt", col.names = c("index", "light"), header =
FALSE, skip = 10, colClasses = rep("numeric", 2))
当我省略Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
scan() expected 'a real', got '03/29/00'
时,文件的读取没有问题,但两列都被读作因子。什么是错误,如何读取标题后面的列为整数/数字?