numeric

Converting from a list to numeric in R

半世苍凉 提交于 2019-12-03 03:19:16
问题 I recently had a problem in which everytime I read a csv file containing a table with values, R read it as a list format instead of numeric. As no thread provided me the entire answer for my situation, once I was able to make it run I decided to include here the script that worked for me in hope that it is useful to someone. Here it is, with some description and some options in case you need it: (1) Read the data from a csv file. Here the file has no header, so I put F, if yours have a header

How do get only numeric recaptcha?

ε祈祈猫儿з 提交于 2019-12-03 01:27:56
I need to show only the numeric reCaptha instead of character strings. Is it possible? If yes, please give the procedure. Like Google's Street view It is not possible at the moment. Your only options for customisation are basically just skins/themes. If such an option were available, it would also not be in the options passed through on the client side as a bot could just request it as an easier alternative. Even the plugins only generate javascript to display the widget. So the option would have to be server side, associated with your key and there are no options to do this when you create

Is there a fast product operation for PackedArrays?

跟風遠走 提交于 2019-12-03 00:18:22
In Mathematica a vector (or rectangular array) containing all machine size integers or floats may be stored in a packed array. These objects take less memory, and some operations are much faster on them. RandomReal produces a packed array when possible. A packed array can be unpacked with the Developer function FromPackedArray Consider these timings lst = RandomReal[1, 5000000]; Total[lst] // Timing Plus @@ lst // Timing lst = Developer`FromPackedArray[lst]; Total[lst] // Timing Plus @@ lst // Timing Out[1]= {0.016, 2.50056*10^6} Out[2]= {0.859, 2.50056*10^6} Out[3]= {0.625, 2.50056*10^6} Out

php: how to change string data become numeric data

≡放荡痞女 提交于 2019-12-02 23:41:19
问题 can you tell how to change this result in php and mysql script: Model Class Ball S Book A Spoon Plate B Box C this is my DB: CREATE TABLE IF NOT EXISTS `inspection_report` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Model` varchar(14) NOT NULL, `Serial_number` varchar(8) NOT NULL, `Lot_no` varchar(6) NOT NULL, `Line` char(5) NOT NULL, `Class` char(1) NOT NULL, `Status` varchar(6) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Model` (`Model`,`Serial_number`,`Lot_no`,`Line`) ) ENGINE=MyISAM DEFAULT

Factor with comma and percentage to numeric

◇◆丶佛笑我妖孽 提交于 2019-12-02 22:10:20
问题 I have a column ("rates")which is a factor with several levels such as: 16 Levels: -0,186% -0,229% -0,326% ... When I try to convert it to numeric , NAs are introduced and I can't figure out how to do it properly. rates=as.numeric(gsub(",", ".", rates)) rates=as.numeric(sub("%", "e-2", rates)) I also tried the following, which was the answer to a similar question, but it does not work either. rates=as.numeric(gsub("\\%", "", rates)) 回答1: Another option is to use the parse_number -function

Scala: checking if an object is Numeric

拜拜、爱过 提交于 2019-12-02 20:51:28
Is it possible for a pattern match to detect if something is a Numeric ? I want to do the following: class DoubleWrapper(value: Double) { override def equals(o: Any): Boolean = o match { case o: Numeric => value == o.toDouble case _ => false } override def hashCode(): Int = value ## } But of course this doesn't really work because Numeric isn't the supertype of things like Int and Double , it's a typeclass. I also can't do something like def equals[N: Numeric](o: N) because o has to be Any to fit the contract for equals . So how do I do it without listing out every known Numeric class

How to convert entire dataframe to numeric while preserving decimals?

ぐ巨炮叔叔 提交于 2019-12-02 18:13:30
I have a mixed class dataframe (numeric and factor) where I am trying to convert the entire data frame to numeric. The following illustrates the type of data I am working with as well as the problem I am encountering: > a = as.factor(c(0.01,0.02,0.03,0.04)) > b = c(2,4,5,7) > df1 = data.frame(a,b) > class(df1$a) [1] "factor" > class(df1$b) [1] "numeric" When I try and convert the entire data frame to numeric, it alters the numeric values. For example: > df2 = as.data.frame(sapply(df1, as.numeric)) > class(df2$a) [1] "numeric" > df2 a b 1 1 2 2 2 4 3 3 5 4 4 7 Previous posts on this site

How to check if NSString is contains a numeric value?

隐身守侯 提交于 2019-12-02 17:07:24
I have a string that is being generate from a formula, however I only want to use the string as long as all of its characters are numeric, if not that I want to do something different for instance display an error message. I have been having a look round but am finding it hard to find anything that works along the lines of what I am wanting to do. I have looked at NSScanner but I am not sure if its checking the whole string and then I am not actually sure how to check if these characters are numeric - (void)isNumeric:(NSString *)code{ NSScanner *ns = [NSScanner scannerWithString:code]; if (

Converting from a list to numeric in R

风流意气都作罢 提交于 2019-12-02 16:50:20
I recently had a problem in which everytime I read a csv file containing a table with values, R read it as a list format instead of numeric. As no thread provided me the entire answer for my situation, once I was able to make it run I decided to include here the script that worked for me in hope that it is useful to someone. Here it is, with some description and some options in case you need it: (1) Read the data from a csv file. Here the file has no header, so I put F, if yours have a header, then change it to T. data <- read.csv("folder_path/data_file.csv", header=F) (1.a) Note: If you get a

Insert numerical (decimal) data from textbox values

穿精又带淫゛_ 提交于 2019-12-02 15:21:35
问题 I am confused by the following issue; I have a C# (WindowsForms) application which I connect to a SQL Server DB and have no problem to INSERT, SELECT, UPDATE... until I started to work with numerical data; Purpose of this application is to manage employees, their contracts, rate of work, contracts durations, hourly rates... and do some funny calculations with that, nothing magic . Basically, I need to store some values (decimal? double? float?) with the format "0000,0000" in my DB. In my DB,