numeric

numeric column names in R

折月煮酒 提交于 2019-12-24 07:05:15
问题 I have a data frame as follows: structure(list(`104` = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "yes", NA, NA, NA, NA), `15` = c(NA, NA, NA, NA, ">= 4.0", ">= 4.0", NA, "~ 2", "~ 2", "~ 2", "~ 2", "~ 2", "~ 2", "< 2.2", "~2.75", NA, "~2.75", "~2.75", "~2.75", "~2.75")), .Names = c("104", "15"), row.names = 45:64, class = "data.frame") I know that it is not best practices to have numeric column names, however it is necessary in this circumstance. I have been manipulating

TextBox not editing after SelectAll in vb.net

99封情书 提交于 2019-12-24 06:44:29
问题 I have an issue, The thing is I have to allow user to enter numeric value in text box up to one decimal point, When all text selected and I try try to edit text by entering any numeric key, It wont let it change. Here is the text box with value. The code behind, Keypress Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Regex.IsMatch(TextBox1.Text, "\.\d") Then e.Handled = True End If End Sub Kindly

kendo autocomplete on numeric field

可紊 提交于 2019-12-24 05:56:40
问题 Trying to use autocomplete but my dataTextField is an integer. So I keep getting "tolower" or "indexof" error. Cant find a single example of someone trying to autocomplete with numbers. PS: works fine with a text field http://jsfiddle.net/NSLp8/ $("#autocomplete").kendoAutoComplete({ dataTextField: "value", select: function(e) { var dataItem = this.dataItem(e.item.index()); //output selected dataItem $("#result").html(kendo.dataItem); }, dataSource: { data: [ { id : 1, value: 1 }, { id : 2,

Filter strings with regex before casting to numeric

倖福魔咒の 提交于 2019-12-23 23:08:22
问题 I have this code (was already there, isn't mine): SELECT a.id_original_contrato AS contrato, ( CASE WHEN d.value~'^\\d+$' THEN d.value::integer ELSE 0 END ) AS monto, EXTRACT(YEAR FROM b.value)::integer AS anoinicio, EXTRACT(YEAR FROM c.value)::integer AS anofin ... etc (some JOIN's and WHERE's) Let me explain: d.value comes from a table where value is character varying (200) . The code will insert later the d.value (now called 'monto') in another table as a integer . Someone coded that regex

solving a trig equation numerically with in-browser JS [closed]

空扰寡人 提交于 2019-12-23 20:44:19
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Given values for the variables s , v , and h , and given a library such as numeric.js how can I numerically solve the following equation for a within a given degree of accuracy? I'm wanting a JS algorithm for use in-browser. 回答1: Separating variables and parameters You could start by substituting b = a/h. That

how exactly do Javascript numeric comparison operators handle strings?

天涯浪子 提交于 2019-12-23 17:12:00
问题 var i = ['5000','35000']; alert((i[0] < i[1])?'well duh!':'fuzzy math?'); alert((Number(i[0]) < Number(i[1]))?'well duh!':'fuzzy math?'); What's happening here? In the first alert, the text string "5000" evaluates as not less than "35000". I assumed Javascript used Number() when numerically comparing strings, but apparently that's not the case. Just curious how exactly Javascript handles numerically comparing the strings of numbers by default. 回答1: Javascript compares strings by character

How do I optimize numerical integration performance in Haskell (with example)

荒凉一梦 提交于 2019-12-23 15:26:04
问题 How do I optimize numerical integration routine (comparing to C)? What has been done to the moment: I replaced lists with unboxed vectors (obvious). I applied profiling techniques described in the book "Read World Haskell" http://book.realworldhaskell.org/read/profiling-and-optimization.html. I have inlined some trivial functions and inserted a lot of bangs everywhere. That gave about 10x speedup. I refactored the code (i.e. extracted iterator function). That gave 3x speedup. I tried to

Automatically cast from double to decimal safely: Is the following safe?

你说的曾经没有我的故事 提交于 2019-12-23 10:51:11
问题 Is it safe to cast from double to decimal in the following manner in C#: int downtimeMinutes = 90; TimeSpan duration = TimeSpan.FromHours(2d); decimal calculatedDowntimePercent = duration.TotalMinutes > 0? (downtimeMinutes / (decimal)duration.TotalMinutes) * 100.0m : 0.0m; If the answer is yes, then no fuss, I'll just mark as accepted. 回答1: Yes it is safe, because decimal has greater precision http://msdn.microsoft.com/en-us/library/364x0z75(VS.80).aspx The compiler will put in casts around

Automatically cast from double to decimal safely: Is the following safe?

半城伤御伤魂 提交于 2019-12-23 10:50:48
问题 Is it safe to cast from double to decimal in the following manner in C#: int downtimeMinutes = 90; TimeSpan duration = TimeSpan.FromHours(2d); decimal calculatedDowntimePercent = duration.TotalMinutes > 0? (downtimeMinutes / (decimal)duration.TotalMinutes) * 100.0m : 0.0m; If the answer is yes, then no fuss, I'll just mark as accepted. 回答1: Yes it is safe, because decimal has greater precision http://msdn.microsoft.com/en-us/library/364x0z75(VS.80).aspx The compiler will put in casts around

Value of real type incorrectly compares

被刻印的时光 ゝ 提交于 2019-12-23 10:06:26
问题 I have field of REAL type in db. I use PostgreSQL. And the query SELECT * FROM my_table WHERE my_field = 0.15 does not return rows in which the value of my_field is 0.15 . But for instance the query SELECT * FROM my_table WHERE my_field > 0.15 works properly. How can I solve this problem and get the rows with my_field = 0.15 ? 回答1: To solve your problem use the data type numeric instead, which is not a floating point type, but an arbitrary precision type. If you enter the numeric literal 0.15