M = matrix(1:9,3,3)
colnames(M)=c('a','b','c')
Run Code Online (Sandbox Code Playgroud)
假设我有一个矩阵M,列名为'a','b','c'.我想删除名字,以便M
M [,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
Run Code Online (Sandbox Code Playgroud)
而不是
a b c
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
Run Code Online (Sandbox Code Playgroud)
我该怎么做呢?
我可以使用以下代码运行一段代码5或10秒:
period <- 10 ## minimum time (in seconds) that the loop should run for
tm <- Sys.time() ## starting data & time
while(Sys.time() - tm < period) print(Sys.time())
Run Code Online (Sandbox Code Playgroud)
代码运行良好5或10秒.但是当我将周期值替换为60以使其运行一分钟时,代码永远不会停止.怎么了?