Class: Statsample::Dataset
Overview
Deprecation Warning
This class will soon be replaced by Daru::DataFrame in the next release. Please see the daru docs at github.com/v0dro/daru for more details
Class Method Summary
collapse
Instance Method Summary
collapse
#crosstab, #to_multiset_by_split, #to_multiset_by_split_multiple_fields, #to_multiset_by_split_one_field
Constructor Details
#initialize(vectors = {}, fields = []) ⇒ Dataset
Deprecation Warning
This class will soon be replaced by Daru::DataFrame in the next release. Use Daru::DataFrame.new for the same effect. Please see the daru docs at github.com/v0dro/daru for more details.
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/statsample/dataset.rb', line 62
def initialize(vectors={}, fields=[])
$stderr.puts "WARNING: Statsample::Dataset and Statsample::Vector have been deprecated in favor of Daru::DataFrame and Daru::Vector. Please switch to using that.\n"
if vectors.instance_of? Array
@fields=vectors.dup
super({}, order: @fields.map { |e| e.respond_to?(:to_sym) ? e.to_sym : e })
else
@vectors = {}
vectors.each do |k,v|
@vectors[k.respond_to?(:to_sym) ? k.to_sym : k] = v
end
@fields = fields
super @vectors, order: @fields.map { |e| e.respond_to?(:to_sym) ? e.to_sym : e }
end
end
|
Class Method Details
.crosstab_by_assignation(rows, columns, values) ⇒ Object
Deprecation Warning
This class will soon be replaced by Daru::DataFrame in the next release. Use Daru::DataFrame.crosstab_by_assignation for the same effect. Please see the daru docs at github.com/v0dro/daru for more details.
52
53
54
55
|
# File 'lib/statsample/dataset.rb', line 52
def self.crosstab_by_assignation(rows,columns,values)
ds = super(rows, columns, values)
Dataset.new ds.to_hash
end
|
Instance Method Details
Returns the vector named i
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/statsample/dataset.rb', line 110
def [](i)
$stderr.puts "WARNING: Daru uses symbols instead of strings for naming vectors. Please switch to symbols.\n"
if i.is_a? Range
beg = i.begin.respond_to?(:to_sym) ? i.to_sym : i
en = i.end.respond_to?(:to_sym) ? i.to_sym : i
super(beg..en)
else
super i.to_sym
end
end
|
#[]=(i, v) ⇒ Object
122
123
124
125
126
|
# File 'lib/statsample/dataset.rb', line 122
def []=(i,v)
$stderr.puts "WARNING: Daru uses symbols instead of strings for naming vectors. Please switch to symbols.\n"
super i, v
end
|
#add_case(v, uvd = true) ⇒ Object
91
92
93
|
# File 'lib/statsample/dataset.rb', line 91
def add_case(v,uvd=true)
raise NoMethodError, "Deprecated. Use Daru::DataFrame#add_row instead."
end
|
#add_case_array(v) ⇒ Object
87
88
89
|
# File 'lib/statsample/dataset.rb', line 87
def add_case_array(v)
raise NoMethodError, "Deprecated. Use Daru::DataFrame#add_row instead."
end
|
#add_vector(name, vector) ⇒ Object
83
84
85
|
# File 'lib/statsample/dataset.rb', line 83
def add_vector(name, vector)
raise NoMethodError, "Deprecated. Use Daru::DataFrame#[]= directly."
end
|
40
41
42
43
44
|
# File 'lib/statsample/dataset.rb', line 40
def cases
$stderr.puts "WARNING: Statsample::Dataset and Statsample::Vector have been deprecated in favor of Daru::DataFrame and Daru::Vector. Please switch to using Daru::DataFrame#nrows.\n"
nrows
end
|
#clear_gsl ⇒ Object
129
130
131
|
# File 'lib/statsample/dataset.rb', line 129
def clear_gsl
raise NoMethodError, "This method is no longer needed/supported."
end
|
#each_array ⇒ Object
99
100
101
|
# File 'lib/statsample/dataset.rb', line 99
def each_array
raise NoMethodError, "Deprecated. Use Daru::DataFrame#each_row instead."
end
|
29
30
31
32
|
# File 'lib/statsample/dataset.rb', line 29
def fields
$stderr.puts "WARNING: Statsample::Dataset and Statsample::Vector have been deprecated in favor of Daru::DataFrame and Daru::Vector. Please switch to using Daru::DataFrame#vectors.\n"
@vectors.to_a
end
|
#fields=(f) ⇒ Object
103
104
105
106
107
|
# File 'lib/statsample/dataset.rb', line 103
def fields=(f)
$stderr.puts "WARNING: Deprecated. Use Daru::DataFrame#reindex_vectors! instead.\n"
reindex_vectors! f
end
|
#from_to(from, to) ⇒ Object
79
80
81
|
# File 'lib/statsample/dataset.rb', line 79
def from_to(from,to)
raise NoMethodError, "This method is no longer supported. To see the vector index use Daru::DataFrame#vectors"
end
|
#name=(new_name) ⇒ Object
34
35
36
37
38
|
# File 'lib/statsample/dataset.rb', line 34
def name= new_name
$stderr.puts "WARNING: Statsample::Dataset and Statsample::Vector have been deprecated in favor of Daru::DataFrame and Daru::Vector. Please switch to using Daru::DataFrame#rename.\n"
rename new_name
end
|
#update_valid_data ⇒ Object
95
96
97
|
# File 'lib/statsample/dataset.rb', line 95
def update_valid_data
raise NoMethodError, "Deprecated. Use Daru::DataFrame#update instead. Also see Daru.lazy_update in the daru docs."
end
|