From cb1b92e3b30b4d883d6bdbe6c53a39bb7a02fa1d Mon Sep 17 00:00:00 2001 From: Ritika Ravichandra Date: Tue, 14 Jul 2015 08:48:33 -0700 Subject: [PATCH] fix demo - wasn't working before --- demo/demo.R | 4 ++-- maml/R/consume.R | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/demo/demo.R b/demo/demo.R index 7993ad9..a7ac2f7 100644 --- a/demo/demo.R +++ b/demo/demo.R @@ -3,8 +3,8 @@ ##################################################################################################### # IMPORTANT: need to compile all of consume, discover, publish functions before running this demo -setwd("C://Users/t-alewa/Documents/Azure-MachineLearning-ClientLibrary-R/demo") -#setwd("C://Users/t-ritra/Github/Documents/Azure-MachineLearning-ClientLibrary-R/demo") +# setwd("C://Users/t-alewa/Documents/Azure-MachineLearning-ClientLibrary-R/demo") +setwd("C://Users/t-ritra/Documents/Github/Azure-MachineLearning-ClientLibrary-R/demo") # test server diff --git a/maml/R/consume.R b/maml/R/consume.R index ca51b83..cc68e9a 100644 --- a/maml/R/consume.R +++ b/maml/R/consume.R @@ -100,7 +100,7 @@ consumeDataTable <- function(api_key, requestURL, columnNames, ..., globalParam= #make api call with components of payload results <- callDTAPI(api_key, requestURL, columnNames, valuesList, globalParam, retryDelay) results <- jsonlite::fromJSON(results) - + resultValues = results$Results$output1$value # Previous lines were commented out, would not return correctly if there were multiple return values #resultDF <- data.frame(resultList[,(ncol(resultList))]) @@ -187,15 +187,15 @@ consumeDataframe <- function(api_key, requestURL, valuesDF, globalParam=setNames resultStored <- jsonlite::fromJSON(temp) resultList = resultStored$Results$output1$value$Values resultDF <- data.frame(resultList[,(ncol(resultList))]) -# print(resultDF) -# print(is.data.frame(resultDF)) + # print(resultDF) + # print(is.data.frame(resultDF)) if(length(df) != 0 && length(resultDF) != 0) { names(df) <- names(resultDF) } df <- rbind(df,resultDF) colnames(df) <- "Scored probabilities" -# print("passed") + # print("passed") print(sprintf("%i %s %i %s", i,"out of",length(values),"processed")) valuebatch = list() counter = 0 @@ -204,10 +204,10 @@ consumeDataframe <- function(api_key, requestURL, valuesDF, globalParam=setNames } colnames(df) <- "Scored probabilities" return(df) -# resultStored <- jsonlite::fromJSON(resultStored) -# resultDF <- data.frame(matrix(resultStored$Results$output1$value$Values)) -# colnames(resultDF) <- resultStored$Results$output1$value$ColumnNames -# return(resultDF) + # resultStored <- jsonlite::fromJSON(resultStored) + # resultDF <- data.frame(matrix(resultStored$Results$output1$value$Values)) + # colnames(resultDF) <- resultStored$Results$output1$value$ColumnNames + # return(resultDF) }