similar to: From string to numeric

Displaying 20 results from an estimated 20000 matches similar to: "From string to numeric"

2017 Aug 02
4
Extracting numeric part from a string
Hi again, I am struggling to extract the number part from below string : "\"cm_ffm\":\"563.77\"" Basically, I need to extract 563.77 from above. The underlying number can be a whole number, and there could be comma separator as well. So far I tried below : > library(stringr) > str_extract("\"cm_ffm\":\"563.77\"",
2011 Feb 13
6
From numeric vector to string vector
Hi there, I have a numeric vector let say: Vect <- c(12.234, 234.5675, 1.5) Now I want a string vector like: changedVec <- c("012.234", "234.568", "001.500") Would be grateful if somebody help me how can I do that. Thanks and regards, [[alternative HTML version deleted]]
2012 Mar 03
3
How to read this data properly?
Dear all, I have been given a data something like below: Dat = "2 3 28.3 3.05 8 3 3 22.5 1.55 0 1 1 26.0 2.30 9 3 3 24.8 2.10 0 3 3 26.0 2.60 4 2 3 23.8 2.10 0 3 2 24.7 1.90 0 2 1 23.7 1.95 0 3 3 25.6 2.15 0 3 3 24.3 2.15 0 2 3 25.8 2.65 0 2 3 28.2 3.05 11 4 2 21.0 1.85 0 2 1 26.0 2.30 14 1 1 27.1 2.95 8 2 3 25.2 2.00 1 2 3 29.0 3.00 1 4 3 24.7 2.20 0 2 3 27.4 2.70 5 2 2 23.2 1.95
2017 Aug 03
2
Extracting numeric part from a string
... Or if you just want to stick with basic regex's without extra packages: > x <- "\"cm_ffm\":\"563.77\"" > sub("[^[:digit:]]*([[:digit:]]*.?[[:digit:]]*).*","\\1",x) [1] "563.77" Cheers, Bert On Wed, Aug 2, 2017 at 5:16 PM, Ismail SEZEN <sezenismail at gmail.com> wrote: > >> On 3 Aug 2017, at 02:59,
2017 Aug 03
0
Extracting numeric part from a string
... and Marc's solution is **much** better than mine. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Aug 2, 2017 at 5:59 PM, Bert Gunter <bgunter.4567 at gmail.com> wrote: > ... Or if you just want to stick with
2017 Aug 03
0
Extracting numeric part from a string
> On Aug 2, 2017, at 6:59 PM, Christofer Bogaso <bogaso.christofer at gmail.com> wrote: > > Hi again, > > I am struggling to extract the number part from below string : > > "\"cm_ffm\":\"563.77\"" > > Basically, I need to extract 563.77 from above. The underlying number > can be a whole number, and there could be comma separator
2017 Aug 03
0
Extracting numeric part from a string
> On 3 Aug 2017, at 02:59, Christofer Bogaso <bogaso.christofer at gmail.com> wrote: > > Hi again, > > I am struggling to extract the number part from below string : > > "\"cm_ffm\":\"563.77\"" > > Basically, I need to extract 563.77 from above. The underlying number > can be a whole number, and there could be comma separator as
2011 Jan 21
3
How to look into the asterisked function?
Hi friends, there is methods() function to see the all available methods for a particular function, for example: > head(methods("print")) [1] "print.acf" "print.anova" "print.aov" "print.aovlist" "print.ar" "print.Arima" In this list, there are some functions which are asterisked like print.acf().
2013 Mar 23
4
Converting a character vector to numeric
Hello again, Let say I have following vector: Vec <- c("0.0365780769", "(1.09738648244378)", "(0.812507787221523)", "0.5778069963", "(0.452456601362355)", "-1.8900812605", "-1.8716093762", "0.0055217041", "-0.4769192333", "-2.4133018880") Now I want to convert this vector to numeric vector. I
2013 Mar 14
3
Working with string
Hello again, Let say I have following string: Vec <- c("sada", "asdsa", "sa") Now I want to make each element of this vector with equal length. Basically I want following vector: c("sada ", "asdsa", "sa ") Therefore we can get: > nchar(c("sada ", "asdsa", "sa ")) [1] 5 5 5 Is there any
2010 Jun 07
2
how to parse out string separated by special character
hi, everyone: i have a data frame with one single character column as followings: DS_xxx_yyy_24hr_zzz_1 DS_xxx_yyy_24hr_zzz_2 DS_xxx_yyy_24hr_zzz_3 DS_xxx_yyy_24hr_zzz_4 DS_xxx_yyy_24hr_zzz_1 DS_xxx_yyy_24hr_zzz_2 DS_xxx_yyy_24hr_zzz_3 DS_xxx_yyy_24hr_zzz_4 DS_xxx_yyy_24hr_zzz_1 i need to parse out the time part like the followings: name time DS_xxx_yyy_24hr_zzz_1
2013 Feb 11
2
Running a R file at a specific time each day
Hello again, My query may look quite generic, however at this point of time I just want explain my problem. I am hopeful that somebody can help me. Let say I have a script file 'Script.R'. Now I want R to run this script file each day at a specific time, and store the result (the calculation for the result are already in that script file) in excel (or may be csv file) for each day. Is
2013 Jan 15
2
Need some help on Text manipulation.
Dear all, Let say I have following data-frame: Dat <- structure(list(dat = c(-0.387795842956327, -0.23270882099043, -0.89528973290562, 0.95857175595512, 1.61680582493783, -1.17738110289352, 0.210601060411423, -0.827369747447338, -0.36896112964414, 0.440288648776096, 1.28018410608809, -0.897113649961341, 0.342216546981718, -1.17288066266219, -1.57994101992621, -0.913655547602414,
2012 Mar 03
3
Shape manipulation
Hi all, let say I have following matrix: > Dat <- matrix(1:30, 5, 6); colnames(Dat) <- rep(c("Name1", "Names2"), 3) > Dat Name1 Names2 Name1 Names2 Name1 Names2 [1,] 1 6 11 16 21 26 [2,] 2 7 12 17 22 27 [3,] 3 8 13 18 23 28 [4,] 4 9 14 19 24 29 [5,] 5
2010 Aug 24
3
How to obtain seed after generating random number?
Dear all, I was doing an experiment to disprove some theory therefore performing lot of random simulation. Goal is to show the audience that although something has very rare chance to occur but it doesn't mean that event would be impossible. In this case after getting that rare event I need to show that same scenario for multiple times to explain other audience. Hence I need to somehow
2017 Jul 18
4
Creating/Reading a complex string in R
Thanks for your pointer. Is there any way in R how to replace " ' " with " /' " programmatically? My actual string is quite lengthy, so changing it manually may not be possible. I am aware of gsub() function, however not sure I can apply it directly on my original string. Regards, On Tue, Jul 18, 2017 at 10:27 PM, John McKown <john.archie.mckown at gmail.com>
2017 Jul 18
3
Creating/Reading a complex string in R
Hi again, Let say I have below string (arbitrary) <html> <head> <script type="text/javascript" <script type="text/javascript"> mystatement('current', {'pac':['']}); mystatement; I want to pass above string to some R variable for further analysis. So I have tried below : String = '<html>
2008 Oct 15
3
Removing characters and periods from character strings
Hello R-users, I have code that gives me the important variables from an analysis. I need to input these variables into a different analysis. To do this, I need to modify them slightly... 1) remove all numbers at the end of the variables, 2) remove all periods. I tried to do it with the awkward code below. It works to remove all the numbers, but when I try to remove the period everything
2008 Nov 03
1
How to calculate modulus of complex number
suppose I have following complex number : a = -0.0475983+0.5364486i This number I got as an eigen value of a matrix. Now I would like to calculate the Modulus of this complex number. Is there any function for doing that? Regards, -- View this message in context: http://www.nabble.com/How-to-calculate-modulus-of-complex-number-tp20308154p20308154.html Sent from the R help mailing list archive
2018 Mar 04
3
Change Function based on ifelse() condtion
Below is my full implementation (tried to make it simple as for demonstration) Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ...) { if (Apply_MC) { return(mclapply(X, FUN, ...)) } else { if (any(names(list(...)) == 'mc.cores')) { myList = list(...)[!names(list(...)) %in% 'mc.cores'] } return(lapply(X, FUN, myList)) } } Lapply_me(as.list(1:4), function(xx) { if (xx ==