Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Definitely doable and you are on the right path and maybe even close. The error message you got showed your query as having the wrong info after the 'FROM' keyword ' SELECT * FROM c("BIODBX.MECCUNIQUE2", "BIODBX.QDATA_HTML_DUMMY", "BIODBX.SET_ITEMS", "BIODBX.SET_NAMES", "dbo.sysdiagrams", "GEMD.A

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hi Eric, Thank you spent time to help me for this. Here is the thing: I was requested to manage a sql server for my group. the server has many schemas and the tables (>200). I use ODBC to connect the server and get the schema name + table name into a data frame. For each of schema + table on s

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Jeff Newmiller
Not all advice received on the Internet is safe. https://xkcd.com/327 https://db.rstudio.com/best-practices/run-queries-safely It is not that much more difficult to do it right. On July 2, 2021 12:05:43 PM PDT, Eric Berger wrote: >Modify the summ() function to start like this > >summ <- functi

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Hard for me to tell without more details but it looks like the following has several bugs for (i in dbtable$Tot_table) { Tabname <- as.character(sqldf(sprintf("SELECT Tot_table FROM dbtable", i))) summ(Tabname) } Your sprintf() statement seems to use 'i' but actually does not. You probably wa

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hello Eric, Following your suggestion, I modified the code as: summ <- function(Tabname){   query <- sprintf(" SELECT * FROM %s",Tabname)   res <- dbGetQuery(con, query)   view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try/summarytools.Tabname.html")   rm(res) } for (i in dbtable$Tot_table

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Modify the summ() function to start like this summ <- function(Tabname){ query <- sprintf(" SELECT * FROM %s",Tabname) res <- dbGetQuery(con, query) etc HTH, Eric On Fri, Jul 2, 2021 at 9:39 PM Kai Yang via R-help wrote: > Hello List, > > The previous post look massy. I repost my questio

[R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hello List, The previous post look massy. I repost my question. Sorry, I need to generate summary report for many tables (>200 tables). For each table, I can use the script to generate report: res <- dbGetQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2") view(dfSummary(res), file = "W:/project/_J

[R] R function question

2021-07-02 Thread Kai Yang via R-help
Hello List,I need to generate summary report for many tables (>200 tables). For each table, I can use the script to generate repost: res <- dbGetQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2")view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try/summarytools.BIODBX.MECCUNIQUE2.html")rm(res) BI

Re: [R] R function stopped working

2017-04-04 Thread Jeff Newmiller
Daniel, if you wish to learn from your mistakes them you must listen. Peter is not someone whose input you should dismiss. The function you have showed us never worked as you have described it. However, if you give .GlobalEnv as the first argument in the call to ls() then it should work. You wi

Re: [R] R function stopped working

2017-04-04 Thread DANIEL PRECIADO
Thanks! I was not aware of the browser() function, seems pretty useful for debugging. However, for this particular case, adding it to the mentioned function doesn't do much: Again I get no errors, no output in the terminal and no files are created. If I include browser() within the for-loop (no

Re: [R] R function stopped working

2017-04-04 Thread S Ellison
Maybe a daft question arising from lack of reproducible example, but have you run ls() manually to make sure there are objects that _exactly_ match "_Figs_" ? The simplest explanation for a loop doing nothing is that there are no cases. S Ellison > The following function is supposed to search th

Re: [R] R function stopped working

2017-04-04 Thread Boris Steipe
I discourage the use of print() for debugging. Put a browser() statement into your loop and when execution takes you to the debugger interface, examine your variables and expressions one by one. B. > On Apr 4, 2017, at 10:09 AM, DANIEL PRECIADO wrote: > > To your first comment: Yes, the fu

Re: [R] R function stopped working

2017-04-04 Thread DANIEL PRECIADO
To your first comment: Yes, the function used to work, and the loop inside it still does (as indicated in my first email). I wouldn't bother asking otherwise. To your second, no, specifying the environment in the ls() call doesn't help, the problem persist. On Tue, 2017-04-04 at 15:26 +0200, pe

Re: [R] R function stopped working

2017-04-04 Thread peter dalgaard
Given the following little experiment > foobar <- 1 > f <- function() ls() > f() character(0) > f <- function(x) ls() > f(2) [1] "x" > ... I am pretty sure that your code _never_ actually worked. It probably helps if you tell ls() which environment to list, as in: > f <- function() ls(.Global

Re: [R] R function stopped working

2017-04-04 Thread DANIEL PRECIADO
Thanks, but printing doesn't work within the function either. (i.e, no result or output, or error). Also, like I said, the loop is working fine on its own (so the path, name, filename, and all other variables called from the function exist, are available and are recognized just fine). It just doesn

Re: [R] R function stopped working

2017-04-04 Thread peter dalgaard
How about inserting print() statements on the output of "ls()" and the value of "filename". In particular, is the value of Plots_path the same as last week? -pd > On 4 Apr 2017, at 10:50 , DANIEL PRECIADO wrote: > > The following function is supposed to search the workspace and save > plots

[R] R function stopped working

2017-04-04 Thread DANIEL PRECIADO
The following function is supposed to search the workspace and save plots  (i.e. listing all objects in the workspace named "Figs", which are all ggplot2 plots, and saving them as png files) SaveFigs <- function() { for (i in ls(pattern="_Figs_")) { filename = paste

[R] r function idea: minimize() to turn reproducible_example.R into minimal_reproducible_example.R

2015-09-10 Thread Anthony Damico
just going to throw this idea out there in case it's something that anyone wants to pursue: if i have an R script and i'm hitting some unexpected behavior, there should be some way to remove extraneous objects and manipulations that never touch the line that i'm trying to reproduce. automatically s

Re: [R] R function to convert person-level observations to person-period observations

2015-01-03 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
240-276-1260 -Original Message- From: David Barron [mailto:dnbar...@gmail.com] Sent: Saturday, January 03, 2015 10:19 AM To: Muhuri, Pradip (SAMHSA/CBHSQ) Cc: r-help@r-project.org Subject: Re: [R] R function to convert person-level observations to person-period observations Your data are wron

Re: [R] R function to convert person-level observations to person-period observations

2015-01-03 Thread David Barron
Your data are wrong. The 'event' variable (dead in your example) needs to be 1 for cases that end in an event and 0 for spells that are censored: yours is the other way around. If you change the 'dead' variable to c(1,0,1) you will get the desired result. If you really need to reverse the behavio

[R] R function to convert person-level observations to person-period observations

2015-01-03 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello, I was trying to convert person-level observations to person-period observations using an R custom function obtained from the UCLA web site (http://www.ats.ucla.edu/stat/r/faq/person_period.htm). Please see my reproducible example below. The function (PLPP) in the R script takes five a

Re: [R] R function returning a list of variable(s) conditional on the value of an option?

2014-07-25 Thread PIKAL Petr
-Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Luke Hartigan > Sent: Friday, July 25, 2014 2:23 PM > To: r-help@r-project.org > Subject: [R] R function returning a list of variable(s) conditional on > the value of an

Re: [R] R function returning a list of variable(s) conditional on the value of an option?

2014-07-25 Thread David McPearson
I don't know about better or more elegant - but see inserts below... Cheers. On Fri, 25 Jul 2014 22:22:56 +1000 "Luke Hartigan" wrote > Dear all, > > I have an R function which returns a list of variables; however, within the > body of the function I would like to incorporate a branch based on

[R] R function returning a list of variable(s) conditional on the value of an option?

2014-07-25 Thread Luke Hartigan
Dear all, I have an R function which returns a list of variables; however, within the body of the function I would like to incorporate a branch based on a user selected option that will mean there will be one different variable to return based on the option value. I was thinking of doing somethin

[R] R function for Step-wise Panel Regression

2014-06-11 Thread Nitin Jain
Hi, Can anyone please suggest if it's possible to do a step-wise panel regression in R ? Thanks, Nitin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] R function to locate Excel sheet?

2013-10-29 Thread Adams, Jean
You could use the XLConnect package to do this. For example, something like this might do the trick ... library(XLConnect) mysheet <- "Sheet4" wb <- loadWorkbook("C:/temp/MyData.xlsx") wbsheets <- getSheets(wb) mysheet %in% wbsheets Jean On Tue, Oct 29, 2013 at 3:26 PM, Ron Michael wrote: > H

Re: [R] R function to locate Excel sheet?

2013-10-29 Thread andrija djurovic
Hi here is the solutions using XLConnect package: library(XLConnect) wb <- loadWorkbook(path to your Excel file) c("particular sheet name")%in%getSheets(wb) Andrija On Tue, Oct 29, 2013 at 9:26 PM, Ron Michael wrote: > Hi, > > I am looking for some R function which will tell me, whether a

[R] R function to locate Excel sheet?

2013-10-29 Thread Ron Michael
Hi, I am looking for some R function which will tell me, whether a particular sheet in an Excel file (.xlsx/.xls) exists or not. I just need to get some TRUE/FALSE type of answer. Can somebody give me any pointer if such function exists or not? Thanks and regards,

Re: [R] R function for Bisecting K-means algorithm

2013-10-10 Thread Vivek Singh
On Wed, Oct 9, 2013 at 12:37 PM, Bert Gunter wrote: > Probably not. I would guess that most (or all) of us have no clue what > "bisecting" a k-means algorithm means. You might have more luck if you > explain yourself more clearly (but probably not from me in any case). > > Is this an R question,

Re: [R] R function for Bisecting K-means algorithm

2013-10-08 Thread Bert Gunter
Probably not. I would guess that most (or all) of us have no clue what "bisecting" a k-means algorithm means. You might have more luck if you explain yourself more clearly (but probably not from me in any case). Is this an R question, by the way? This is not a statistics list -- it's an R programm

Re: [R] R function for Bisecting K-means algorithm

2013-10-08 Thread Vivek Singh
Any help on this? Regards, Vivek On Tue, Oct 8, 2013 at 2:36 PM, Vivek Singh wrote: > Hi All, > > Can someone please tell me* R function for Bisecting K-means algorithm*. > I have used *kmeans() *function but not getting good results. > > Please help. > > -- > Thanks and Regards, > > Vivek Kum

[R] R function for Bisecting K-means algorithm

2013-10-07 Thread Vivek Singh
Hi All, Can someone please tell me* R function for Bisecting K-means algorithm*. I have used *kmeans() *function but not getting good results. Please help. -- Thanks and Regards, Vivek Kumar Singh Research Assistant, School of Computing, National University of Singapore Mobile:(0065) 82721535

[R] R function for censored linear regression

2013-09-24 Thread Andreas Wittmann
Dear R-useRs, I'm looking for an R-function for censored linear regression. I have the following data x1 <- rnorm(100) x2 <- rnorm(100) y <- x1 + 2*x2 + rnorm(100,0,0.5) stat <- rep(1,100) stat[50:100] <- 0 data <- data.frame(y,x1,x2,stat) y is the dependent variable, x1 and x2 are the indepe

Re: [R] R function

2013-07-29 Thread David Carlson
nthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rui Barradas Sent: Monday, July 29, 2013 3:46 AM To: javad bayat Cc: r-help@r-project.org Subject: Re: [R] R functio

Re: [R] R function

2013-07-29 Thread Rui Barradas
Hello, Sorry, that should be T <- function(x){ ifelse(x > = 1, "Combustion", "Petroleum") } Rui Barradas Em 29-07-2013 09:32, Rui Barradas escreveu: Hello, Try the following. T <- function(x){ ifelse(pah1$P > = 1, "Combustion", "Petroleum") } T(pah1$P[1:83]) Hope this hel

Re: [R] R function

2013-07-29 Thread Rui Barradas
Hello, Try the following. T <- function(x){ ifelse(pah1$P > = 1, "Combustion", "Petroleum") } T(pah1$P[1:83]) Hope this helps, Rui Barradas Em 29-07-2013 06:35, javad bayat escreveu: Dear R users; I am MSc student and I want to write my own function, but it cant be completed. pleas

[R] R function

2013-07-28 Thread javad bayat
Dear R users; I am MSc student and I want to write my own function, but it cant be completed. please help me for solve it. here is my code: pah1$P = (pah1$Fluoranthene/pah1$Pyrene) T = function(x){ for (i in 1:length(pah1$P)) if (i >= 1) print("Combustion") if (i < 1) print("Petroleum") } T(pah1$P

Re: [R] R Function to extract columnNames

2013-05-01 Thread arun
HI, I am not sure what is wrong in your side.  I cut and paste the same code and I get this: library(plyr) set.seed(25)  mydf<- data.frame(subid=rep(1:5,each=3),Col=sample(c(0:5,NA),15,replace=TRUE))  retsample <- function(df, Column,size) {  set.seed(1234)  mysel <- ddply(df, .(subid),function(

Re: [R] R Function to extract columnNames

2013-05-01 Thread arun
Hi, If you are using Rstudio, please check this link (http://support.rstudio.org/help/discussions/problems/850-ddply-misbehaving-in-rstudio-and-only-in-rstudio). A.K. - Original Message - From: arun To: R help Cc: David Winsemius Sent: Wednesday, May 1, 2013 9:49 PM Subject: Re: R

Re: [R] R Function to extract columnNames

2013-05-01 Thread arun
Hi ST, You could try this: library(plyr) set.seed(25) mydf<- data.frame(subid=rep(1:5,each=3),Col=sample(c(0:5,NA),15,replace=TRUE)) retsample <- function(df, Column,size) { set.seed(1234) mysel <- ddply(df, .(subid),function(x) summarize(x,missing=sum(is.na(x[[Column]])|x[[Column]]==0))) myids<-

Re: [R] R Function to extract columnNames

2013-04-30 Thread David Winsemius
On Apr 30, 2013, at 6:00 AM, arun wrote: > Hi, > May be this helps: > funcName<- function(df1, x){ > whatCol=df1[[x]] > print("Got it") > print(whatCol) > } > > funcName(df,"ColA") > #[1] "Got it" > #[1] 1 2 3 4 5 > funcName(df,"ColB") > #[1] "Got it" > #[1] A B C D E > #Levels: A B C D E

Re: [R] R Function to extract columnNames

2013-04-30 Thread arun
Hi, May be this helps: funcName<- function(df1, x){  whatCol=df1[[x]]  print("Got it")  print(whatCol)  }   funcName(df,"ColA") #[1] "Got it" #[1] 1 2 3 4 5   funcName(df,"ColB") #[1] "Got it" #[1] A B C D E #Levels: A B C D E A.K. >I am trying to extract the 2nd column from a dataframe using a

Re: [R] R function for estimating historical-VaR

2013-03-05 Thread Joshua Ulrich
Cross-posted, verbatim, on stackoverflow: http://stackoverflow.com/q/15203347/271616 -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com R/Finance 2013: Applied Finance with R | www.RinFinance.com On Mon, Mar 4, 2013 at 7:07 AM, Аскар Нысанов wrote: > > > Hi everyo

Re: [R] R function for estimating historical-VaR

2013-03-05 Thread Patrick Burns
unlist(lapply(1:n, function(i) {-sort(returns[i:(N+i)])[op]*value})) } Nello Blaser -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ? ??? Sent: Montag, 4. März 2013 14:07 To: R-help@r-project.org Subject: [R] R function fo

Re: [R] R function for estimating historical-VaR

2013-03-04 Thread Blaser Nello
tion(i) {-sort(returns[i:(N+i)])[op]*value})) } Nello Blaser -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ? ??? Sent: Montag, 4. März 2013 14:07 To: R-help@r-project.org Subject: [R] R function for estimating historical-VaR

[R] R function for estimating historical-VaR

2013-03-04 Thread Аскар Нысанов
Hi everyone!! I am new in R and I want to create a simple R function for estimating historical-VaR. In y_IBM returns, there are 2300 observations. For evaluation I take the next 2000 observations, then I abandon the latest 300 observations. Firstly, I use the window which has the fix length a

Re: [R] R function help!

2013-02-18 Thread Rolf Turner
Pete: Please don't do people's homework for them! At most, give them a ***hint*** only. cheers, Rolf Turner On 02/19/2013 12:01 PM, Pete Brecknock wrote: simonj16 wrote Consider an urn that contains 10 tickets, labelled: 1,1,1,1,2,5,5,10,10,10 I want to draw with replacement n=

Re: [R] R function help!

2013-02-18 Thread Pete Brecknock
simonj16 wrote > Consider an urn that contains 10 tickets, labelled: 1,1,1,1,2,5,5,10,10,10 > > I want to draw with replacement n=40 tickets. I am interested in the sum, > Y, of the 40 ticket values that I draw > > Write an R function named urn.model that simulates this experiement. What > I have

[R] R function for computing Simultaneous confidence intervals for multinomial proportions

2012-12-18 Thread Pierre THIRIET
Dear all, Does someone know an R function implementing the method of Sison and Glaz (1995) (see full ref below) for computing Simultaneous confidence intervals for multinomial proportions? As alternative method, I think to boostrap the mean of each proportion and get in that way confidence int

Re: [R] r function definition

2012-12-04 Thread FJ M
ect the text file and rerun. GL Frank Chicago -------- > Date: Mon, 3 Dec 2012 12:30:31 -0800 > From: q...@hotmail.com > To: r-help@r-project.org > Subject: [R] r function definition > > I am a very new R user. I am trying to write functons and debug fu

Re: [R] r function definition

2012-12-03 Thread Robert Baer
On 12/3/2012 2:30 PM, qq wrote: I am a very new R user. I am trying to write functons and debug functions. One problem for me is that I need to alwasy copy the whole function body and resubmit to R console every time I changed even one line of the function. Because I have long algorithm function,

Re: [R] r function definition

2012-12-03 Thread Jeff Newmiller
?source --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Enginee

[R] r function definition

2012-12-03 Thread qq
I am a very new R user. I am trying to write functons and debug functions. One problem for me is that I need to alwasy copy the whole function body and resubmit to R console every time I changed even one line of the function. Because I have long algorithm function, copying and pasting is very tedio

Re: [R] R function data variable name argument

2012-11-09 Thread Sarah Goslee
Hi, If you move the read.csv statement outside the function and instead pass the data as an argument, then you can provide a reproducible example using dput(head(drugs, 20)) or a similar fake dataset. It's really hard to debug code without knowing what kind of data it is supposed to act upon. In

[R] R function data variable name argument

2012-11-09 Thread Le Lait, Marie-Claire
Hello fellow R-ers, I have spent some time on this and it is driving me NUTS! I am sure there is a solution, so please help. I am trying to create a function that will plot different lines for subsets of a dataset. For example, I am trying to look at different drug groups (drug2), let's say 1,2

Re: [R] R function to fit ARCH and GARCH models

2012-08-13 Thread R. Michael Weylandt
Indeed -- many of them (find a recent post on Pat Burns Portfolio Probe blog for a comprehensive discussion) -- also see rugarch. Michael On Aug 13, 2012, at 8:17 AM, Sajeeka Nanayakkara wrote: > Is there any R function to fit ARCH and GARCH models for univariate time > series and to select

Re: [R] R function to fit ARCH and GARCH models

2012-08-13 Thread John Kerpel
Use the rugarch package - it's great, high quality. On Mon, Aug 13, 2012 at 10:17 AM, Sajeeka Nanayakkara wrote: > Is there any R function to fit ARCH and GARCH models for univariate time > series and to select the best model? > > > Sajeeka Nanayakkara > [[alternative HTML version deleted

[R] R function to fit ARCH and GARCH models

2012-08-13 Thread Sajeeka Nanayakkara
Is there any R function to fit ARCH and GARCH models for univariate time series and to select the best model?   Sajeeka Nanayakkara [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

Re: [R] R function similar to gradient function in Matlab?

2012-06-21 Thread R. Michael Weylandt
I don't have a Matlab license or enough experience with it to know what gradient does, but I know there's a Matlab-to-R "dictionary" out there that many folks find helpful. It might have what you need (or just be generally useful). http://cran.r-project.org/doc/contrib/Hiebeler-matlabR.pdf No

[R] R function similar to gradient function in Matlab?

2012-06-21 Thread Ranjan Maitra
Hi, I am trying to convert some Matlab code into R for running some experiments and I was wondering if there is some function in R which does the work of the gradient function in Matlab calculating the "gradient" of 1-, 2- and 3-d images. I only need the 3-d calculations for running these experime

Re: [R] R function implementation

2011-12-07 Thread jim holtman
Before rewriting in C, especially if you are new at it, have you profiled (Rprof) your function to see the time is being spent? Are you using dataframe or matrices; there is a big speed different between them when accessing data. So profile your code, see where the time is spent and then decide w

[R] R function implementation

2011-12-07 Thread Diviya Smith
Hello there, I recently wrote some code to perform pairwise correlations between all samples in a large dataset. So we are talking about performing pairwise correlations between 400K vectors. Since R has a very rich library of functions, it was very easy to code this in R. However, R was probably

Re: [R] R function that returns an object's search path position XXXX

2011-05-15 Thread Rolf Turner
On 15/05/11 13:41, Dan Abner wrote: Hello everyone, Is there an R function that returns an object's search path position? ?find cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

Re: [R] R function that returns an object's search path position XXXX

2011-05-15 Thread Duncan Murdoch
On 14/05/2011 9:41 PM, Dan Abner wrote: Hello everyone, Is there an R function that returns an object's search path position? Does find() do what you want? It doesn't give the position in the search path, but you could get that from something like name <- "plot" which( search() %in% find(

[R] R function that returns an object's search path position XXXX

2011-05-15 Thread Dan Abner
Hello everyone, Is there an R function that returns an object's search path position? Thank you, Dan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

Re: [R] R function doing multivariate local linear regression

2010-05-06 Thread David Winsemius
On May 6, 2010, at 11:44 AM, Bo Li wrote: Hi, I am looking for a established R function or package which does the multivariate local linear regression. I mean the predictor x is multi-dimensional. locpoly() is the univariate version. I am wondering if there is a multivariate version bes

[R] R function doing multivariate local linear regression

2010-05-06 Thread Bo Li
Hi, I am looking for a established R function or package which does the multivariate local linear regression. I mean the predictor x is multi-dimensional. locpoly() is the univariate version. I am wondering if there is a multivariate version besides the function loess(). Thank you in advan

Re: [R] R function to delete a csv file from disk

2010-03-20 Thread Jan Schwanbeck
I guess, you are looking for: ?file.remove Am 20.03.2010 20:36, schrieb Megh: Is there any R function to delete a CSV file saved in disk? For example here I have created following R function : asd<- function(a = 5) { dat<- read.delim(file="F:/Test.csv", header=T, sep=",") res<- dat[1,

[R] R function to delete a csv file from disk

2010-03-20 Thread Megh
Is there any R function to delete a CSV file saved in disk? For example here I have created following R function : asd <- function(a = 5) { dat <- read.delim(file="F:/Test.csv", header=T, sep=",") res <- dat[1,1]*a # Here I want to delete "Test.csv" return(res) } Here I am l

Re: [R] R function that duplicates Octave's poly function?

2009-11-28 Thread David Winsemius
y, so any insight and clarification is appreciated. - Original Message From: David Winsemius To: Jason Rupert Cc: R-help@r-project.org Sent: Sat, November 28, 2009 9:23:23 AM Subject: Re: [R] R function that duplicates Octave's poly function? On Nov 28, 2009, at 9:33 AM, Ja

Re: [R] R function that duplicates Octave's poly function?

2009-11-28 Thread Jason Rupert
iated. - Original Message From: David Winsemius To: Jason Rupert Cc: R-help@r-project.org Sent: Sat, November 28, 2009 9:23:23 AM Subject: Re: [R] R function that duplicates Octave's poly function? On Nov 28, 2009, at 9:33 AM, Jason Rupert wrote: > > By any chance is anyone aware of an

Re: [R] R function that duplicates Octave's poly function?

2009-11-28 Thread David Winsemius
On Nov 28, 2009, at 9:33 AM, Jason Rupert wrote: By any chance is anyone aware of an R function that duplicates Octave's poly function? Here is a description of Octave's poly function: Function File: poly (A) If A is a square N-by-N matrix, `poly (A)' is the row vector of the coe

[R] R function that duplicates Octave's poly function?

2009-11-28 Thread Jason Rupert
By any chance is anyone aware of an R function that duplicates Octave's poly function? Here is a description of Octave's poly function: Function File: poly (A) If A is a square N-by-N matrix, `poly (A)' is the row vector of the coefficients of `det (z * eye (N) - a)', the characteri

[R] R: Function to check if a vector contains a given value?

2009-09-23 Thread Guazzetti Stefano
?any any(x==2) Stefano -Messaggio originale- Da: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]per conto di Dimitri Liakhovitski Inviato: mercoledì 23 settembre 2009 17.38 A: R-Help List Oggetto: [R] Function to check if a vector contains a given value? Dear R'rs, i

Re: [R] R function for Probabilities for the (standard) normal distribution

2009-08-19 Thread David Winsemius
On Aug 19, 2009, at 7:04 AM, Rene wrote: Dear All, I need to write an R function which computes values of Probabilities for the (standard) normal distribution, ¦µ(z) for z > 0 by summing this power series. (We should accumulate terms until the sum doesn't change). I also need to make t

Re: [R] R function for Probabilities for the (standard) normal distribution

2009-08-19 Thread Rene
Dear All, I need to write an R function which computes values of Probabilities for the (standard) normal distribution, ¦µ(z) for z > 0 by summing this power series. (We should accumulate terms until the sum doesn't change). I also need to make the function work for vector of values z. The initia

Re: [R] R function found in two packages !

2009-06-18 Thread Martin Morgan
Martial Sankar writes: > Hi, > > Is there a mean to automatically choose one version of the 'rbind' function ? > By default, R chose the 'rbind' from {base}, i would lke to use the one from > {IRanges}... > Is it possible to set that using 'par' ? Are you asking how to find help on IRanges::rb

Re: [R] R function found in two packages !

2009-06-18 Thread Martial Sankar
Thanks, > Date: Thu, 18 Jun 2009 11:21:29 +0200 > Subject: Re: [R] R function founRd in two packages ! > From: landronim...@gmail.com > To: martial100...@hotmail.com > CC: r-help@r-project.org > > On 6/18/09, Martial Sankar wrote: > > Is there a mean to automati

Re: [R] R function found in two packages !

2009-06-18 Thread Liviu Andronic
On 6/18/09, Martial Sankar wrote: > Is there a mean to automatically choose one version of the 'rbind' function > ? By default, R chose the 'rbind' from {base}, i would lke to use the one > from {IRanges}... > I am usually solving these issues with: base::rbind() or IRanges::rbind(). Liviu ___

Re: [R] R function found in two packages !

2009-06-18 Thread Allan Engelhardt
See help("::") help("attachNamespace") and perhaps help("search") Allan. On 18/06/09 09:39, Martial Sankar wrote: > Hi, > > Is there a mean to automatically choose one version of the 'rbind' function ? > By default, R chose the 'rbind' from {base}, i would lke to use the one from > {IRanges}

[R] R function found in two packages !

2009-06-18 Thread Martial Sankar
Hi, Is there a mean to automatically choose one version of the 'rbind' function ? By default, R chose the 'rbind' from {base}, i would lke to use the one from {IRanges}... Is it possible to set that using 'par' ? > ?rbind Help on topic 'rbind' was found in the following packages: Package

Re: [R] R function to calculate number of data points of each level

2008-12-17 Thread Philipp Pagel
On Wed, Dec 17, 2008 at 02:09:57PM +0100, Philipp Pagel wrote: > or maybe > > ggregate(foo$V1, by=list(foo$V1), FUN=length) Oops- that was supposed to be 'aggegate'... -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihens

Re: [R] R function to calculate number of data points of each level

2008-12-17 Thread Philipp Pagel
On Wed, Dec 17, 2008 at 03:36:44AM -0800, RON70 wrote: > > I have a dataframe with two columns : > > 11600 238'4 > 12000 218'0 [...] > There are repeatations in 1st column and I want to use this as Level. Next I > want to report for each level how many data points are there, with > corresponding

[R] R function to calculate number of data points of each level

2008-12-17 Thread RON70
I have a dataframe with two columns : 11600 238'4 12000 218'0 12200 209'0 12600 192'0 13000 176'4 14000 145'0 15000 119'0 16000 103'0 1800080'0 1900068'3 2 59'0 11600 208'1 12000 189'2 12200 180'3 There are repeatations in 1st column and I want to use this as

Re: [R] R function which finds confidence interval for binomial variance

2008-09-25 Thread Robert A LaBudde
Thanks Ralph, Moshe and [EMAIL PROTECTED] for you helpful comments. Using bootstrap (e.g., 'boot' + boot.ci()) for the confidence interval on the variance is not very accurate in coverage, because the sampling distribution is extremely skewed. In fact, the 'BCa' method returns the same result

Re: [R] R function which finds confidence interval for binomial variance

2008-09-25 Thread Ralph Scherer
Hello Robert, would it be an idea to construct CI's with bootstrap methods? If yes, you can use package "boot", based on the book of Davison & Hinkley or the package "bootstrap", based on the book of Efron &Tibshirani. You can put the estimator inside for argument "theta". Bests, Ralph Am Thurs

[R] R function which finds confidence interval for binomial variance

2008-09-24 Thread Robert A. LaBudde
I need to construct confidence intervals for the binomial variance. This is the usual estimate v = x*(n-x)/n or its unbiased counterpart v' = x*(n-x)/(n-1) where x = binomial number of successes observed in n Bernoulli trials from proportion p. The usual X^2 method for vari

Re: [R] r function for calculating extreme spread in group

2008-08-27 Thread Jorge Ivan Velez
Dear Steven, Try this: # Data set yourdata=as.data.frame(cbind(lvl=LETTERS[1:2],x=rpois(10,10),y=rnorm(10) )) # Splitting your data set sdata=split(yourdata,yourdata$lvl) res=lapply(sdata,function(X) max(dist(X[,-1]))) do.call(c,res) HTH, Jorge On Wed, Aug 27, 2008 at 7:28 PM, Steven Mat

Re: [R] r function for calculating extreme spread in group

2008-08-27 Thread Dylan Beaudette
On Wednesday 27 August 2008, Steven Matthew Anderson wrote: > Thank you Jorge, > > My talent in building functions is weak. I think I'm close but I'm > not doing something right. > > res=dist(yourdata) > res[which.max(res)] > does provide me with the correct distance but how do I apply it across >

Re: [R] r function for calculating extreme spread in group

2008-08-27 Thread Steven Matthew Anderson
Thank you Jorge, My talent in building functions is weak. I think I'm close but I'm not doing something right. res=dist(yourdata) res[which.max(res)] does provide me with the correct distance but how do I apply it across data with level such as ... > yourdata =as.data.frame(cbind(lvl=LE

Re: [R] r function for calculating extreme spread in group

2008-08-27 Thread Ben Bolker
Steven Matthew Anderson mac.com> writes: > I'm trying to figure out how to write a r function that will calculate > the extreme spread of a group of points given their (x,y) > coordinates. Extreme Spread is the maximal Euclidean distance between > two points in a group > > ex.spread = max

[R] r function for calculating extreme spread in group

2008-08-27 Thread Steven Matthew Anderson
I'm trying to figure out how to write a r function that will calculate the extreme spread of a group of points given their (x,y) coordinates. Extreme Spread is the maximal Euclidean distance between two points in a group ex.spread = max{ sqrt [ (xi-xj)^2 - (yi-yj)^2 ] } for i not equal to

Re: [R] R function, sink() and empty file

2008-08-10 Thread Prof Brian Ripley
This is what Rscript and R CMD BATCH are for. Your problem is that you forgot to print the objects in your function: auto-printing only occurs at the top level. On Sun, 10 Aug 2008, Laura Poggio wrote: Dear all, I wrote a simple script in order to put together some functions and method to be

[R] R function, sink() and empty file

2008-08-10 Thread Laura Poggio
Dear all, I wrote a simple script in order to put together some functions and method to be executed on various files I am trying to have to possibility to call the script changing few parameters in order to use the different files. I succeeded partly using the function method. However in my script

[R] R function for Woody Average (Average with alignment)?

2008-06-02 Thread U. Hasson
Dear R users, I'm looking for a function to align multiple waveforms that contain random phase shifts. The "Woody Average" is one such method -- is there any comparable function already coded for R? Matlab code for this type of average exists [http://www.mathworks.com/matlabcentral/fileexchange/lo

Re: [R] R function to convert a number to text

2008-03-04 Thread lin tang
" To: "lin tang" Cc: Sent: Monday, March 03, 2008 11:38 AM Subject: Re: [R] R function to convert a number to text > lin tang wrote: >> hi, Dear R users - >> >> I wonder is there a written R function to convert a number to a >> text, say convert 1 to

Re: [R] R function to convert a number to text

2008-03-04 Thread Jim Lemon
Alberto Monteiro wrote: > ... > Be careful, the function does not handle "empty" fields: Okay, Alberto, you asked for it! digits2text<-function(x,illion=0) { units<-c("one","two","three","four","five", "six","seven","eight","nine") teens<-c("ten","eleven","twelve","thirteen","fourteen",

Re: [R] R function to convert a number to text

2008-03-03 Thread Gabor Grothendieck
Try RSiteSearch("numbers2words") On Sun, Mar 2, 2008 at 9:05 PM, lin tang <[EMAIL PROTECTED]> wrote: > hi, Dear R users - > > I wonder is there a written R function to convert a number to a text, say > convert 1 to "one" , 100 to "one hundred". I know in xls. has such a > function BAHTTEXT, d

Re: [R] R function to convert a number to text

2008-03-03 Thread Dimitris Rizopoulos
Sent: Monday, March 03, 2008 11:38 AM Subject: Re: [R] R function to convert a number to text > lin tang wrote: >> hi, Dear R users - >> >> I wonder is there a written R function to convert a number to a >> text, say convert 1 to "one" , 100 to "one

Re: [R] R function to convert a number to text

2008-03-03 Thread Alberto Monteiro
Jim Lemon wrote: > > I got bored after the millions, but this should handle the smaller > numbers, and you can always extend it. > > digits2text<-function(x,mult="") { > units<-c("one","two","three","four","five", >"six","seven","eight","nine") > teens<-c("ten","eleven","twelve","thirtee

  1   2   >