numeric

Conversion to xts does not work because data is of type 'character' and cannot be converted to 'numeric'

我怕爱的太早我们不能终老 提交于 2021-02-05 05:43:10
问题 I have the following data set data date PX_LAST.USGG10YR Index PX_LAST.GSWISS10 Index 1 2012-12-31 1.7574 0.526 2 2013-01-31 1.9849 0.789 3 2013-02-28 1.8756 0.698 4 2013-03-29 1.8486 0.716 5 2013-04-30 1.6717 0.570 6 2013-05-31 2.1282 0.722 7 2013-06-28 2.4857 1.027 8 2013-07-31 2.5762 1.023 9 2013-08-30 2.7839 1.069 10 2013-09-30 2.6100 1.021 The class of the date column is > class(data[,1]) [1] "POSIXct" "POSIXt" The class of the other two columns is class(data[,2]) [1] "numeric" class

How to solve 'x' must be numeric in r?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-04 21:32:27
问题 I'm trying to make a histogram but I keep running into the an error message. Here is my code library(readxl) data <- read_excel("data.xls") View(data) attach(data) names(data) hist(data) This is my sample. I want to create a histogram the y-axis be 0-100, x-axis (safely, basic, limited, etc) the numbers (39,29,8,12,12) be in the graph. Does this help make sense? Safely Basic Limited Unimproved Open 39 29 8 12 12 Error in hist.default(data) : 'x' must be numeric What am I doing wrong? I don't

R cannot use hist() because “content not numeric” due to negative decimal numbers?

不羁的心 提交于 2021-02-04 19:49:26
问题 I am new to R and I am trying to draw a histogram using hist() of a list of 100,000 numbers like this -0.764 -0.662 -0.764 -0.019 0.464 0.668 0.464 but I cannot do it because R complains that the content is not numeric. This is what I've tried: I read the file using t <- read.table(file= "file.txt", sep = "\n", dec = ".", header = TRUE) , the data loads and looks well (I get the same values) I tried to make it numeric using as.numeric(c(t[,1])), sapply(t, as.numeric) , but I get completely

Python: How do you sort the contents of a .txt file in numerical order? [duplicate]

别等时光非礼了梦想. 提交于 2021-02-04 07:18:46
问题 This question already has answers here : Is there a built in function for string natural sort? (19 answers) Sorting integers in a csv file - python (2 answers) Closed 5 years ago . I have some trouble making a code that arranges a .txt file in numerical order. The problem I'm having is when ordering numbers 77, 45, 85, 100 in the .txt file it orders it as 100, 45, 77, 85; 100 being the lowest. Not sure how I would correct that as I want 100 to be the highest. This is what I have so far:

Numerical stability of point-in-triangle test with barycentric coordinates

耗尽温柔 提交于 2021-02-03 17:31:59
问题 While looking at various methods for point-in-triangle testing (2D case), I found that the method which uses barycentric coordinates is the most used one. Here is a StackOverflow answer which explains it. Why is this method the most preferred one? It probably has to do with doing less calculations, but what about numerical stability? Is this algorithm better suited than say, the "same side" technique, for cases in which the point is particularly near the border? 回答1: If you solve it: p = p0 +

Numerical stability of point-in-triangle test with barycentric coordinates

半腔热情 提交于 2021-02-03 17:30:21
问题 While looking at various methods for point-in-triangle testing (2D case), I found that the method which uses barycentric coordinates is the most used one. Here is a StackOverflow answer which explains it. Why is this method the most preferred one? It probably has to do with doing less calculations, but what about numerical stability? Is this algorithm better suited than say, the "same side" technique, for cases in which the point is particularly near the border? 回答1: If you solve it: p = p0 +

Numerical stability of point-in-triangle test with barycentric coordinates

强颜欢笑 提交于 2021-02-03 17:28:00
问题 While looking at various methods for point-in-triangle testing (2D case), I found that the method which uses barycentric coordinates is the most used one. Here is a StackOverflow answer which explains it. Why is this method the most preferred one? It probably has to do with doing less calculations, but what about numerical stability? Is this algorithm better suited than say, the "same side" technique, for cases in which the point is particularly near the border? 回答1: If you solve it: p = p0 +

Numerical stability of point-in-triangle test with barycentric coordinates

徘徊边缘 提交于 2021-02-03 17:26:39
问题 While looking at various methods for point-in-triangle testing (2D case), I found that the method which uses barycentric coordinates is the most used one. Here is a StackOverflow answer which explains it. Why is this method the most preferred one? It probably has to do with doing less calculations, but what about numerical stability? Is this algorithm better suited than say, the "same side" technique, for cases in which the point is particularly near the border? 回答1: If you solve it: p = p0 +

Formating programmatically Excel cells from Scientific numeric to Text with C#

北城余情 提交于 2021-01-29 12:20:50
问题 I'm facing a problem after extracting data from my sqlServer dataBase to my Excel worksheet using Microsoft.Office.Interop.Excel reference. Numeric data are displayed in a scientific numeric format, instead of being displayed in a text format. I tried to format my cell this way, but still doesn't work : Microsoft.Office.Interop.Excel.Range cell= (Range) worksheet.Cells[rowNum, fieldNum]; cell.NumberFormat="@"; I tried even to set my cells format in my Input Excel file; which i'm actually

Python: Integral and funcion nested in another integral using scipy quad

梦想的初衷 提交于 2021-01-29 09:40:28
问题 I have managed to write a few lines of code using scipy.integrate.quad for my stochastic process class I have the Markov transition function for standard Brownian motion import numpy as np def p(x,t): return (1/np.sqrt(2*np.pi*t))*np.exp(-x**2/(2*t)) But I want to compute the following that I am going to write in code that would not work. I write it like this so we can understand the problem without the use of latex. from scipy.integrate import quad integral = quad(quad(p(y-x),1,np.inf)*p(x,1