如何解决如何创建间隔为1分钟的28小时制的表格?
我对使用循环不是很熟悉。我正在尝试创建一个像这样的表: 00:00 00:01 00:02 ... 27:58 27:59 28:00
用于运行到第二天的数据,但仍被认为是原始日期的一部分。
我尝试过:
hh<-c(seq('00','28',1))
mm<-c(seq('01','60',1))
for (i in (1:29)) {
int<-paste(hh[i],":",mm)
}
View(int)
但它只会将第1到60分钟粘贴到第28小时: only the 28th hour
我希望这比我想像的要简单,我不知道如何使用sapply或lapply来做到这一点。感谢您的帮助。
解决方法
您可以在if([annotation isKindOfClass:[meetupAnn class]]) {
static NSString *identifier = @"currentLocation";
MKAnnotationView *pulsingView = (MKAnnotationView *)[self.friendsMapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if(pulsingView == nil) {
pulsingView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
pulsingView.displayPriority = MKFeatureDisplayPriorityRequired;
pulsingView.canShowCallout = YES;
pulsingView.image = [UIImage imageNamed:@"meetupbeacon.png"];
NSLog(@"Location Returned");
} else {
pulsingView.displayPriority = MKFeatureDisplayPriorityRequired;
// TODO: Do map pin initial setup.
}
}
的帮助下完成此操作:
outer
times <- c(t(outer(sprintf('%02d',0:27),sprintf('%02d',0:59),paste,sep = ":")))
#add the last time manually
times <- c(times,'28:00')
head(times,8)
#[1] "00:00" "00:01" "00:02" "00:03" "00:04" "00:05" "00:06" "00:07"
tail(times,8)
#[1] "27:53" "27:54" "27:55" "27:56" "27:57" "27:58" "27:59" "28:00"
将0附加到一个数字后,而我们将sprintf
每小时(0至27)添加到每分钟(0至59)。
这也对我有用:
hh<-c(seq('00','28',1))
mm<-c(seq('00','59',1))
library(stringr)
hh<-str_pad(hh,2,pad="0")
mm<-str_pad(mm,pad="0")
times<-c(sapply(hh,sep=":",mm))
View(times)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。