Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

問題

如何知道要使用的 RxTextData 函式 ' |' 做為分隔符號或其他字元?

方案

如果您的文字資料不以逗號或 tab 字元分隔的您必須指定使用 columnDelimiters 引數的分隔符號。(這是不實際的引數至 rxImport,而在基礎的 RxTextData 資料來源物件。)在一般的用法中,此引數是單一字元,例如 columnDelimiters ="\t"tab 字元分隔的資料或 columnDelimiters =","以逗號分隔的資料。不過,每個資料行可能會以不同的字元; 分隔所有分隔符號必須都串連成單一字元字串的在一起。例如,如果您有一個分隔的資料行的逗號、 正號,並在新行第三個第二個,您可以使用引數 columnDelimiters =",+ \n"。

識別碼 | val

1 |
2 | b

因此上述的資料如何修正程式碼,考慮下面 ' |' 做為分隔符號

hdfsFS <- RxHdfsFileSystem(hostName=”dummy ", port="dummy") txtSource <- RxTextData("directory value/ file_name in hdfs", fileSystem=hdfsFS) 
airData <- rxImport(inData=txtSource, outFile = "/tmp/test.xdf",stringsAsFactors = TRUE, missingValueString = "M", rowsPerRead = 200000, overwrite=TRUE) 
rxSummary(~ id+val, data = airData)



2)。 能夠讀取管道'-分隔的資料,您必須設定選項 ' 分隔符號 ="|"' RxTextData() 呼叫中︰

txtSource <- RxTextData(("directory value/ file_name in hdfs", fileSystem=hdfsFS, delimiter = "|")

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×