exdata <- read.xlsx("123.xlsx", sheetIndex = 1)
id <- exdata$id
id // Class is factor
我已阅读excel中的列,其中包含以下格式的数字
384508338244525230_47603942
384508338244525560_47603114
在&#34; _&#34;之后我不需要这个号码。即47603942我只想省略它以便采取进一步行动。
你可以帮助我在#34; _&#34;之前得到这个号码吗?来自excel coulmn让我也知道解决问题的可能方法
答案 0 :(得分:2)
您可以使用<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var urlList = ['http://www.google.com', 'http://www.msn.com', 'http://www.yahoo.com'];
var wnd;
var curIndex = 0; // a var to hold the current index of the current url
function openWindow(){
wnd = wnd || window.open();
wnd.location.href = urlList[curIndex];
setTimeout(function () {
curIndex++; //increment the index
// If all urls have been showed, close our window instance
if(curIndex < urlList.length) openWindow(); else wnd.close();
}, 2000);
}
openWindow();
</script>
</html>
:
sub
答案 1 :(得分:2)
或者您可以尝试strsplit
id <-c("384508338244525230_47603942", "384508338244525560_47603114 ", "384508338244525560_47603114 ")
id <- as.factor(id)
new_id <- sapply(id, function(str){split <- unlist(strsplit(as.character(str), "_")); return(split[1])})
print(new_id)