similar to: Help with NaN when 0 divided by 0

Displaying 20 results from an estimated 3000 matches similar to: "Help with NaN when 0 divided by 0"

2012 Aug 24
3
ifelse problem - bug or operator error
Hi R-Helpers, I don't think I need to post a dataset for this question but if I do, I can. Anyway, I am having a lot of trouble with the ifelse command. Here is my code: vn$PM.DIST_flag <- ifelse( (vn$PM.EXP > 0.0) & (vn$PM.DIST.TOT != 1.0), 1, 0 ) And here is my output that doesn't make ANY sense: PM.EXP PM.DIST.TOT PM.DIST_flag 0 0 0 0 0 0 0 0 0 177502 1 0 31403
2006 May 24
5
Joining variables
Hello, If I have two variables that are factors or characters and I want to create a new variable that is the combination of both what function can I use to accomplish this? Ex. Var1 Var2 SA100055113 19851113 And I want NewVar SA10005511319851113 Thanks in advance. Cameron Guenther, Ph.D. Associate Research Scientist FWC/FWRI, Marine Fisheries Research 100 8th Avenue S.E. St.
2005 Aug 16
1
Fwd: Documenting data sets with many variables
Hi, since nobody answered to my first message, I try to explain my problem more clearly and more general this time: I have a data set in my R package "micEcon", which has many variables (82). Therefore, I would like to avoid to describe all variables in the "\format" section of the documentation (.Rd file). However, doing this lets "R CMD check" complain about
2009 Jan 19
1
conditional weighted quintiles
Dear All, I am economist and working on poverty / income inequality. I need descriptive statitics like the ratio of education expentitures between different income quintiles where each household has a different weight. After a bit of google search I found 'Hmisc' and 'quantreg' libraries for weighted quantiles. The problem is that these packages give me only weighted quintiles;
2012 Feb 28
1
Packages/functions for competing risk analysis
Hi Rs, I am analyzing a time to event dataset with several competing risks. 0 = Active by end of study 1 = Stopped treatment to start another treatment 2 = Lost 3 = Dead My event of interest in Lost to Followup but starting a different treatment and dying are competing risks. All 1,2,3 events are events of exiting the study, but it's only 2-LTFU that we are concerned with (I know I am
2004 Nov 05
1
Error message from vignette strucchange-intro example
Hello, I am just studying the following example from vignette: strucchange-intro, contineousely ending up in an error. This is the given code: 1. library(strucchange) 2. data(USIncExp) 3. if (!"package:stats" %in% search()) library(ts) 4. USIncExp2 <- window(USIncExp, start = c(1985, 12)) A.Modelling: coint.res <- residuals(lm(expenditure ~ income, data = USIncExp2))
2012 Aug 07
2
Error using ddply inside user-defined function
Hi All, I *think* it's ddply because the function recognizes vr1, etc, in other parts of the function. Here's some code: # create dataset PROV.PM.FBCTS <- c(0.00 ,0.00, 33205.19, 25994.56, 23351.37, 26959.56 ,27632.58, 26076.24, 0.00, 0.00 , 6741.42, 18665.09 ,18129.59 ,21468.39 ,21294.60 ,22764.82, 26076.73) FBCTS.INV.TOT <- c(0 , 0, 958612, 487990, 413344, 573347,
2007 Oct 19
1
X matrix deemed to be singular in counting process coxph
Dear all, I have a question with respect to counting process formulation of the coxph(survival) model. I have two groups of observations for which I have partitioned each observation into two distinct time intervals, namely, entry day till day 13, and day 13 till death or censorship day (of course the latter only for the observations that survived the first 13 day interval), and added a
2003 Nov 25
3
weighted mean
How do I go about generating a WEIGHTED mean (and standard error) of a variable (e.g., expenditures) for each level of a categorical variable (e.g., geographic region)? I'm looking for something comparable to PROC MEANS in SAS with both a class and weight statement. Thanks. Marc [[alternative HTML version deleted]]
2005 Apr 21
2
Deciles and R
Hi everyone, I'm a new R user (if this is a really basic question, please do excuse me...) and I'm having some questions regarding a deciles problem. I have a variable which I need to categorize according to its deciles (X). However, this categorization should be made into another variable (call it NewVar). Ex. for the quartiles case (just for the sake of exposition, since I need
2005 May 04
1
Double hurdle model in R
I am interested in utilizing this so called "double hurdle" model in my study. We can write the model in the following way: if (z'a + u > 0 & x'b + e > 0) y = x'b + e, else y = 0 In the model, consumption y is the (left-) censored dependent variable. e and u are the normally distributed error terms. z'a is the participation equation and x'b is the
2010 May 28
2
problem with a function
Hi all, I have a function rho.f which gives a list of estimators. I have the following problems. rho.f(0.3) gives me the right answer. However, if I use rho.f(corr[4]) give me a different answer, even though corr[4]==0.3. This prevents me from using a for loop. Can someone give me some help? Thank you very much in advance. Hannah >
2007 Feb 01
2
Losing factor levels when moving variables from one context to another
Hi, there I'm currently trying to figure out how to keep my "factor" levels for a variable when moving it from one data frame or matrix to another. Example below: vec1<-(rep("10",5)) vec2<-(rep("30",5)) vec3<-(rep("80",5)) vecs<-c(vec1, vec2, vec3) resp<-rnorm(2,15) dat<-as.data.frame(cbind(resp, vecs))
2013 Dec 13
4
Accessing plain text password from memory
Is there a way to retrieve the client's password in plain text from memory ? I don't store the password in plain text in my postgreSQL but I need it when the client is connected to make crypto computation. If I write a plugin to do the job, how could I retrieve the plain text password from master ? Thank you for your help, Regards, Stan.
2003 Oct 15
2
Example of cell means model
This is an example from chapter 11 of the 6th edition of Devore's engineering statistics text. It happens to be a balanced data set in two factors but the calculations will also work for unbalanced data. I create a factor called 'cell' from the text representation of the Variety level and the Density level using '/' as the separator character. The coefficients for the linear
2012 Nov 22
1
Efficiently creating/defining new variables transformations
I would like to add an extension to the current name of a variable to create a new variable that is its sqrt transform. Each piece of the equation below works independently, but the left side definition fails on run. I also tried creating the variable name first, but ended up with an object that toString() did not fix. Better ideas? Example 1
2006 May 16
2
Engel curve
Hi, has anybody an example of an Engel curve analysis in R or does there exist a package to estimate and plot Engel curves from expenditure / income data in R? Thanks a million for your hints, Werner
2011 Jan 04
1
Go from CALLINGout to just CALLING
Hello list, how can I go from CALLINGout to just CALLING ? I've tried : exten => s,n,Set(newVAR=${CUT(CALLINGout,,3)}) or exten => s,n,Set(newVAR=$[CUT(CALLINGout,,3)]) But no result : [Jan 4 11:10:12] -- Executing [s at from-S:34] NoOp("SIP/s2-0000003b", "newVAR=") in new stack Asterisk 1.6.10 here. Kind regards, Jonas. -------------- next part
2007 Oct 10
1
global object in user defined function
I need an object created in a user defined function to be accessible to another user defined function. I am fairly certain the object is correctly created as it prints when I use the return() function, however the 2nd function seems unable to use it. I am guessing objects created in functions are not globally accessible, is this correct? What is an appropriate way to pass the object to the
2008 Nov 10
1
plotting graph in different device
Hi, i try to plot my graph into different device using x11(), but when i do this comes up: > x11(print(plot(A5e$ECAB,A5e$EXPEND,type='p',main='Per capita expenditure > against economic + ability index without outliners',xlab='ECAB',ylab='EXPEND',xlim=c(0,150),ylim=c(150,400), + col='red',col.axis='blue'))) NULL Warning message: