2017-03-29 21 views
1

現在、ExcelでBERTコンソールをハングアップしようとしていますが、Irisのデータセットの値を変数に格納する単純な機能に問題があります。私はこのようになりますBERTからのサンプルスクリプトを使用しています:bertの変数に列のExcel値を格納する

# 
# Here's an example of using the Excel scripting interface 
# (paste this code into the shell). 
# 
# For more information, see 
# 
# https://bert-toolkit.com/excel-scripting-interface-in-r 
# 

# 
# get a reference to the workbook 
# 
wb <- EXCEL$Application$get_ActiveWorkbook(); 

# 
# add a sheet 
# 
new.sheet <- wb$get_Sheets()$Add(); 

# 
# change the name of the new sheet. note that this will 
# fail if a sheet with this name already exists. 
# 
new.sheet$put_Name("R Data Set"); 

# 
# add some data. use matrices. 
# 
range <- new.sheet$get_Range("B3:F152"); 
range$put_Value(as.matrix(iris)); 

# 
# add column headers 
# 
header.range <- new.sheet$get_Range("B2:F2"); 
header.range$put_Value(t(colnames(iris))); 

# 
# resize columns to fit 
# 
range$get_EntireColumn()$AutoFit(); 

# 
# example of using constants: add border (underline) to headers 
# 
borders <- header.range$get_Borders(); 
border <- borders$get_Item(EXCEL$XlBordersIndex$xlEdgeBottom); 
border$put_Weight(EXCEL$XlBorderWeight$xlThin); 

細胞内の数値の形式が一般的であり、私は値を操作することができるように変数に列Bの値を格納しようとしています。これは私が列Bの値を取得し、列Gに入れためにテストコードです:

col.B <- list("B3:B152"); 
test.input <- new.sheet$get_Range("G3:G152"); 
test.input$put_Value(); 

コマンドラインでの出力がTRUEで、エラーがないが、値が列G.に貼り付けされていません私は間違って何をしていますか?

答えて

0

G列にあなたの最初のコードチャンクを実行した後、セットアップ、コラムBから、このコードをコピーデータを考える:

da_ta <- new.sheet$get_Range("B3:B152")$get_Value() 
new.sheet$get_Range("G3:G152")$put_Value(da_ta) 
関連する問題