R语言中的paste函数 1.功能 Concatenate vectors after converting to character. 2.语法结构 paste (..., sep = , collapse = NULL) paste0(..., collapse = NULL) 3.用法实例 (1)生成字符串 paste(1:12) 1 2 3 4 5 6 7 8 9 10 11 12 (2)字符串连接 nth - paste(1:12, c(st, nd, rd, rep(th, 9))) nth 1 st 2 nd 3 rd 4 th 5 th 6 th 7 th 8 th 9 th 10 th 11 th 12 th (3)字符串连接2 ## paste works the same, but separates each input with a space. ## Notice that the recycling rules make every input as long as the longest input. paste(month.abb, is the, nth, month of the year.) Jan is the 1 st month of the year. Feb is the 2 nd month of the year. Mar is the 3 rd month of the year. Apr is the 4 th month of the year. May is the 5 th month of the year. Jun is the 6 th month of the year. Jul is the 7 th month of the year. Aug is the 8 th month of the year. Sep is the 9 th month of the year. Oct is the 10 th month of the year. Nov is the 11 th month of the year. Dec is the 12 th month of the year. paste(month.abb, letters) Jan a Feb b Mar c Apr d May e Jun f Jul g Aug h Sep i Oct j Nov k Dec l Jan m Feb n Mar o Apr p May q Jun r Jul s Aug t Sep u Oct v Nov w Dec x Jan y Feb z (4)sep的用法 ## You can change the separator by passing a sep argument ## which can be multiple characters. paste(month.abb, is the, nth, month of the year., sep = _*_) Jan_*_is the_*_1 st_*_month of the year. Feb_*_is the_*_2 nd_*_month of the year. Mar_*_is the_*_3 rd_*_month of the year. Apr_*_is the_*_4 th_*_month of the year. May_*_is the_*_5 th_*_month of the year. Jun_*_is the_*_6 th_*_month of the year. Jul_*_is the_*_7 th_*_month of the year. Aug_*_is the_*_8 th_*_month of the year. Sep_*_is the_*_9 th_*_month of the year. Oct_*_is the_*_10 th_*_month of the year. Nov_*_is the_*_11 th_*_month of the year. Dec_*_is the_*_12 th_*_month of the year. (5)collapse ## To collapse the output into a single string, pass a collapse argument. paste0(nth, collapse = , ) 1 st, 2 nd, 3 rd, 4 th, 5 th, 6 th, 7 th, 8 th, 9 th, 10 th, 11 th, 12 th (6)collapse和sep ## For inputs of length 1, use the sep argument rather than collapse paste(1st, 2nd, 3rd, collapse = , ) # probably not what you wanted 1st 2nd 3rd paste(1st, 2nd, 3rd, sep = , ) 1st, 2nd, 3rd (7) ## You can combine the sep and collapse arguments together. paste(month.abb, nth, sep = : , collapse = ; ) Jan: 1 st; Feb: 2 nd; Mar: 3 rd; Apr: 4 th; May: 5 th; Jun: 6 th; Jul: 7 th; Aug: 8 th; Sep: 9 th; Oct: 10 th; Nov: 11 th; Dec: 12 th 不积跬步无以至千里,不积小流无以成江海
任胜利 老师的科技写作 (103) :时态的使用要妥当 http://blog.sciencenet.cn/home.php?mod=spaceuid=38899do=blogid=656933cid=2437830 I left a comment at Ren lao shi’s Blog, and received this homework assignment. I don’t know if I can do a better job than his book, but let me try to add my two cents. (Why me? I was a researcher who wrote papers in English, and I am a freelance English editor who edits about 150 research papers each year.) First, I am a numerical modeler. So when I am ready to write a paper, I have done most of the numerical experiments already. 1. Introduction In the introduction, we often need to cite many publications. Our rules are: 1) use the past tense when a sentence starts with a publication; For example: Ren et al. (2012) noted a dramatic increase in publication by Chinese authors in SCI journals during the 2000s, thanks in part to the cash reward and promotion criteria set by the (Chinese) system. (Sorry, I made up this sentence, and this Ren is not any Ren lao shi at SciNet.) Note that even though the publication is recent, I still use the past tense, “noted.” Note also that I have no authority to make you follow this rule, but from now on you should pay attention to what your colleagues do when you read their papers. 2) use the present tense for a result/fact that remains true today, even though the result/fact was obtained 100 years ago. For example: The Gulf Stream is the most powerful western boundary current on Earth, which was discovered and confirmed by sailors and scientists hundred years ago. 3) use both mixed (say past and present) tenses in one sentence. If you don’t like the sentence I made up in 2), here is one from Wikipedia: European discovery of the Gulf Stream dates to the 1513 expedition of Juan Ponce de León , after which it became widely used by Spanish ships sailing from the Caribbean to Spain. 2. Methodology To describe the methods and data sets used in the paper, we use the present tense. For example: We use the WOA (World Ocean Atlas) data as initial conditions for our experiments. We use satellite data to validate model’s phytoplankton field in the surface layer. 3. Results We use the present tense to describe all our (finished) experiments. If you prefer to use the past tense, it is fine as long as you do so consistently. Do not switch from the past tense to the present tense randomly. 4) Discussion and Conclusion We tend to use the present perfect tense, such as “We have shown,” but again one can use the past tense or the present tense. Just be consistent. I hope this helps. ps. You may al so want to che ck this out: Scientific Writing for Beginners (1)-(8) by Zuojun Yu using this link: http://blog.sciencenet.cn/home.php?mod=spaceuid=306792do=blogid=432195