similar to: print only 2 digits of number

Displaying 20 results from an estimated 10000 matches similar to: "print only 2 digits of number"

2010 Dec 26
2
What is the best way to lag a time series?
Dear R-users, I've been using R for a while and I am very satisfied! Unfortunately, I still have not figured out an efficient and general way to construct and use lags of time series, especially when I need to work with different packages. Let me give an example. I have two time series x and y and I want to estimate a variaty of distributed lags models and run different tests
2010 Jul 22
4
Drop firms in unbalanced panel if not more than 5 observations in consecutive years for all variables
Dear R-user, a few weeks ago I consulted the list-serve with a similar question. However, my task changed a little but sufficiently to get lost again. So I would appreciate any help on the following issue. I use the plm package and work with firm-level data in a panel. I would like to eliminate all firms that do not fulfill the requirement of having an observation in every variable used for at
2008 Dec 09
4
extract the digits of a number
Hello, Anyone knows how can I do this in a cleaner way? mynumber = 1001 as.numeric(unlist(strsplit(as.character(mynumber),""))) [1] 1 0 0 1 Thanks in advance, Gustavo
2013 Jan 30
2
substring from behind
Hello together, i have a question for "substring". I know i can filter a number like this one: bill$No<-substring(bill$Customer,2,4) in this case i get the 2nd, 3rd and 4th number of my Customer ID. But how can i do this, if i want the 2nd, 3rd and 4th number of a column. Like this one. I have: Mercedes_02352 Audi_03555 and now i want to filter this data.frame to 235 355 can you
2009 Dec 16
4
How to find the significant digits of a number?
Is there a function in R that could find the significant digit of a specific number? Such as for 3.1415, return '5'? Thanks in advance. [[alternative HTML version deleted]]
2013 Apr 18
5
Subsetting a large number into smaller numbers and find the largest product
Hello, I have a big number lets say of around hundred digits. I want to subset that big number into consecutive number of 5 digits and find the product of those 5 digits. For example my first 5 digit number would be 73167. I need to check the product of the individual numbers in 73167 and so on. The sample number is as follows:
2008 Feb 18
2
Number of digits of a value for problem 7.31 RFAQ
Hello dear R users! I did not find a function which gives information about the number of digits of a value shown by R. Do you know one? I need it to solve the problem (see RFAQ 7.31)that 0.2==0.2+0.1-0.1 FALSE The solution suggested in RFAQ is to use isTRUE(all.equal(0.2,0.2+0.1-0.1)) But if I want to compare inequality: 0.2<=0.2 +0.1-0.1 TRUE but 0.2<=0.2 +0.1-0.1 FALSE bad! but in
2008 Jun 02
6
significant digits (PR#9682)
I came to report this same bug and found it already in the trash, but I slightly disagree with that assessment. If it's not a bug, then perhaps it's a feature request. Comments at the end. On Mon, May 14, 2007, Duncan Murdoch wrote: >>On 13/05/2007 8:46 PM, scott.wilkinson at csiro.au wrote: >> >> In the example below round() does not report to the specified number of
2006 Sep 14
1
digits in summary.default
Dear all, the number of significant digits in summary default is digits = max(3, getOption("digits") - 3) on my platform this results to be 4. The point is that if you have, say, integer data of magnitude greater than 10^3 the command summary will produce heavily rounded results. A simple example follow: > x <- c(123456,234567,345678) > x [1] 123456 234567 345678 >
2011 Jan 23
3
how to store a number into a vector
Hi Everyone, A quick question how to store a number like 12345 to a vector or array with size(1,5), like 1, 2, 3, 4, 5 So I can compare if the last three digits of this number is the same with some other numbers. Thanks a lot [[alternative HTML version deleted]]
2012 Jul 07
5
number of decimal places in a number?
Dear R users, I need a function that gets a number and returns its number of actual decimal places. For example f(3.14) should return 2, f(3.142) should return 3, f(3.1400) should also return 2 and so on. Is such function already available in R? If not, could you give me a hint how to achieve that? Many thanks in advance. -----------------------------------------------------------------
2012 Jun 14
3
Lowest number in a numeric string
Hi all, I've got a very long numeric string. I want to find the lowest number that isn't in that string. E.G String = 123456 Therefore 7 is the lowest number not in that string E.G.2 String = 1234567891011 Therefore 13 is the lowest number not in that string. Any thoughts? p.s. I'm an R noob. -- View this message in context:
2005 Sep 29
2
Select varying LS digits in long numbers?
Hi Folks, I'm trying to find a neat solution to an apparently simple problem, but one which turns out to be a bit more intricate and tricky than one might expect. Suppose I have numbers given to a large number of digits. For example 1234567021 where (though I don't know this beforehand) only the last 3 digits will be varying (and all 3 will vary). What I want is, give a vector x of
2009 Feb 12
3
trunc/floor a number -- strange bahaviour
Hi everybody, given a fresh rgui.exe load on winxp OS, I enter (a minimal exaple) n <- 12.357531 Then the following command: n <- (n - floor(n))*10; n gives the following outputs: [1] 3.57531 [1] 5.7531 [1] 7.531 [1] 5.31 [1] 3.1 [1] 1 === still as expected [1] 10 === not expected, count with me: 1 - floor(1) is zero, times 10 gives 0, not 10!!!! [1] 10 === should
2005 Apr 12
8
removing characters from a string
Is there a simple way in R to remove all characters from a string other than those in a specified set? For example, I want to keep only the digits 0-9 in a string. In general, I have found the string handling abilities of R a bit limited. (Of course it's great for stats in general). Is there a good reference on this? Or should R programmers dump their output to a text file and use something
2011 Jun 10
2
Counting the Number of Letters in a row
I'm trying to find the total number of letters in a row of a data frame. Let's say I have the following data frame. f1 <- data.frame(keyword=c("I live in Denver", I live in Kansas City, MO", "Pizza is good")) The following function gives me the number of characters in each string. So for "I live in Denver", I get 1, 4, 2, and 6. However, I want to
2012 Jun 24
1
uncoerce.... to get real number instead of integer?
Dear R community, > #I'm using scan() to extract a real number from a file with a complex structure: 156689504.378. > #My problem is that the number is coerced into an integer.  > #Do you have any ideas for me on how to "uncoerce"?  Here is my code and the output: > #I'm using R version 2.15.0 (2012-03-30) > > net3 <- patient.net3 <-
2007 Aug 18
1
number precision
Hi, I'm trying to find a way to determine how many digits a number has. I tried using nchar(paste(number)), but unfortunately paste will reduce 8.00 to "8". Any thoughts? Pieter -- This message was sent on behalf of pieterprovoost at gmail.com at openSubscriber.com http://www.opensubscriber.com/messages/r-help at stat.math.ethz.ch/topic.html
2011 Dec 04
2
Extract last 3 characters from numeric vector
Hi all, I have a numeric vector with 1 decimal place, and I'd like to extract the last 3 characters, including the decimal point. The vector ranges from 0 to 20. x <- round(runif(100)*20, digits=1) Some of numbers have 3 characters, and some have 4. I've read up on the substr() function but that extracts characters based on exact positions. How can I extract just the last 3
2005 Jun 22
10
How to read an excel data into R?
Hi all, Does anybody know the easiest way to import excel data into R? I copied and pasted the excel data into a txt file, and tried read.table, but R reported that Error in read.table("data_support.txt", sep = " ", header = T) : more columns than column names Thanks! Ling