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,

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

[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:

[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

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

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

[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

[R] Help - plot function in Windows

2015-01-16 Thread Nafiseh Mehdipour
Hi, I am writing regarding to my problem about using plot function. I am using R x64 3.1.1 (installed on Windows 7 SP1 (laptop Sony VGN-SR) ), and when I use type this code: x - c(-30,30) y - c(-5,5) plot.window(x , y) or any other form of plot function, it doesn't show anything. I used

[R] Help - plot function in Windows

2015-01-16 Thread Nafise Mehdipour
​Hi, I am writing regarding to my problem about using plot function. I am using R x64 3.1.1 (installed on Windows 7 SP1 (laptop Sony VGN-SR) ), and when I use type this code: x - c(-30,30) y - c(-5,5) plot.window(x , y) or any other form of plot function, it doesn't show anything. I used

Re: [R] Help - plot function in Windows

2015-01-16 Thread Richard M. Heiberger
plot.window() is an internal support function, not a user function. use plot() x - c(-30,30) y - c(-5,5) plot(x , y) On Fri, Jan 16, 2015 at 4:18 PM, Nafise Mehdipour nfs.mehdip...@gmail.com wrote: Hi, I am writing regarding to my problem about using plot function. I am using R x64 3.1.1

Re: [R] Help - plot function in Windows

2015-01-16 Thread Duncan Murdoch
On 16/01/2015 1:18 PM, Nafiseh Mehdipour wrote: Hi, I am writing regarding to my problem about using plot function. I am using R x64 3.1.1 (installed on Windows 7 SP1 (laptop Sony VGN-SR) ), and when I use type this code: x - c(-30,30) y - c(-5,5) plot.window(x , y) or any other

Re: [R] help plsr function

2014-06-24 Thread Bjørn-Helge Mevik
annie Zhang annie.zhang2...@gmail.com writes: ## the predicted scores from the model (pred - predict(data.cpls,n.comp=1:2,newdata=x.new,type=score)) ## the predicted scores using x%*%projection cbind(x.new.centered%*%data.cpls$projection[,1],x.new.centered%*%data.cpls$projection[,2]) Can

Re: [R] help plsr function

2014-06-24 Thread cindy Guo
Ok, yes, I can match them now. Thank you very much! On Tue, Jun 24, 2014 at 3:58 AM, Bjørn-Helge Mevik b.h.me...@usit.uio.no wrote: annie Zhang annie.zhang2...@gmail.com writes: ## the predicted scores from the model (pred - predict(data.cpls,n.comp=1:2,newdata=x.new,type=score)) ##

[R] help plsr function

2014-06-23 Thread annie Zhang
Hi All, I want to produce scores from X using $projection. When I predict, I cannot match the predicted scores and scores using x%*%projection. Below is a very simple example, set.seed(seed=1) y - c(1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0) x - matrix(runif(200),nrow=20) data

Re: [R] Help on function please

2012-11-27 Thread Jean V Adams
Andras, What do you want your code to do? Give us a little explanation with your code. When I try to run your code, I get Error: could not find function genoud. Either supply the code for the functions included in your code, or tell us what packages we need to run it. Jean Andras

[R] Help on function please

2012-11-26 Thread Andras Farkas
Dear All,   I could use a bit of help here, this function is hard to figure out (for me at least) I have the following so far:   PKindex-data.frame(Subject=c(1),time=c(1,2,3,4,6,10,12),conc=c(32,28,25,22,18,14,11)) Dose-200 Tinf -0.5   defun- function(time, y, parms) {  dCpdt - -parms[kel] *

[R] Help writing function in R....

2012-05-13 Thread Tabby
, but I have not been able to find a solution. Thank you, D -- View this message in context: http://r.789695.n4.nabble.com/Help-writing-function-in-R-tp4629824.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] Help writing function in R....

2012-05-13 Thread Jeff Newmiller
help would be greatly appreciated. I have very little experience in r, so I apologize if this is a trivial question, but I have not been able to find a solution. Thank you, D -- View this message in context: http://r.789695.n4.nabble.com/Help-writing-function-in-R-tp4629824.html Sent from the R help

[R] r help: source-function is very slow

2012-01-19 Thread Jos van Nijnatten
Hello everybody, I noticed a performance problem when using the source-function in R. When I try to source an r script that is located in the same directory as the script I execute via command line ('R -f file.r' contents 'source(someOtherScript.r)') it's very fast. But if I put

Re: [R] r help: source-function is very slow

2012-01-19 Thread Uwe Ligges
On 19.01.2012 14:25, Jos van Nijnatten wrote: Hello everybody, I noticed a performance problem when using the source-function in R. When I try to source an r script that is located in the same directory as the script I execute via command line ('R -f file.r' contents

Re: [R] r help: source-function is very slow

2012-01-19 Thread Duncan Murdoch
On 12-01-19 8:25 AM, Jos van Nijnatten wrote: Hello everybody, I noticed a performance problem when using the source-function in R. When I try to source an r script that is located in the same directory as the script I execute via command line ('R -f file.r' contents 'source(someOtherScript.r)')

Re: [R] r help: source-function is very slow

2012-01-19 Thread Jos van Nijnatten
Hello Uwe, Duncan and the rest of the community, It indeed seemed to be a file system problem and I'm lucky to figure that out before it crashed. New computer's great and everything is working fine again. Sorry for wasting your time ;-) On Thursday, January 19, 2012 15:16, Duncan Murdoch

[R] Help ave() function

2011-04-28 Thread петрович
Hello again. Following a great idea from Jim and Dennis, I began to use the function ave() in my big data. I proved to use this command in my data with FUN=max(x,na.rm=T), and I received a Warning that translated looks like Warning in max (x, na.rm = T): no arguments to max; returning -Inf Is

Re: [R] Help ave() function

2011-04-28 Thread David Winsemius
On Apr 28, 2011, at 12:30 PM, петрович wrote: Hello again. Following a great idea from Jim and Dennis, I began to use the function ave() in my big data. I proved to use this command in my data with FUN=max(x,na.rm=T), Try instead: look at the 3rd example of help(ave) and I received

Re: [R] help with function

2010-12-18 Thread Iain Gallagher
: Re: [R] help with function To: Iain Gallagher iaingallag...@btopenworld.com Cc: r-help@r-project.org Date: Saturday, 18 December, 2010, 0:13 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

[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

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

[R] help using function merge_all()

2010-11-16 Thread arjun
Hi, I want to merge 4 data frames with one column in common but I am getting error message while using this function. Can any one help me out. merge_all(Br,Ki,Lu,Pr,by=Genes) Error: could not find function merge_all I have installed the package: reshape but I still get this error --

Re: [R] help using function merge_all()

2010-11-16 Thread Joshua Wiley
Hi, Did you also load the package (you'll need to load it every session you want to use it)? ## load reshape package library(reshape) ## now try merge_all(Br, Ki, Lu, Pr, by=Genes) If this does not resolve your problem, please run: sessionInfo() at your console and report the output (it will

Re: [R] help using function merge_all()

2010-11-16 Thread arjun
Hi Josh, Thanks for your reply. While I am loading the package, it says package plyr is required and I tried to install plyr package but I am unable to do so because it is giving an error message as shown below. Please help me. library(reshape) Loading required

Re: [R] help using function merge_all()

2010-11-16 Thread arjun
Hi Josh, I thought of giving up and started writing code in excel using VBA but then I saw ur message and gave a try in R. I got it, the location from which I am calling the package plyr is not working out so called from different CRANmirror location and then I was able load the

[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

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], ~,

[R] help in function in R akin to macro in SAS

2010-04-06 Thread Changbin Du
Dear Whom it may concern, I need help to figure the macro function in R: I need to plot the different data sets by a plotxyf function, I want the title to be different for different data set. # get the data set final.xyf- xyf(data=as.matrix(my.final), Y=classvec2classmat(final$outcome),

Re: [R] help in function in R akin to macro in SAS

2010-04-06 Thread Stuart Luppescu
On Tue, 2010-04-06 at 09:33 -0700, Changbin Du wrote: #plot function plotxyf-function (data) { plot(data, type=mapping, labels=final$target, col=final$outcome+1,, main=Supervised: Mapping plot for data) Change this to: main=paste(Supervised: Mapping plot for, data)

Re: [R] help in function in R akin to macro in SAS

2010-04-06 Thread Gang Liang
A small correction. On Tue, Apr 6, 2010 at 9:43 AM, Stuart Luppescu s...@ccsr.uchicago.eduwrote: On Tue, 2010-04-06 at 09:33 -0700, Changbin Du wrote: #plot function plotxyf-function (data) { plot(data, type=mapping, labels=final$target, col=final$outcome+1,, main=Supervised: Mapping

Re: [R] help in function in R akin to macro in SAS

2010-04-06 Thread Thomas Lumley
On Tue, 6 Apr 2010, Stuart Luppescu wrote: On Tue, 2010-04-06 at 09:33 -0700, Changbin Du wrote: #plot function plotxyf-function (data) { plot(data, type=mapping, labels=final$target, col=final$outcome+1,, main=Supervised: Mapping plot for data) Change this to: main=paste(Supervised:

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) mean

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:

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

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 below

[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) (NA) the help

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:

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.

[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

Re: [R] Help with Function!

2009-03-13 Thread Paul Johnson
On Fri, Mar 13, 2009 at 6:28 PM, Lars Bishop lars...@gmail.com 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]

[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:

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] That´s