Re: [R] using cat()

2009-08-06 Thread [Ricardo Rodriguez] Your XEN ICT Team
Thanks, Bill bill.venab...@csiro.au wrote: fn <- function(x) { j <- x+1 cat("the value of j is ", j, "\n") j } fn(1:10) It is clear for me now the use of cat(). As Steve pointed out in his mail, I've failed at providing an example, one of the rules of thumb of this

Re: [R] A question regarding R scoping

2009-08-06 Thread markleeds
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] solving system of equations involving non-linearities

2009-08-06 Thread Werner W.
Many thanks, BBsolve works like a charm. First I thought I should use the squares of the equations because BBsolve would use some minimization objective function anyway but it actually only works if I don't use the squared equations. I'll check the documentation if I find something about the obj

[R] bump: calculating R-squared or equivalent for Model II regression

2009-08-06 Thread Karen Ross
Hi, Does anybody know whether it's possible (and sensible) to calculate R^2 (or something approximating R^2) on the results of a major axis Model II regression done by lmodel2? The function lmodel2 provides an R^2 for the OLS regression only (example below), but not for major axis regression.

[R] manual hierarchical forecasting with top-down approach in R

2009-08-06 Thread Meizha wahyu Ramadhani
hi,,i'm icha,,, i'm indonesian college student in Padjadjaran University major in Statistics. My lecture suggests me to use R in finishing my final project which is focus on hierarchical forecasting. sir,,could you help me, i wanna ask the R-languanges deal with hierarchical forecasting with to

Re: [R] BRugs in Linux?

2009-08-06 Thread Frank E Harrell Jr
massiel wrote: Hello, I am trying to learn how to run Bugs from R using Linux…I’m new at Linux so I have been looking what others do on the web, but the info is confusing. Is there any good source where to go and learn how to set up and run Bugs from R in Linux? When I needed to do thi

[R] sweave and R. Searching for a document that will get me started

