Character Type क्या है
Character values text के pieces हैं, जैसे words या sentences, quote marks के अंदर लिखे गए। ये वह तरीका हैं जिससे R names और messages रखता है।
In this page:
Syntax
text <- "some text"
class(text) # "character"
Character Type
R का character type text strings store करता है, single या double quotes से लिखे गए। कुछ languages के उलट, कोई separate single-character type नहीं है -- एक one-letter string फिर भी character है।
String concatenation और formatting typically एक + operator की बजाय paste() से होते हैं।
Note:
R में Single और double quotes strings के लिए identically काम करते हैं -- एक style चुनें और consistent रहें।
उदाहरण: Character Type
name <- "Ada"
greeting <- 'Hello'
cat(class(name), "\n")
cat(greeting, name, "\n")
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- text के चारों ओर quotes भूल जाना, जैसे
name <- Ada, जोAdaनाम का एक variable ढूंढता है और fail होता है। "a" + "b"जैसे+से strings add करने की कोशिश करना, जो एक error है;paste()इस्तेमाल करें।"Hello'जैसे quotes की एक mismatched pair mix up करना, जो string को unclosed छोड़ देता है।
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: