Skip to content

Commit

Permalink
fixing data_type
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlball committed Feb 27, 2018
1 parent 12bfb71 commit fe0ded5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions server/lib/analysis_library/r/doe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,7 @@
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# *******************************************************************************

module AnalysisLibrary::R
class String
def is_number? string
true if Float(string) rescue false
end
end

module AnalysisLibrary::R
class Doe
def initialize(r_session)
@r = r_session
Expand Down Expand Up @@ -255,9 +249,14 @@ def full_factorial(selected_variables, number_of_samples)
samples_temp = @r.converse 'fac_design'
logger.info("samples_temp is #{samples_temp}")

def is_number? string
true if Float(string) rescue false
end

selected_variables.each_with_index do |var, idx|
if samples_temp[idx][0].is_number?
samples[var.id.to_s] = samples_temp[idx].to_f
if is_number?(samples_temp[idx][0])
#samples[var.id.to_s] = samples_temp[idx].to_f
samples[var.id.to_s] = samples_temp[idx].map {|i| i.to_f}
else
samples[var.id.to_s] = samples_temp[idx]
end
Expand Down

0 comments on commit fe0ded5

Please sign in to comment.