2009-08-06 Thread John Sorkin
windows XP R 2.8.1 I would like to learn to use Sweave with R. I have no experience using Latex. I have looked at the sweave manual (http://www.statistik.lmu.de/~leisch/Sweave/Sweave-manual.pdf) and have found it difficult to understand, probably because I don't know Latex. Can someone recomme

Re: [R] lowess puzzle

2009-08-06 Thread Donald Braman
Resolved. It works if I set iter=0. On Thu, Aug 6, 2009 at 9:03 PM, Donald Braman wrote: > I was trying to fit a curve to the number of people who identify as liberal > by age. I got some puzzling results which suggested to me that I don't > really understand how local polynomial fitting works

Re: [R] Help with Logit Model

2009-08-06 Thread Noah Silverman
Yes, I already have solid code to estimate the probabilities and gather the public estimates. What I'm stuck on is how to train the "race-wise" logit and then somehow combine them to come up with a final set of coefficients. I could just train a glm on the whole data set, but would be losing t

[R] lowess puzzle

2009-08-06 Thread Donald Braman
I am trying to fit a curve to the number of people who identify as liberal by age. I got some puzzling results which suggested to me that I don't really understand how local polynomial fitting works. Why, I am wondering, is lowess producing a local fit of zero for every age? > liberal [1] 0 0 0

[R] lowess puzzle

2009-08-06 Thread Donald Braman
I was trying to fit a curve to the number of people who identify as liberal by age. I got some puzzling results which suggested to me that I don't really understand how local polynomial fitting works. Why, I am wondering, is lowess producing a local fit of zero for every age? > liberal.bin [1]

Re: [R] A question regarding R scoping

2009-08-06 Thread Duncan Murdoch
Ivo Shterev wrote: Hi, Perhaps I have to rephrase a bit my question. If we have the following: i = 10 f1 = function(i){ i <<- 1 } after calling f1, the value of i becomes 1. Now, suppose that f1 is called in another function f2, and i is initialized in f2 as well, i.e: f2 = function(n){ i =

Re: [R] Time Series smoothing

2009-08-06 Thread voidobscura
Hello, [5956] 10242.793600 10233.872700 10229.265400 10230.835200 10230.715500 [5961] 10233.706500 10231.821200 10235.511800 10232.515900 10240.365800 [5966] 10244.216100 10252.208800 10249.710600 10249.591500 10258.640800 [5971] 10263.172300 10263.327800 10271.161200 10268.512200 10268.465800 [5

[R] running BRugs in Linux?

2009-08-06 Thread Orellana, Massiel A [AGRON]
Hello, I am trying to learn how to run Bugs from R using Linux...I'm new at Linux so I have been looking what others do on the web, but the info is confusing. Is there any good source where to go and learn how to set up and run Bugs from R in Linux? When I needed to do this with windows

[R] Conditional randomization of groups

2009-08-06 Thread yabado
Hi I have a data set which is like this: Data ID Type 1 A 2 B 3 A 4 A 5 A 6 B 7 B 8 A 9 B 10 B As you can see, there are 5 A and 5 B. Now, I want to a randomization of the data set which will assign 5 ID to a new group called "Set1"

Re: [R] Convert dataframe to table with counts where column names become row names

2009-08-06 Thread ghinkle
Wow. Very nice. Amazingly terse. I will throw out the looping function I just debugged... greg Henrique Dallazuanna wrote: > > Try this: > t(sapply(DF1, table)) > > On Thu, Aug 6, 2009 at 2:14 PM, ghinkle wrote: > >> >> Can anyone explain how best to go from a dataframe to a table (or be

Re: [R] using cat()

2009-08-06 Thread Steve Lianoglou
Hi, On Aug 6, 2009, at 7:25 PM, [Ricardo Rodriguez] Your XEN ICT Team wrote: Please, could you give me an example about how to use cat() to read the value of a variable in a function? Any other way? Can you please give an example of what you're trying to do? It seems like you're asking to u

[R] using cat()

2009-08-06 Thread [Ricardo Rodriguez] Your XEN ICT Team
Please, could you give me an example about how to use cat() to read the value of a variable in a function? Any other way? I've found how to make it globally available, thus printing it, but I don't know how to read out the value of any variable within the function. Thanks for your help, Rica

[R] BRugs in Linux?

2009-08-06 Thread massiel
Hello,    I am trying to learn how to run Bugs from R using Linux…I’m new at Linux so I have been looking what others do on the web, but the info is confusing. Is there any good source where to go and learn how to set up and run Bugs from R in Linux? When I needed to do this with windows I

Re: [R] A question regarding R scoping

2009-08-06 Thread Gabor Grothendieck
Steve and others have already directly answered your question but to add to that note that the way this would normally be done in R is to avoid the need for references and environment handling in the first place and just have f1 pass i back and have f2 assign f1's output to i. f1 <- function(i) 1

Re: [R] Logit Model... GLM or GEE or ??

2009-08-06 Thread Noah Silverman
Thanks Roger, I appreciate the feedback. The paper I'm reading makes it sound like a very simple step. I'm still not sure how to do this. I'll keep reading. Thanks! -N On 8/6/09 3:15 PM, roger koenker wrote: > You could take a look at: > > M West, PJ Harrison, HS Migon - Journal of the Amer

Re: [R] Logit Model... GLM or GEE or ??

2009-08-06 Thread roger koenker
You could take a look at: M West, PJ Harrison, HS Migon - Journal of the American Statistical Association, 1985 - jstor.org Page 1. Dynamic Generalized Linear Models and Bayesian Forecasting and the subsequent literature it has generated... or along the same lines the literature on chess r

Re: [R] Why is 0 not an integer?

2009-08-06 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Giovanni Petris > Sent: Thursday, August 06, 2009 3:00 PM > To: milton.ru...@gmail.com > Cc: r-help@r-project.org; daniel.gerl...@geodecapital.com > Subject: Re: [R] Why is 0 not

Re: [R] A question regarding R scoping

2009-08-06 Thread Ivo Shterev
Hi, Perhaps I have to rephrase a bit my question. If we have the following: i = 10 f1 = function(i){ i <<- 1 } after calling f1, the value of i becomes 1. Now, suppose that f1 is called in another function f2, and i is initialized in f2 as well, i.e: f2 = function(n){ i = n f1(i) } The inten

[R] Logit Model... GLM or GEE or ??

2009-08-06 Thread Noah Silverman
Posted about this earlier. Didn't receive any response But, some further research leads me to believe that MAYBE a GLMM or a GEE function will do what I need. Hello, I have a bit of a tricky puzzle with trying to implement a logit model as described in a paper. The particular paper is on

Re: [R] Why is 0 not an integer?

2009-08-06 Thread Giovanni Petris
I ran an instant experiment... > typeof(0) [1] "double" > typeof(-0) [1] "double" > identical(0, -0) [1] TRUE Best, Giovanni > By the way: > > Are there difference between -0 and 0? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/l

Re: [R] Time Series smoothing

2009-08-06 Thread Giovanni Petris
Please do read the posting guides and give us a reproducible example. We don't know what the errors you get from HoltWinters are. I guess we need to see the data you are using etc. Giovanni Petris > Date: Thu, 06 Aug 2009 11:33:58 -0700 (PDT) > From: voidobscura > Sender: r-help-boun...@r-proje

Re: [R] Why is 0 not an integer?

2009-08-06 Thread milton ruser
By the way: Are there difference between -0 and 0? On Thu, Aug 6, 2009 at 5:00 PM, Gerlanc, Daniel < daniel.gerl...@geodecapital.com> wrote: > b/c > > class(0) > [1] "numeric" > > > typeof(0) > [1] "double" > > > class(0L) > [1] "integer" > > > typeof(0L) > [1] "integer" > > When you call the

Re: [R] Convert dataframe to table with counts where column namesbecome row names

2009-08-06 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius > Sent: Thursday, August 06, 2009 1:40 PM > To: ghinkle > Cc: r-help@r-project.org > Subject: Re: [R] Convert dataframe to table with counts where > column namesb

Re: [R] Redoing axis in a strip plot

2009-08-06 Thread Mehdi Khan
Well, the tick marks are at every 200, how do i make them at every 100? On Thu, Aug 6, 2009 at 2:02 PM, Mehdi Khan wrote: > nevermind, I just looked at Steve's reply to mohsen and it worked! > stripplot(jitter(clahanvs30) ~ vs30, data = completetable, ylim=c(0:2000), > xlim=c(0:2000)) > > > On T

Re: [R] problem with recording numeric output into another dataframe

2009-08-06 Thread Henrique Dallazuanna
Try this: g <- sapply(DF1$ID, grep, x = DF2$ID) transform(DF2[unlist(g),],ID = DF1$ID[which(g > 0)]) On Thu, Aug 6, 2009 at 1:41 PM, Rnewbie wrote: > > dear all, > > I have two dataframes > > dataframe1 > ID > a > b > c > > dataframe2 > ID value > a;W 100 > X;c 200 > Y;Z 300

Re: [R] Redoing axis in a strip plot

2009-08-06 Thread Mehdi Khan
nevermind, I just looked at Steve's reply to mohsen and it worked! stripplot(jitter(clahanvs30) ~ vs30, data = completetable, ylim=c(0:2000), xlim=c(0:2000)) On Thu, Aug 6, 2009 at 1:54 PM, Mehdi Khan wrote: > Hello everyone, simple question--the documentation is confusing so i am > forced to as

Re: [R] Why is 0 not an integer?

2009-08-06 Thread Gerlanc, Daniel
b/c > class(0) [1] "numeric" > typeof(0) [1] "double" > class(0L) [1] "integer" > typeof(0L) [1] "integer" When you call the ":" function it always returns an integer sequence, but when you assign a numeric to an element of the vector it gets coerced to the more general type, in this case, nume

Re: [R] Ylim

2009-08-06 Thread Steve Lianoglou
Hi, On Aug 6, 2009, at 4:48 PM, Mohsen Jafarikia wrote: Hello All: Can anybody tell me what is the problem with my program please. I have an error message as appears below. My program is: ifn <- "Jul08_09.LM" data <- read.table(ifn) ofn <- "Jul.png" bitmap(ofn, type = "png256", width = 3

[R] Redoing axis in a strip plot

2009-08-06 Thread Mehdi Khan
Hello everyone, simple question--the documentation is confusing so i am forced to ask: I have a strip plot, how do create my own axis tick marks and set limits? Thanks! stripplot(jitter(clahanvs30) ~ vs30, data = completetable) Mehdi Khan [[alternative HTML version deleted]]

[R] Ylim

2009-08-06 Thread Mohsen Jafarikia
Hello All: Can anybody tell me what is the problem with my program please. I have an error message as appears below. My program is: ifn <- "Jul08_09.LM" data <- read.table(ifn) ofn <- "Jul.png" bitmap(ofn, type = "png256", width = 30, height = 30, pointsize = 30, bg = "white",res=50) par(mar=c(

Re: [R] Repeatable, But Time Varying R GUI Crash

2009-08-06 Thread Duncan Murdoch
On 8/6/2009 4:11 PM, Marilyn & Rich Short wrote: Hello, I'm having a problem in R. The R GUI is crashing with a message to contact Microsoft for the solution. I've contacted Microsoft and they are of no help. Below is a distilled set of code that will cause the crash. As you will see, there a

Re: [R] Convert dataframe to table with counts where column names become row names

2009-08-06 Thread David Winsemius
On Aug 6, 2009, at 1:14 PM, ghinkle wrote: Can anyone explain how best to go from a dataframe to a table (or better yet a new dataframe) of counts, where the row names in the new table (or dataframe) are the column names of the original df. start w/ DF1 = Pos1 Pos2 Pos3 oli

Re: [R] Convert dataframe to table with counts where column names become row names

2009-08-06 Thread Henrique Dallazuanna
Try this: t(sapply(DF1, table)) On Thu, Aug 6, 2009 at 2:14 PM, ghinkle wrote: > > Can anyone explain how best to go from a dataframe to a table (or better > yet > a new dataframe) of counts, where the row names in the new table (or > dataframe) are the column names of the original df. > > start

Re: [R] A question regarding R scoping

2009-08-06 Thread Erik Iverson
So is your question: Can you/how do you pass variables by reference in R? I do not know the answer, but I do think that is what you're getting at, yes? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ivo Shterev Sent: Thursday

Re: [R] A question regarding R scoping

2009-08-06 Thread Duncan Murdoch
On 8/6/2009 4:11 PM, Ivo Shterev wrote: Hi, The intention is that after executing f2, the value of i to become 1. f1 = function(i){i = 1} f2 = function(n){ i = length(n) f1(i) print(i)} i.e. f2 should print 1, not length(n). ivo --- On Thu, 8/6/09, Steve Lianoglou wrote: From: Steve Li

[R] problem with recording numeric output into another dataframe

2009-08-06 Thread Rnewbie
dear all, I have two dataframes dataframe1 ID a b c dataframe2 ID value a;W 100 X;c 200 Y;Z 300 I wanted to match the IDs from the two dataframes and record the values into a new column of dataframe1 at the corresponding rows. This is what I expect: dataframe1 ID valu

Re: [R] A question regarding R scoping

2009-08-06 Thread Steve Lianoglou
Howdy, On Aug 6, 2009, at 4:11 PM, Ivo Shterev wrote: Hi, The intention is that after executing f2, the value of i to become 1. f1 = function(i){i = 1} f2 = function(n){ i = length(n) f1(i) print(i)} i.e. f2 should print 1, not length(n). Yeah, you can using parent.frame()'s and such: f

[R] Repeatable, But Time Varying R GUI Crash

2009-08-06 Thread Marilyn & Rich Short
Hello, I'm having a problem in R. The R GUI is crashing with a message to contact Microsoft for the solution. I've contacted Microsoft and they are of no help. Below is a distilled set of code that will cause the crash. As you will see, there are two do-loops within which is a "load" command.

[R] filter function for time series

2009-08-06 Thread voidobscura
Hi all, I just need help understanding the filter function. I've seen how to use it to smooth a time series, but how do you know which is a good smoothing? Also, I have seen people do things like x1 = filter(x,filter=rep(1/5,5)) or x2 = filter(x,filter=rep(1/10,10)). I know that rep creates a

Re: [R] How to show help in the same mode as where the commands is input?

2009-08-06 Thread Peng Yu
It freezes at the last line. Do you know why? > dump.pager <- function( files, ...){ +cat( readLines( files ), sep = "\n" ) + } > options( pager = dump.pager ) > help(ls) Help on topic 'ls' was found in the following packages: Package Library AnnotationDbi /home/

[R] Time Series smoothing

2009-08-06 Thread voidobscura
I have a set of data (in a matrix). I spliced a column out and parsed it as.ts (time series). I then plotted the time series but I found that it was very noisy. I wanted to smooth it out. However, I am having some problems smoothing and plotting the smoothed version. > A <- as.ts(read.table

[R] tukey test for interaction

2009-08-06 Thread Hirondelle Varady-Szabo
Hello I have performed the following ANOVA test (age = young and old, tret = non treated and treated): > ANOVA_EPC<-aov(Dibi ~ age*tret, data = EPC) > summary(ANOVA_EPC) Df Sum Sq Mean Sq F value Pr(>F) age 1 25.346 25.346 2.4510 0.13587 tret 1 5.962 5.96

[R] Convert dataframe to table with counts where column names become row names

2009-08-06 Thread ghinkle
Can anyone explain how best to go from a dataframe to a table (or better yet a new dataframe) of counts, where the row names in the new table (or dataframe) are the column names of the original df. start w/ DF1 = Pos1 Pos2 Pos3 oligo1 G C A oligo2 U U A o

Re: [R] A question regarding R scoping

2009-08-06 Thread Ivo Shterev
Hi, The intention is that after executing f2, the value of i to become 1. f1 = function(i){i = 1} f2 = function(n){ i = length(n) f1(i) print(i)} i.e. f2 should print 1, not length(n). ivo --- On Thu, 8/6/09, Steve Lianoglou wrote: > From: Steve Lianoglou > Subject: Re: [R] A question r

Re: [R] Using 'field names' of a data.frame in a function

2009-08-06 Thread Henrique Dallazuanna
Try this: myfunc <- function(...)table(...) with(mydataset, myfunc(ages, sex)) On Thu, Aug 6, 2009 at 4:50 PM, Polwart Calum (County Durham and Darlington NHS Foundation Trust) wrote: > I may be doing this wrong! but I have a function which I have simplified a > lot below. I want to pass some

[R] Write the results of sample function which uses a dataframe into an Array

2009-08-06 Thread Meenu Sahi
Dear All? Basically I want to write the results of the sample function into an array is a specific order. The sample function uses a dataframe x.1 and therefore the result is also a dataframe and so I cannot write the result into the array in the correct order. If I convert x.1 into a matrix then

Re: [R] writing a simulation

2009-08-06 Thread Meenu Sahi
Dear All I 've solved this problem... Thanks Meenu On Thu, Aug 6, 2009 at 1:28 AM, Meenu Sahi wrote: > No its not an or condition. Please see the changed attachment. > > Many thanks for your help. > > Regards > Meenu > > On Wed, Aug 5, 2009 at 6:36 PM, David Winsemius wrote: > >> >> On Aug 4,

[R] Using 'field names' of a data.frame in a function

2009-08-06 Thread Polwart Calum (County Durham and Darlington NHS Foundation Trust)
I may be doing this wrong! but I have a function which I have simplified a lot below. I want to pass some 'field names' of a data-frame to the function for it to then do some manipulation of. Here's my code: #build a simple dataset mydataset = data.frame ( ages=c('40-49','40-49','40-49','30-

Re: [R] solving system of equations involving non-linearities

2009-08-06 Thread Berend Hasselman
Ravi Varadhan wrote: > > You have two options: > > 1. The `BBsolve' function in the "BB" package to solve this system of 3 > equations. > 2. Try `nleqslv' function in the "nleqslv" package. > > These would work even if the residual is not zero. > I hope so but I have some doubts. >From th

Re: [R] How to show help in the same mode as where the commands is input?

2009-08-06 Thread Romain Francois
Hi, You can define your own pager: Something like this might do what you want: dump.pager <- function( files, ...){ cat( readLines( files ), sep = "\n" ) } options( pager = dump.pager ) Romain On 08/06/2009 08:59 PM, Peng Yu wrote: Hi, In R command line, when I type "help(something)

Re: [R] How to execute a R script but outputting the result to the screen?

2009-08-06 Thread Peng Yu
Is there a command line option for me to figure out what R version Rscript calls? On Aug 6, 10:23 am, Gabor Grothendieck wrote: > Try: > > Rscript -e R.version.string > > to get the R version, or > > Rscript --version > > if you want to know the version of Rscipt itself rather than R. > > > > On

[R] Using system fonts in MacOS

2009-08-06 Thread Daniel J Farrell
Dear r-help, I am using R for MacOS (R 2.9.1 GUI 1.28 Tiger build 32-bit (5444)) and would like to be able to use MacOS system fonts for the labels on my plots. So far I have been unsuccessful, to get this to work. Reading the help I found the quartz() and quartzFonts() commands. In an at

[R] How to show help in the same mode as where the commands is input?

2009-08-06 Thread Peng Yu
Hi, In R command line, when I type "help(something)", it will always show the help in the different mode such that I don't see command lines anymore but just the help document. If I quit from the help mode, I will only see the command lines by not the help document. I would like the help document

[R] Is there a 'vi' mode in R?

2009-08-06 Thread Peng Yu
Hi, I'm wondering if R provide a vi mode in the command line just like other shells such as bash do. Can somebody let me know? Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting gu

[R] Help with Logit Model

2009-08-06 Thread Noah Silverman
Hello, I have a bit of a tricky puzzle with trying to implement a logit model as described in a paper. The particular paper is on horseracing and they explain a model that is a logit trained "per race", yet somehow the coefficients are combined across all the training races to come up with a

Re: [R] Completion for custom "$" operator?

2009-08-06 Thread Deepayan Sarkar
On Thu, Aug 6, 2009 at 10:45 AM, Vitalie S. wrote: > >> >> Completion should be automatic if you define names() to return the valid >> names. > > Thank you Deepayan, that works beautifully. I wonder though; names function > for environment objects always returns NULL, but completion still works. >

[R] installing R on Solaris 10

2009-08-06 Thread Jeremy Willis
Anyone have any experience installing R on UNIX or Linux, I have a Solaris 10 server and have been trying to read the admin guide and install the R binaries on the machine. There are several failures due to an unknown pathname: "ERROR: attribute verification of failed pathname does not exist

Re: [R] Completion for custom "$" operator?

2009-08-06 Thread Vitalie S.
Completion should be automatic if you define names() to return the valid names. Thank you Deepayan, that works beautifully. I wonder though; names function for environment objects always returns NULL, but completion still works. Looks tricky. Vitalie. -- _

Re: [R] How to stop function printing unwanted output?

2009-08-06 Thread ml-r-help
?capture.output so with the given example this line should do what you wanted while avoiding the output file dummy <- capture.output(comparison <- LSD.test(yield,virus,df,MSerror, p.adj="bonferroni", group=FALSE, main="Yield of sweetpotato\ndealt with different virus")) Matthias David Winsemi

Re: [R] problem installing cairo on freebsd

2009-08-06 Thread Rainer Hurling
Late, but hopefully not too late ... Ben, I had same problem with Cairo-1.4-5 on FreeBSD CURRENT-8.0 (i386). On of the authors of Cairo (thanks to Simon Urbanek) reminded me to use gmake instead of make. So in my case I set the environment variable temporarily like this (in tcsh): setenv M

Re: [R] Help ::Not able to Connect R to SQL Server 2000

2009-08-06 Thread Simon Urbanek
On Aug 6, 2009, at 10:36 , bed.si...@oracle.com wrote: Hi Simon, I am using the R 2.9.1 with Window XP. I have one query related with R to the database. I have successfully connected R to MS-Access. But when I tried to connect R to SQL Server 2000 then it throwing some class not foun

Re: [R] How to stop function printing unwanted output?

2009-08-06 Thread David Winsemius
On Aug 6, 2009, at 12:24 PM, Erik Iverson wrote: In my example, I don't want LSD.test to print any output, I just want to use some of it later... How to stop it printing anything? ?invisible I'm not sure that works in this situation: test <- function() { print("output") } test() invi

Re: [R] How to stop function printing unwanted output?

2009-08-06 Thread Erik Iverson
>> In my example, I don't want LSD.test to print any output, I just want >> to use some of it later... How to stop it printing anything? >?invisible I'm not sure that works in this situation: test <- function() { print("output") } test() invisible(test()) Both of the above still print out

Re: [R] How to stop function printing unwanted output?

2009-08-06 Thread David Winsemius
On Aug 6, 2009, at 11:42 AM, Tymek W wrote: Hi, I want to use an output of one function (LSD.test) in other. How is it that while saving output from LSD.test to variable, it prints own output out? The function could be simplified to: fun <- function ( ... ) { ... lsd <- LSD.test(data[1

[R] Matrix function

2009-08-06 Thread Marlin Keith Cox
Hi, I have an equation Xcp and would like to look at errors affecting it. I am applying errors of -.58 to .1 to R and -.45 to .47 to Xc. I would like to look at all combinations. I set up a matrix function as follows and it does not work. On the last line, when it run, it does not seem like the

Re: [R] random between two values

2009-08-06 Thread Scott Sherrill-Mix
Or just use runif's built-in bounds: thisMin<-40.15 thisMax<-56.58 runif(1,thisMin,thisMax) Scott Scott Sherrill-Mix Department of Microbiology University of Pennsylvania 402B Johnson Pavilion 3610 Hamilton Walk Philadelphia, PA 19104-6076 On Thu, Aug 6, 2009 at 11:11 AM, Sarah Goslee wrote

[R] How to stop function printing unwanted output?

2009-08-06 Thread Tymek W
Hi, I want to use an output of one function (LSD.test) in other. How is it that while saving output from LSD.test to variable, it prints own output out? The function could be simplified to: fun <- function ( ... ) { ... lsd <- LSD.test(data[1], data[2], df, mse) ... } In my example,

Re: [R] overlap two graph

2009-08-06 Thread Scott Sherrill-Mix
It really sounds like you want to use points(). Maybe I'm missing the true question but ellipsePoints returns a 2 column matrix of point coordinates so passing it's output to points() should plot those points on whatever plot you currently have open (in this case the plot of the previous ellipse).

Re: [R] Re move all punctuations except commas

2009-08-06 Thread Gabor Grothendieck
In the solution you cite, yes. In the second solution I provided in the subsequent (second) response to your question, no. On Thu, Aug 6, 2009 at 11:17 AM, Rnewbie wrote: > > it works, but does that mean I really have to specify what to keep rather > than what to remove? > > > Gabor Grothendieck

Re: [R] How to execute a R script but outputting the result to the screen?

2009-08-06 Thread Gabor Grothendieck
Try: Rscript -e R.version.string to get the R version, or Rscript --version if you want to know the version of Rscipt itself rather than R. On Thu, Aug 6, 2009 at 11:18 AM, Peng Yu wrote: > I didn't know that OS matters. My machine is a linux machine. > > I have a few different version of R in

Re: [R] Re move all punctuations except commas

2009-08-06 Thread Rnewbie
it works, but does that mean I really have to specify what to keep rather than what to remove? Gabor Grothendieck wrote: > > Try something along these lines: > > gsub("[^[:alnum:][:space:],]", "", string) > > > On Thu, Aug 6, 2009 at 8:37 AM, Rnewbie wrote: >> >> Dear all, >> >> I wanted to

[R] Select subset with specific distribution parameters.

2009-08-06 Thread sedm1000
This may be a simple problem, but I am looking to select a subset of rows from a dataframe that will have the same parameters as all the rows in another dataframe. e.g. I have a 500 row dataframe with 20 columns. I want to select a subset of rows from a larger dataframe that match the distributi

Re: [R] Re move all punctuations except commas

2009-08-06 Thread Gabor Grothendieck
Here is a second solution that may be closer to what you were thinking of in terms of structure: library(gsubfn) gsubfn("[[:punct:]]", ~ sub("[^,]", "", x), string) This matches each punctuation character and then removes any non-commas by applying the function function(x)sub("[^,]", "", x) gsub

Re: [R] How to execute a R script but outputting the result to the screen?

2009-08-06 Thread Peng Yu
I didn't know that OS matters. My machine is a linux machine. I have a few different version of R installed in my machine (different commands like R, R-2.9.0, R-2.8 ..). But I don't see the version of Rscript. How to figure out which version of R my Rscript uses? Regards, Peng On Thu, Aug 6, 200

Re: [R] random between two values

2009-08-06 Thread Sarah Goslee
That's pretty straightforward to do - here's a simple function. The exact behavior at the "edges" is left as an exercise. :) rbound <- function(rmin, rmax) { x <- runif(1) x <- x * (rmax - rmin) + rmin x } Sarah On Thu, Aug 6, 2009 at 11:02 AM, damien landais wrote: > Hi, > I would obt

Re: [R] random between two values

2009-08-06 Thread Alfredo
sample(c("a","b"))[1] -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of damien landais Sent: Thursday, August 06, 2009 11:02 AM To: R-help@r-project.org Subject: [R] random between two values Hi, I would obtain a random value between

Re: [R] S4 method dispatch: coercion of arguments with setAs defined

2009-08-06 Thread Renaud Gaujoux
Thanks Martin, it's clearer now. Indeed things get a bit dirty with replace methods. I'm wondering if it's a bug, a normal behaviour or if there is nothing to do about it? I think it's because the replace method of A into B is not called after replacing an object's slot. I imagine this would be

[R] random between two values

2009-08-06 Thread damien landais
Hi, I would obtain a random value between two (for example between 40.15 and 56.58 I would have only one value). I'm looking for a package/a function which could do this. Could anybody help me please? Cordialement Damien Landais __ R-help@r-project.org

Re: [R] Re move all punctuations except commas

2009-08-06 Thread Gabor Grothendieck
Try something along these lines: gsub("[^[:alnum:][:space:],]", "", string) On Thu, Aug 6, 2009 at 8:37 AM, Rnewbie wrote: > > Dear all, > > I wanted to remove all punctuations except commas from a string. > > I used: > > gsub("[[:punct:]]", "", string) > > but I don't know how to exclude the co

[R] donlp2

2009-08-06 Thread Yoonus CA
Dear Sir, I am working with one example in R donlp2. How I can get the Hessian matrix from the output. p = c(10,10) par.l = c(-100,-100) par.u = c(100,100) nlin.l = nlin.u = 2 fn = function(x) { x[1]^2+x[2]^2 } dfn = function(x){ c(2*x[1], 2*x[2]) } attr(fn, "gr") = dfn nlcon = function(x){ x

Re: [R] Re move all punctuations except commas

2009-08-06 Thread Henrique Dallazuanna
Try this: string <- "Aaaa. , ccc" gsub("[^,[:alpha:]|[:space:]]", "", string) On Thu, Aug 6, 2009 at 9:37 AM, Rnewbie wrote: > > Dear all, > > I wanted to remove all punctuations except commas from a string. > > I used: > > gsub("[[:punct:]]", "", string) > > but I don't know how to exclude

[R] Seasonal analysis

2009-08-06 Thread ehxpieterse
Hi, Are there any R packages around which would break down a time series into a MxN table for analysis purposes? For example, show the total sales per month per calendar year. Jan Feb. Total 2008 2009 Total Thanks, Eduard -- View this message in context: http://www.nabble.com/

[R] Help ::Not able to Connect R to SQL Server 2000

2009-08-06 Thread bed.si...@oracle.com
Hi Simon, I am using the R 2.9.1 with Window XP. I have one query related with R to the database. I have successfully connected R to MS-Access. But when I tried to connect R to SQL Server 2000 then it throwing some class not found error. I tried the below script for R

[R] xyplot and subscripts

2009-08-06 Thread Kito Palaxou
Hi all, I have a data frame like this: DF <- data.frame(x = rnorm(10), y = rnorm(10), gr = rep(1:5, 2)) and I make the following xy-plot: library(lattice) xyplot(y ~ x, data = DF, groups = gr, type = "b", col = 1) Is it possible that the two points that belong to the same group specified by

[R] Re move all punctuations except commas

2009-08-06 Thread Rnewbie
Dear all, I wanted to remove all punctuations except commas from a string. I used: gsub("[[:punct:]]", "", string) but I don't know how to exclude the commas ",". Anyone would kindly answer my basic question? -- View this message in context: http://www.nabble.com/Remove-all-punctuations-exce

Re: [R] Error: function cannot be evaluated at initial parameters

2009-08-06 Thread Anmol Mohan
I am facing a similar problem The code which i am pasting below has been taken from the book "Bayesian Computation with R" by Jim Albert. laplace=function (logpost, mode, par) { options(warn=-1) fit=optim(mode, logpost, gr = NULL, par, hessian=TRUE, control=list(fnscale=-1)) o

Re: [R] How to execute a R script but outputting the result to the screen?

2009-08-06 Thread Erik Iverson
You did not specify your OS, but you might try at the shell prompt: Rscript file.R See ?Rscript -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peng Yu Sent: Thursday, August 06, 2009 9:35 AM To: r-h...@stat.math.ethz.ch Subject:

Re: [R] problem with r import data

2009-08-06 Thread John Kane
?read.table and check on the options offered by read.csv2. Open the file in a text editor and see what you have. Check the delimiters and be sure that that they are either ; as specified in read.csv2 or else specify the delimiter ( sep= "???" --- On Thu, 8/6/09, Inchallah Yarab wrote: > F

[R] How to execute a R script but outputting the result to the screen?

2009-08-06 Thread Peng Yu
Hi, If I run the below command, it will generate a file 'file.Rout' to save the output. But I want the output be shown in the screen directly. I'm wondering if there is a direct way to do so. R CMD BATCH file.R Regards, Peng __ R-help@r-project.org ma

Re: [R] solving system of equations involving non-linearities

2009-08-06 Thread Ravi Varadhan
You have two options: 1. The `BBsolve' function in the "BB" package to solve this system of 3 equations. 2. Try `nleqslv' function in the "nleqslv" package. These would work even if the residual is not zero. Hope this helps, Ravi. __

Re: [R] delete lines

2009-08-06 Thread Henrique Dallazuanna
Try this: m[!apply(m < 0, 1, any),] On Thu, Aug 6, 2009 at 9:57 AM, Inchallah Yarab wrote: > Hi , > > I need to write a function to delete a row if the value of one element of > the row is negatif!!! > I have a big file of data and i will check every lines!!! > > Any ideas > Thank you !! > > > >

Re: [R] Some SQL Challenges

2009-08-06 Thread Don MacQueen
Don't understand what this has to do with SQL, or why you're asking for SQL solutions in an R mailing list, but here are some R suggestions. (abbreviating "COLUMN" with "C") At 11:40 AM -0700 8/3/09, JoK LoQ wrote: Hi, Im trying to complete a list of jobs using SQL Querries and some "if else

Re: [R] making scatter plot points fill semi-transparent

2009-08-06 Thread Felipe Carrillo
You can also use ggplot2: library(ggplot2) x <- rnorm(1);y <- rnorm(x);myplot <- data.frame(x,y) qplot(x,y,data= myplot,colour=I(alpha("blue",1/25))) Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA --- On Wed, 8

Re: [R] calasification table under conditions

2009-08-06 Thread Steve Lianoglou
Hi, On Aug 6, 2009, at 9:26 AM, Inchallah Yarab wrote: hi, i have a file with 49000 lines i want to do a classification in two tables suppose data <- read.csv2("c:/total.csv", sep=",") if the second colonne contains ( A,B,C,D)> tab1 if the second colonne contains ( E,F,G,H)-

  1   2   >