如何用R?
编写这个时间逻辑 while StatusTest('CSV', Short, username, ItemID, token)['status']!='completed':
if StatusTest('CSV', Short, username, ItemID, token)['status'] == 'failed':
print "CSV upload failed"
break
time.sleep(5)
print ("Processing CSV")
这是我尝试过的:
while (accepted != 'completed'){
URL <- paste('http://',short,'.maps.arcgis.com/sharing/rest/content/users/',username,'/items/',ItemID,'/status?f=json&token=',token,sep = "")
x <- getURL(URL)
x <- fromJSON(((x)))
accepted<-x$statusMessage
print(accepted)
}
但没有time.sleep
和break
,我真的不知道怎么做R
答案 0 :(得分:2)
您可能想要使用Sys.sleep(5)
while (accepted != 'completed')
{
URL <- paste('http://',short,'.maps.arcgis.com/sharing/rest/content/',username,'/items/',ItemID,'/status?f=json&token=',token,sep = "")
x <- getURL(URL)
x <- fromJSON(((x)))
accepted<-x$statusMessage
Sys.sleep(5)
print(accepted)
}