Я следую этому руководству, чтобы включить R в Microsoft PowerBI, http://radacad.com/power-bi-and-regular-expressions
Используя свои собственные данные
Я понимаю, как
# 'dataset' holds the input data for this script
pattern <- "[[:digit:]]{2}[[:alpha:]]{1}[[:digit:]]{3}"
isValid <- function(x) {grepl(pattern , as.character(x), ignore.case=TRUE)}
output <- within(dataset,{Building=isValid(dataset$GROUP_NAME)})
Переводит на это

Но как мне распечатать соответствующую строку, т. Е. 02M477
, 08X048
и т. Д.
Я пытался
# 'dataset' holds the input data for this script
pattern <- "[[:digit:]]{2}[[:alpha:]]{1}[[:digit:]]{3}"
isValid <- function(x) {grep(pattern , as.character(x), ignore.case=TRUE, value=TRUE)}
output <- within(dataset,{Building=isValid(dataset$GROUP_NAME)})
И я ожидаю

Все же я получаю следующую ошибку ... как исправить?
DataSource.Error: ADO.NET: R script error.
Error in `[<-.data.frame`(`*tmp*`, nl, value = list(Building = c("Madison\\Manual\\02M477-Shift Stick", :
replacement element 1 has 760 rows, need 768
Calls: within -> within.data.frame -> [<- -> [<-.data.frame
Execution halted
Details:
DataSourceKind=R
DataSourcePath=R
Message=R script error.
Error in `[<-.data.frame`(`*tmp*`, nl, value = list(Building = c("Madison\\Manual\\02M477-Shift Stick", :
replacement element 1 has 760 rows, need 768
Calls: within -> within.data.frame -> [<- -> [<-.data.frame
Execution halted
ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException