similar to: how to replace NaN in a vector

Displaying 20 results from an estimated 10000 matches similar to: "how to replace NaN in a vector"

2003 Feb 13
6
generic handling of NA and NaN and NULL
Hello everybody I have a generic problem which the following toy function illustrates: f <- function(n) { if(abs(n) < pi) { return(TRUE) } else { return(FALSE) } } I want it to return TRUE if abs(n)<pi and FALSE otherwise. f() is fine as far as it goes, but does not deal well with NA or NaN or NULL (I want these to signal some problem with the
2008 Sep 25
2
How to order some of my columns (not rows) alphabetically
Hello, I have a dataframe with 9 columns, and I would like to sort (order) the right-most eight of them alphabetiaclly, i.e.: ID1 ID2 F G A B C E D would become ID1 ID2 A B C D E F G Right now, I'm using this code: attach(data) data<-data.frame(ID1,ID2,data[,sort(colnames(data)[3:9])]) detach(data) but that's not very elegant. Ideally I could specify which columns to sort and
2004 May 06
3
strptime
Delving into the murky world of dates and times I found this: dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92") > times <- c("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26") > x <- paste(dates, times) > z <- strptime(x, "%m/%d/%y
2005 Mar 11
5
sample function
Hi everyone, I need help. I want to have a "uniform" kind distribution. When I used sample function I got almost twice many zeros compared to other numbers. What's wrong with my command ? temp <-sample(0:12, 2000, replace=T,prob=(rep(1/13,13))) hist(temp) Thanks in advance, Taka,
2005 Oct 31
2
Help with try or tryCatch
I am having trouble with try and tryCatch. I have read the documentation but I just don't get it. Here is what I am trying to do. I am testing a function which has a number of parameters. I want to test it for different values of the parameters and I have some loops, in the middle of which is a test of the function. Sometimes the routine fails and so I have put the bit that might fail
2007 May 28
2
RODBC and Date/Time variables
This is really a query about MySQL which I am trying to use to set up a database which I will then access with RODBC. I have my data in a .csv file, and some of the fields are date/time fields. I tried to create a table using mysql with the definition of the date/time field given by CallDate DATETIME, but I got an error saying that the first row has 28/07/2006 0:00 in that field. What I
2008 Feb 11
4
R programming style
I am aware of one (unofficial) guide to style for R programming: http://www1.maths.lth.se/help/R/RCC/ from Henrik Bengtsson. Can anyone provide further pointers to good style? Views on Bengtsson's ideas would interest me as well. David Scott _________________________________________________________________ David Scott Department of Statistics, Tamaki Campus The University of Auckland,
2007 Jun 11
1
Recoding
I want to do some recoding of variables: code Age into groups and recode a factor into a smaller number of levels. There are a couple of options for recode functions, in the car package and in memisc, and I think in gmisc. Does anyone have any opinions on the the easiest, most reliable approach for these problems? David Scott _________________________________________________________________
2008 Jan 27
2
[OT] Open source archive program on windows
I am looking for a recommendation for an open source competitor to Winzip. I seem to recall Brian Ripley mentioning one in the last year or so, but couldn't find it in the mail archives. (Searching on Ripley there is somehow not terribly useful.) Suggestions? David Scott _________________________________________________________________ David Scott Department of Statistics, Tamaki Campus
2005 May 31
2
POSIX problem
I am having trouble with creating a POSIXct object. If I create a variable of class Date first out of the date part of my data, I am ok, but if I just paste the date and time parts together and try and create the POSIXct object, I have problems. Here is a toy example created from the actual data which caused the problem. I am using R 2.0.1 on Windows XP. > # Data frame with dates and
2008 Mar 20
2
Cygwin and Rtools
I have just got a new machine and had a basic cygwin installed before it was given to me. It didn't include make. Previously I have installed Rtools to build packages and now I have got myself a bit confused as to whether to just install make from the cygwin packages or to install rtools. I would welcome any advice. I had a look at the rtools section in the Administration Manual and the
2004 May 30
2
how to remove "." or replace it with NA?
Hi,all a quick question A larger file include many"." (stands for missing value) for variable, say, x. after read in the file and assign it another name such as : x1<-data$x but x1 is always a facotor but not numerical. so How can I get a numeric vector from the read in data frame. how can I replace those "." with "NA" to perform analysis. thank you very much
2006 Apr 12
2
extremely simple "for loop" question
I am sorry to ask such a simple question, but my knowledge of programming language is extremely limited, and I couldn't find the answer in any of the normal resources. I want to do a for loop in which m takes on the values 1, 5, 10, 15, 20. What is the syntax for doing that? I had been doing a loop for m in 1:20, but I only want those values above. Thanks, Brian
2004 Nov 22
2
rhyp function from fBasics
Dear R People: There is a function from the fBasics library to get the probability and quantiles for the hyperbolic probability function. Is there one that will estimate parms of the hyperbolic probability function from a data set, please? Thanks in advance! Sincerely, Erin Hodgess mailto: hodgess at gator.uhd.edu R Version 2.0.1 windows
2003 Apr 21
2
Anyone familiar with Cumulants or good reference books?
Hey, R-listers I want to get some statistical books on Cumulants for studying. So will you please give me some suggestions on these related books? Thanks for your point. Fred
2006 Apr 03
2
head function
hi all can anyone tell me what is head() function in r. what is it's utility? thanks in advance --------------------------------- [[alternative HTML version deleted]]
2008 Oct 28
1
acf() plots of a data.frame: what meaning?
Hello, what is the meaning of the plots of an acf()-plot, when using a data frame as argument? The result is NOT obvious for me. There are combinations of the columns of a dataframe in the reulting plot. But an acf() is just defined for onyl one time-sreies. So what do the plots mean? I did not found a description in the help-page. Ciao, Oliver
2008 Oct 28
1
acf(): meaning of the blue horizontal lines
Hello, what are they meaning? It could be something that would show a threshhold above which the result is indicating different meanings then just random noise. But there is no description on the definition of those lines, so it means nothing, if it is not clearly defined. Where can I find a detailed definiton? Ciao, Oliver
2007 Nov 08
3
Testing Normal Distributions
Hi, I would like to know if there is an algorithm in R for testing if a data set as a normal destribution. Thank you for your time, Pedro Marques
2007 Nov 14
2
Generating log transformed random numbers
Dear R users, My question is that how it is possible to generate some random numbers using rnorm( ) function but in log transformed values. Thank you, Tobias --------------------------------- [[alternative HTML version deleted]]