Re: [R] Help with function and survey data

2022-10-31 Thread Edjabou Vincent
Dear Bert Thank you for your suggestion. I have tried it but it did not work. For record, I am reposting the post with the plain text. library(tidyverse) library(plyr) library(survey) dat <- structure(list( r3a_1 = structure(c(3L, 2L, 3L, 3L, 3L, 3L, 3L,3L, 3L, 3L, 3L, 2L, 2L, 3L, 3L, 3L, 3L

Re: [R] Help with function and survey data

2022-10-31 Thread Bert Gunter
1. This is a plain text list. Set your email to post in plain text, not html, which often gets mangled (see below). 2. I did not run your example, but try: my_funca(mk =names(dat)[1:9], y = dat$seg_2) ## seg_2 is a component of dat and is not in the environment of the call. I did not see any data

[R] Help with function and survey data

2022-10-31 Thread Edjabou Vincent
Dear R-Help I am working with complex survey data using the survey package. I would like to create a function for the generate multi crosstable. The problem is that I am getting error with the following message: "Error in eval(predvars, data, env) : object 'y' not found" Here is the example: libra

[R] Help with function lmodel2

2016-06-12 Thread avcommande
Hello everyone,   Does anybody know whether it's possible to calculate extract major axis regression residuals on the results of a major axis Model II regression done by lmodel2? Many thanks, Orca   Example :   > data1 data1     SSTo  SSTp 1  17.21 20.36 2  19.61 20.19 3  18.60

Re: [R] help with function calls

2016-03-27 Thread Bert Gunter
... and here is a maybe slightly neater approach using ?mapply (again with the method column changed to character(): f <- function(meth,i,fr) do.call(meth,list((fr[i,]))) mapply(FUN=f,meth=input.df[,4],seq_len(nrow(input.df)), MoreArgs = list(fr = input.df[,1:3]) ) Cheers, Bert Bert G

Re: [R] help with function calls

2016-03-27 Thread Bert Gunter
OOPS! I forgot to tell you that I first changed the "method" column, which is a factor, to character, with input.df$method <- as.character(input.df$method) Then things will work properly. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking t

Re: [R] help with function calls

2016-03-27 Thread Bert Gunter
1. return() is not needed in R functions (it's harmless, however). You might wish to go through an R function tutorial (many good ones are on the web) to learn about what slick things you can do with functions in R. 2. The following is just a brute force loop, so more elegant approaches are likely

[R] Help with function jtest - inputs other than from lm

2015-05-03 Thread Reiko
Hi all, the function jtest allows to compare two non-nested models. The comparison is made such that the fitted values of one model are included in the regressor matrix of the other model. It then looks whether there is any predictive power of these fitted values. Unfortunately, the input has to

Re: [R] help with function

2010-12-18 Thread Iain Gallagher
B.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.utf8 LC

Re: [R] help with function

2010-12-17 Thread Charles C. Berry
On Fri, 17 Dec 2010, Iain Gallagher wrote: Hello List I'm moving this over from the bioC list as, although the problem I'm working on is biological, the current bottle neck is my poor understanding of R. I wonder if someone would help me with the following function. Here is how I'd take it

[R] help with function

2010-12-17 Thread Iain Gallagher
Hello List I'm moving this over from the bioC list as, although the problem I'm working on is biological, the current bottle neck is my poor understanding of R. I wonder if someone would help me with the following function. cumulMetric <- function(deMirPresGenes, deMirs){     #need to match po

Re: [R] Help with function writing

2010-10-11 Thread Michael Bedward
Hello Tim, This function will do it where the covariates are provided as separate arguments. It would be easy to modify this to handle a list too. function(outcome, ...) { arg.names <- as.character(match.call())[-1] nargs <- length(arg.names) f <- as.formula(paste(arg.names[1], "~", paste(a

[R] Help with function writing

2010-10-11 Thread Tim Elwell-Sutton
Hello all I have what seems like a simple question but have not been able to find an answer on the forum. I'm trying to define a function which involves regression models and a large number of covariates. I would like the function to accept any number of covariates and, ideally, I would like to b

Re: [R] Help with function "fitdistr" in "MASS"

2010-01-04 Thread Peter Ehlers
Saji Ren wrote: Thank you,man. the problem solved. Plus. when I got the parameters of the data. And I used the "truehist(mydata)" to get a histogram of the data, How can I draw a line of the distribution of the estimated parameters in the histogram plot? for example: fitdistr(na.exclude(mydat

Re: [R] Help with function "fitdistr" in "MASS"

2010-01-04 Thread Saji Ren
Thank you,man. the problem solved. Plus. when I got the parameters of the data. And I used the "truehist(mydata)" to get a histogram of the data, How can I draw a line of the distribution of the estimated parameters in the histogram plot? for example: >fitdistr(na.exclude(mydata),"normal") m

Re: [R] Help with function "fitdistr" in "MASS"

2010-01-03 Thread Bernardo Rangel Tura
On Sat, 2010-01-02 at 23:20 -0800, Saji Ren wrote: > Hi, R users: > > I want to fit my data into a normal distribution by using the command > "fitdistr" in "MASS". > I changed my data class from "ts" to "numeric" by > > >class(mydata)="numeric" > > but after using "fitdistr", I got the result be

Re: [R] Help with function "fitdistr" in "MASS"

2010-01-03 Thread Prof Brian Ripley
Please read the footer of this message. ?fitdistr says x: A numeric vector. and setting the class does not make it a numeric vector (it is just a label). And fitdistr early on does if (missing(x) || length(x) == 0L || mode(x) != "numeric") stop("'x' must be a non-empty nu

Re: [R] Help with function "fitdistr" in "MASS"

2010-01-02 Thread Saji Ren
And when I used the command below: >fitdistr(mydata, "normal", na.rm=TRUE) the result is still the same. -- View this message in context: http://n4.nabble.com/Help-with-function-fitdistr-in-MASS-tp997609p997615.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Help with function "fitdistr" in "MASS"

2010-01-02 Thread Saji Ren
I check my data again, and find that: 1. when the class of "mydata" is ts, I can't compute the sd of it. R returns 'NA'. 2. when I change the class from ts into numeric, R still can't compute the sd of the data. Any suggestion? -- View this message in context: http://n4.nabble.com/Help-with-fu

[R] Help with function "fitdistr" in "MASS"

2010-01-02 Thread Saji Ren
Hi, R users: I want to fit my data into a normal distribution by using the command "fitdistr" in "MASS". I changed my data class from "ts" to "numeric" by >class(mydata)="numeric" but after using "fitdistr", I got the result below >fitdistr(mydata,"normal") meansd NA NA (NA)

Re: [R] Help with Function!

2009-03-13 Thread Paul Johnson
On Fri, Mar 13, 2009 at 6:28 PM, Lars Bishop wrote: > Dear All, > > I need to write 'n' functions on 'm' variables. The functions should be > constructed according to the values of an (nxm) matrix of '1/0' values as > follows. For example, > > if row1 is equal to ,say [1 0  ...0 0] then f1 <-

[R] Help with Function!

2009-03-13 Thread Lars Bishop
Dear All, I need to write 'n' functions on 'm' variables. The functions should be constructed according to the values of an (nxm) matrix of '1/0' values as follows. For example, if row1 is equal to ,say [1 0 ...0 0] then f1 <- (1+x1) if row 2 is equal to, say [1 1 1 0...0 1] then f2 <-(1+x1)

Re: [R] help with function filter

2008-06-09 Thread jim holtman
I think you can get the median with: filter(MATDINAMIC$VELOCIDADFIN[1:1000],c(0, 1, 0)) On Mon, Jun 9, 2008 at 5:08 PM, wilquin Minaya <[EMAIL PROTECTED]> wrote: > > Hi everybody > > I need to create a program using the function filter with this vector. > MATDINAMIC$VELOCIDADFIN[1:1000] >

[R] help with function filter

2008-06-09 Thread wilquin Minaya
Hi everybody I need to create a program using the function filter with this vector. MATDINAMIC$VELOCIDADFIN[1:1000] That´s why I want to identify when use the mean and the median because I have problems. I want to know if I am using correct this: filter(MATDINAMIC$VELOCIDADFIN[