R တွင် စာကြောင်းများမှ ကိုးကားချက်များကို ဖယ်ရှားနည်း (နည်းလမ်း 3 ခု)


R ရှိ စာကြောင်းများမှ ကိုးကားချက်များကို ဖယ်ရှားရန် ဘုံနည်းလမ်းသုံးမျိုးရှိသည်။

နည်းလမ်း 1- print() ကိုသုံးပါ

 print(some_strings, quote= FALSE )

နည်းလမ်း 2- noquote() ကိုသုံးပါ

 noquote(some_strings)

နည်းလမ်း 3: cat() ကိုသုံးပါ

 cat(some_strings)

အောက်ပါနမူနာများသည် အောက်ပါ strings များ၏ vector ဖြင့် နည်းလမ်းတစ်ခုစီကို အသုံးပြုပုံကို ပြသသည်-

 #define vector of strings
some_strings <- c("hey", "these", "are", "some", "strings")

#view vector
some_strings

[1] “hey” “these” “are” “some” “strings”

စာကြောင်းများကို မူရင်းအတိုင်း ကိုးကားများဖြင့် ရိုက်နှိပ်ထားကြောင်း သတိပြုပါ။

ဥပမာ 1- print() ကို အသုံးပြု၍ စာကြောင်းများမှ ကိုးကားချက်များကို ဖယ်ရှားပါ

အောက်ဖော်ပြပါ ကုဒ်သည် ကိုးကားထားသော စာကြောင်းများကို ဖယ်ရှားရန်အတွက် print() လုပ်ဆောင်ချက်ကို အသုံးပြုနည်းကို ပြသသည်-

 #print vector of strings without quotes
print(some_strings, quote= FALSE )

[1] hey these are some strings

ဥပမာ 2- noquote() ကို အသုံးပြု၍ စာကြောင်းများမှ ကိုးကားချက်များကို ဖယ်ရှားပါ

အောက်ဖော်ပြပါ ကုဒ်သည် noquote() လုပ်ဆောင်ချက်ကို အသုံးပြု၍ ကိုးကားထားသော စာကြောင်းများကို ပရင့်ထုတ်ရန် နည်းလမ်းကို ပြသသည်-

 #print vector of strings without quotes
noquote(some_strings )

[1] hey these are some strings

ဥပမာ 3- Cat() ကို အသုံးပြု၍ စာကြောင်းများမှ ကိုးကားချက်များကို ဖယ်ရှားပါ

အောက်ဖော်ပြပါ ကုဒ်သည် ကိုးကားဖယ်ရှားထားသော စာကြောင်းများကို ရိုက်နှိပ်ရန် cat() လုပ်ဆောင်ချက်ကို အသုံးပြုပုံကို ပြသသည်-

 #print vector of strings without quotes
cat(some_strings )

hey these are some strings

စာကြောင်းအသစ်တွင် ကိုးကားခြင်းမရှိဘဲ စာကြောင်းတစ်ခုစီကို ပရင့်ထုတ်ရန် \n အငြင်းအခုံကို အသုံးပြုနိုင်သည်။

 #print vector of strings without quotes each on a new line
cat(paste(some_strings, " \n "))

hey 
thesis 
are 
some 
thongs

vector ရှိ စာကြောင်းတစ်ခုစီကို စာကြောင်းအသစ်တွင် ရိုက်နှိပ်ထားကြောင်း သတိပြုပါ။

ထပ်လောင်းအရင်းအမြစ်များ

အောက်ဖော်ပြပါ သင်ခန်းစာများသည် R တွင် အခြားဘုံအလုပ်များကို မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြသည်-

R တွင် string တစ်ခုမှ ဇာတ်ကောင်များကို မည်ကဲ့သို့ ဖယ်ရှားနည်း
R တွင် string တစ်ခုရှိ ဇာတ်ကောင်တည်နေရာကို မည်သို့ရှာရမည်နည်း။
R ရှိ စာကြောင်းများမှ space များကို မည်ကဲ့သို့ ဖယ်ရှားနည်း

မှတ်ချက်တစ်ခုထည့်ပါ။

သင့် email လိပ်စာကို ဖော်ပြမည် မဟုတ်ပါ။ လိုအပ်သော ကွက်လပ်များကို * ဖြင့်မှတ်သားထားသည်