numeric

How to remove NA values in vector in R [duplicate]

给你一囗甜甜゛ 提交于 2019-11-30 17:58:41
This question already has an answer here: Remove NA values from a vector 6 answers I have a vector which stores over 1000 values. The first 50 values are NAs, how can I get rid of it? c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1.5741, 1.583, 1.605, 1.633, 1.6465, 1.6475, 1.6329, 1.6413, 1.685, 1.692, 1.7087, 1.7055, 1.6985, 1.6807, 1.6745, 1.673, 1.6625, 1.6805, 1.689, 1.667, 1.684, 1.6675, 1.6867, 1.6688, 1.6643, 1.6685, 1.7025, 1.737,

How to make input field type both numeric and password? [duplicate]

白昼怎懂夜的黑 提交于 2019-11-30 11:03:14
This question already has an answer here: Is there a way to have a masked numeric input field? 1 answer I'm aware of this: <input type="tel"> and I'm aware of this: <input type="password"> But I would like to use both. I want the numeric keypad to come up on iOS (specifically) but hide each character after it's typed. Is something like this possible? <input type="tel|password"> For iOS you can set the input to type "password" and still trigger the numeric-keyboard using the HTML5-Attribute "pattern": <input type="password" pattern="[0-9]*" ... /> From the Apple-Documentation : To display a

How to create a numeric vector of zero length in R

懵懂的女人 提交于 2019-11-30 10:16:54
问题 I wonder, how can I create a numeric zero-length vector in R? 回答1: If you read the help for vector (or numeric or logical or character or integer or double , 'raw' or complex etc ) then you will see that they all have a length (or length.out argument which defaults to 0 Therefore numeric() logical() character() integer() double() raw() complex() vector('numeric') vector('character') vector('integer') vector('double') vector('raw') vector('complex') All return 0 length vectors of the

Scala - implicit conversion of Int to Numeric[Int]

早过忘川 提交于 2019-11-30 09:47:46
I've created a class that can be parameterised by anything that can be converted to Numeric class Complex[T <% Numeric[T]] (val real : T, val imag : T) { //... complex number methods ... } Then elsewhere in the code I try: var myComplex = new Complex(0, 1) This raises a compilation error because (surprisingly) there's no implicit conversion between Int and Numeric[Int] or even between Int and Integral[Int]. Am I missing something? Is there an implicit conversion somewhere I'm not seeing? There's an implicit object called IntIsIntegral defined in Numeric.scala. I've tried using this to create

Extended Precision Floating Point Library C/C++

我的未来我决定 提交于 2019-11-30 07:28:44
I am looking for an extended precision floating point library with the following features: fixed data type size (i.e. the extended precision float takes a fixed amount of memory) no initialization required for variables specify size of both mantissa and exponent C/C++ interface support for really large floats > 10^10000 The closest I could found is the HPA library by Ivano Primi. The only problem with this library is that I cannot extend the exponent (it is fixed with 15 bits). It allows me various choices for the mantissa, but the largest representable number is always limited to 10^4932.

Difference between DECIMAL and NUMERIC

三世轮回 提交于 2019-11-30 06:51:06
问题 What's the difference between the SQL datatype NUMERIC and DECIMAL ? If databases treat these differently, I'd like to know how for at least: SQL Server Oracle Db/2 MySQL PostgreSQL Furthermore, are there any differences in how database drivers interpret these types? 回答1: They are the same for almost all purposes. At one time different vendors used different names (Numeric/Decimal) for almost the same thing. SQL-92 made them the same with one minor difference which can be vendor specific:

How to compute an exponent in matlab without getting inf?

天大地大妈咪最大 提交于 2019-11-30 05:42:42
问题 The title says it all: I want to calculate an exponent in matlab with big numbers, but I get overflow and it just returns infinity. >> 100^1000 ans = Inf Last time I checked, 100^1000 is decidedly smaller than infinity :) 回答1: As Daniel has already pointed out, it's too big a number to be even outputted by MATLAB itself. This number is obtained with realmax for different datatypes. As an alternative to represent/use such huge numbers, you can use the corresponding mantissa and exponent with

Replacing commas and dots in R

半世苍凉 提交于 2019-11-30 05:11:18
I have a whole column of numbers that include dot separators at the thousands and comma instead of dot as an dismal separator. When I try to create a numeric column out of them, I lose all data. var1 <- c("50,0", "72,0", "960,0", "1.920,0", "50,0", "50,0", "960,0") df <- cbind(var1, var2 = as.numeric(gsub(".", "", as.character(var1)))) and wound up with: var1 var2 [1,] "50,0" NA [2,] "72,0" NA [3,] "960,0" NA [4,] "1.920,0" NA [5,] "50,0" NA [6,] "50,0" NA [7,] "960,0" NA What am I doing wrong? You need to escape the "." in your regular expression, and you need to replace the commas with a "."

How to create a numeric vector of zero length in R

試著忘記壹切 提交于 2019-11-29 19:41:09
I wonder, how can I create a numeric zero-length vector in R? If you read the help for vector (or numeric or logical or character or integer or double , 'raw' or complex etc ) then you will see that they all have a length (or length.out argument which defaults to 0 Therefore numeric() logical() character() integer() double() raw() complex() vector('numeric') vector('character') vector('integer') vector('double') vector('raw') vector('complex') All return 0 length vectors of the appropriate atomic modes. # the following will also return objects with length 0 list() expression() vector('list')

Right way to convert data.frame to a numeric matrix, when df also contains strings?

蓝咒 提交于 2019-11-29 19:10:44
I have a data frame taken from a .csv-file which contains numeric and character values. I want to convert this data frame into a matrix. All containing information is numbers (the non-number-rows I deleted), so it should be possible to convert the data frame into a numeric matrix. However, I do get a character matrix. I found the only way to solve this is to use as.numeric for each and every row, but this is quite time-consuming. I am quite sure there is a way to do this with some kind of if(i in 1:n) -form, but I cannot figure out how it might work. Or is the only way really to already start