Re: [R] Advantages of using SQLite for data import in comparison to csv files

2010-01-13 Thread Juliet Jacobson
Thanks for your answer. I hadn't found this possibility by web search. Since sqldf also allows the import of tables from csv files, complex SELECT queries and even joins on tables, I have the impression that there aren't any reasons for using a SQLite database to organise the data for R. But then w

[R] Odp: Better way than an ifelse statement?

2010-01-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 14.01.2010 08:05:14: > Hello All, > > I am trying to create a column of weights based off of factor levels > from another column. I am using the weights to calculate L scores. > Here is an example where the first column are scores, the second is my > "

Re: [R] Multiple symbols per single line in a legend

2010-01-13 Thread Jim Lemon
On 01/13/2010 01:50 AM, Primoz PETERLIN wrote: Hello everybody, Is it possible to coax legend() into displaying more than one simbol per line in legend? I have a graph like the one attached to this mail; I would like to reorganize the legend in such a way that the duplicate text would be omitted

[R] Odp: a question about deleting rows

2010-01-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.01.2010 23:15:05: > > I have a file like this: > idn1n2 n3 n4 n5 n6 > 1 3 47 8 102 > 2 4 12 4 3 10 > 3 7 00 0 0 8 > 4 1010 0 2 3 > 5

Re: [R] Better way than an ifelse statement?

2010-01-13 Thread Ista Zahn
There is a recode function in the Hmisc package that might help: library(Hmisc) example$X3 <- recode(example$X2, 1:4, c(-3,-1,1,3)) -Ista On Thu, Jan 14, 2010 at 2:05 AM, Joshua Wiley wrote: > Hello All, > > I am trying to create a column of weights based off of factor levels > from another col

[R] Better way than an ifelse statement?

2010-01-13 Thread Joshua Wiley
Hello All, I am trying to create a column of weights based off of factor levels from another column. I am using the weights to calculate L scores. Here is an example where the first column are scores, the second is my "factor" and the third I want to be a column of weights. I can do what I want

Re: [R] HTML translation problem in R-2.10.1

2010-01-13 Thread Jim Lemon
Hi again, It's the \samp (and thus the HTML span tag) that does it. I removed the \samp from one of the links and rebuilt, and the link is properly translated. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLE

[R] HTML translation problem in R-2.10.1

2010-01-13 Thread Jim Lemon
Hi Core Team, I received an email about a problem with the help on the plotrix package. Apparently the \link tags in the help pages were showing up as literal text. I couldn't see this problem, nor any problem with the Rd files. Since the plotrix package hasn't been built for a while, I rechec

Re: [R] How to install old randomForest?

2010-01-13 Thread David Scott
Julian Ramirez wrote: Hi Ted, You need to unzip and untar the files that are inside that file, and then build the package using R CMD build --binary PackageName. However, for compiling a package under a windows environment you will need Rtools2.10 from Duncan Murdoch, along with Miktex, and html

Re: [R] Mixtures of Discrete Uniforms

2010-01-13 Thread GlenB
Jim Silverton wrote: > > I want to create the mixture formulation of a discrete uniform ie, say > f(x) = 1/10, for i = 1,2,3,4,5,6,7,8,9 and 10 and > another discrete distribution which has the same values of x, but he > probabilities can vary. Can this be done on any package in R? an if so, >

Re: [R] How to install old randomForest?

2010-01-13 Thread Julian Ramirez
Hi Ted, You need to unzip and untar the files that are inside that file, and then build the package using R CMD build --binary PackageName. However, for compiling a package under a windows environment you will need Rtools2.10 from Duncan Murdoch, along with Miktex, and html workshop from microsoft

[R] How to install old randomForest?

2010-01-13 Thread Chang, C-Y.
Hi all, I'm using windowsXP and R 2.10.0. I downloaded "randomForest 4.5-33.tar.gz" from its archive, but how do I make it into a installation ZIP file? Thanks, Ted __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help P

[R] Bootstrap for correlation coefficient

2010-01-13 Thread Roslina Zakaria
I have the following code:   ## to check correlation between the simulated uniform data x2 <- uni[,1] ; x2[1:10] y2 <- uni[,2] ; y2[1:10] result2 <- boot(cbind(x2,y2), f, 20) # get 95% confidence interval boot.ci(result2, type="bca") cor.test(x2,y2, method="pearson", conf.level=0.95)   part of my

Re: [R] Help, How can I boxplot mse and mtry using 20 5-fold cross-validation?

2010-01-13 Thread bbslover
thank Max. you are so responsible, every time, you give me a lot of help. On my learning road, you are my guide, though we do not know each other. best wishes kevin 在2010-01-14,"Max Kuhn [via R]" 写道: -原始邮件- 发件人:"Max Kuhn [via R]" 发送时间:2010å¹´1æ

Re: [R] apply a function down each column

2010-01-13 Thread Laetitia Schmid
Thank you very much! It works now perfectly. I even extended it to be able to apply it to the whole dataset: data<-read.delim("mhc_data.txt", stringsAsFactors=FALSE) lettermatch <- function(a, b) { tb <- merge(as.data.frame(table(strsplit(a, ""))), as.data.frame(table(strsplit(b, ""))), by

[R] installing RCurl when libcurl is in non-standard location

2010-01-13 Thread Janet Young
Hi, I'm struggling to install RCurl for 32-bit linux and am hoping for some suggestions. I obtained RCurl_1.3-1.tar.gz from CRAN today, and am using a very recent version of R: R version 2.10.1 Patched (2010-01-12 r50970). I'm not the sysadmin for this system (disclaimer: my sysadmin skil

Re: [R] FW: Problems connecting with MySQL using odbcDriverConnect (RODBC package) on Linux

2010-01-13 Thread Orvalho Augusto
Thanks you solved and share with us. But, why don't you use the RMySQL, which connects to MySQL without the need of ODBC? Caveman On Wed, Jan 13, 2010 at 1:48 AM, Marcus, Jeffrey wrote: > I think I figured this out. I should not have put the Driver name in > braces. Changing it from {MySQL} to

Re: [R] Formula for normal distribution with know mean and standard error and n terms

2010-01-13 Thread GlenB
steve_fried...@nps.gov wrote: > > I am searching for a method to calculate a normal distribution. > > For example this equation is used to calculate the normal curve when the > mean and standard deviation are know. > p(x) = (1/σ*sqrt(2π)) x exp (- (x-μ)2/2σ2) > > However, some of the literatu

Re: [R] optimization challenge

2010-01-13 Thread Albyn Jones
Hi Aaron! It's always nice to see a former student doing well. Thanks for the notes and references, too! albyn On Wed, Jan 13, 2010 at 07:29:57PM -0500, Aaron Mackey wrote: > FYI, in bioinformatics, we use dynamic programming algorithms in similar > ways to solve similar problems of finding gua

Re: [R] Error: object of type 'closure' is not subsettable

2010-01-13 Thread Gabor Grothendieck
See ?rep where it says that the argument must be a vector. Try rep(list(sin), 3) On Wed, Jan 13, 2010 at 8:11 PM, Matthew Walker wrote: > Hi everyone, > > Would somebody please explain (or point me to a reference that explains) the > following error: > > "Error: object of type 'closure' is no

[R] package spam for R64-devel

2010-01-13 Thread Julian Ramirez
Dear Uwe and all, First of all, I want to congratulate you for your dedication in providing and maintaining R for 64bit operating systems. I tried the 64bit version of R, under a windows server 2003 system. It seems to work properly, but am concerned since I need to use the package "fields", which

[R] Error: object of type 'closure' is not subsettable

2010-01-13 Thread Matthew Walker
Hi everyone, Would somebody please explain (or point me to a reference that explains) the following error: "Error: object of type 'closure' is not subsettable" I was trying to use rep() to replicate a function: > example_function <- function() { return(TRUE) } > rep(example_function, 3) Erro

Re: [R] Updated comparison table for SAS-SPSS Add-ons and R Functions

2010-01-13 Thread Muenchen, Robert A (Bob)
>From: b.rowling...@googlemail.com [mailto:b.rowling...@googlemail.com] On >Behalf Of Barry Rowlingson >Sent: Wednesday, January 13, 2010 7:03 PM >To: Muenchen, Robert A (Bob) >Cc: r-help@r-project.org >Subject: Re: [R] Updated comparison table for SAS-SPSS Add-ons and R Functions > >Maybe the fir

Re: [R] optimization challenge

2010-01-13 Thread Aaron Mackey
FYI, in bioinformatics, we use dynamic programming algorithms in similar ways to solve similar problems of finding guaranteed-optimal partitions in streams of data (usually DNA or protein sequence, but sometimes numerical data from chip-arrays). These "path optimization" algorithms are often calle

Re: [R] a question about deleting rows

2010-01-13 Thread jim holtman
Try this: > x id n1 n2 n3 n4 n5 n6 1 1 3 4 7 8 10 2 2 2 4 1 2 4 3 10 3 3 7 0 0 0 0 8 4 4 10 1 0 0 2 3 5 5 11 1 0 0 0 5 > delete <- with(x, n2 == 0 & n3 == 0 & n4 == 0 & n5 == 0) > delete [1] FALSE FALSE TRUE FALSE FALSE > x[!delete,] id n1 n2 n3 n4 n5 n6 1 1 3

Re: [R] a question about deleting rows

2010-01-13 Thread Steve Taylor
yourdataframe = subset(yourdataframe, !(n2==0 & n3==0 & n4==0 & n5==0)) >>> From: karena To: Date: 14/Jan/2010 12:24 p.m. Subject: [R] a question about deleting rows I have a file like this: idn1n2 n3 n4 n5 n6 1 3 47 8 102 2 4 12 4

Re: [R] Updated comparison table for SAS-SPSS Add-ons and R Functions

2010-01-13 Thread Barry Rowlingson
On Wed, Jan 13, 2010 at 11:53 PM, Muenchen, Robert A (Bob) wrote: > Hi All, > > I have substantially expanded the table that compares SAS and SPSS > add-on modules to somewhat equivalent R packages. This new version is > at: > http://r4stats.com/add-on-modules > and I would very much appreciate a

[R] Updated comparison table for SAS-SPSS Add-ons and R Functions

2010-01-13 Thread Muenchen, Robert A (Bob)
Hi All, I have substantially expanded the table that compares SAS and SPSS add-on modules to somewhat equivalent R packages. This new version is at: http://r4stats.com/add-on-modules and I would very much appreciate any feedback you might have on it. The site http://r4stats.com is the replacemen

Re: [R] optimization challenge

2010-01-13 Thread Ravi Varadhan
Greg - thanks for posting this interesting problem. Albyn - thanks for posting a solution. Now, I have some questions: (1) is the algorithm guaranteed to find a "best" solution? (2) can there be multiple solutions (it seems like there can be more than 1 solution depending on the data)?, and (3) i

Re: [R] merging issue.........

2010-01-13 Thread karena
thank you very much! -- View this message in context: http://n4.nabble.com/merging-issue-tp1013356p1013433.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] counting the number of times a string appears

2010-01-13 Thread Jesse Sinclair
This is great all. It works perfectly. Thank-you. Cheers, Jesse On Wed, Jan 13, 2010 at 14:27, Adrian Dusa wrote: > Hi Jesse, > > If your vector is called "aa", then how about: > > > table(aa) > aa > spp1 spp10 spp2 spp3 spp4 spp5 spp6 spp7 spp8 spp9 >7 216 815

[R] a question about deleting rows

2010-01-13 Thread karena
I have a file like this: idn1n2 n3 n4 n5 n6 1 3 47 8 102 2 4 12 4 3 10 3 7 00 0 0 8 4 1010 0 2 3 5 1110 0 0 5 what I want to do is: only if n2=0 and n3=0

Re: [R] Operating on each row of data frame

2010-01-13 Thread Stephan Kolassa
Hi, does this do what you want? d <- cbind(d,apply(d[,c(2,3,4)],1,mean),apply(d[,c(2,3,4)],1,sd)) HTH, Stephan Abhishek Pratap schrieb: Hi All I have a data frame in which there are 4 columns . Column 1 : name Column 2-4 : values I would like to calculate mean/Standard error of values i

Re: [R] counting the number of times a string appears

2010-01-13 Thread Adrian Dusa
Hi Jesse, If your vector is called "aa", then how about: > table(aa) aa spp1 spp10 spp2 spp3 spp4 spp5 spp6 spp7 spp8 spp9 7 216 815 9 910 915 Hope this helps, Adrian On Thursday 14 January 2010, Jesse Sinclair wrote: > Hi all, > > I have a vec

Re: [R] merging issue.........

2010-01-13 Thread Heinz Tuechler
Did you consider to look at the help page for merge? h At 22:01 13.01.2010, karena wrote: hi, I have a question about merging two files. For example, I have two files, the first file is like the following: id trait1 110.2 211.1 39.7 610.2 78.9 10 9.7 11 10.2 The second

Re: [R] merging issue.........

2010-01-13 Thread Adrian Dusa
Hi Karean, If your first object is called obj1 and the second called obj2, then: > merge(obj1, obj2, all.x=TRUE) id trait1 trait2 1 1 10.29.8 2 2 11.1 10.8 3 39.7 NA 4 6 10.2 10.1 5 78.9 NA 6 109.7 NA 7 11 10.2 NA Hope this helps, Adrian On Wed

Re: [R] Advantages of using SQLite for data import in comparison to csv files

2010-01-13 Thread Gabor Grothendieck
You could look at read.csv.sql in sqldf (http://sqldf.googlecode.com) as well. On Wed, Jan 13, 2010 at 2:00 PM, Juliet Jacobson wrote: > Hello everybody out there using R, > > I'm using R for the analysis of biological data and write the results > down using LaTeX, both on a notebook with linux i

Re: [R] counting the number of times a string appears

2010-01-13 Thread Rolf Turner
?table On 14/01/2010, at 11:12 AM, Jesse Sinclair wrote: Hi all, I have a vector of strings and need to count the number of times a string appears in the vector. eg: [1] spp6 spp10 spp6 spp6 spp4 spp2 spp9 spp10 spp5 spp2 spp2 spp3 [13] spp4 spp3 spp6 spp10 spp6 spp4 sp

Re: [R] counting the number of times a string appears

2010-01-13 Thread Greg Hirson
Jesse, see ?table and try table(stringVector) Greg On 1/13/10 2:12 PM, Jesse Sinclair wrote: Hi all, I have a vector of strings and need to count the number of times a string appears in the vector. eg: [1] spp6 spp10 spp6 spp6 spp4 spp2 spp9 spp10 spp5 spp2 spp2 spp3 [13] spp4

Re: [R] Operating on each row of data frame

2010-01-13 Thread Abhishek Pratap
Thanks all for a very quick solution. It is actually good to know different ways to do the same things. It expands my limited understanding of R :). -A On Wed, Jan 13, 2010 at 5:12 PM, Stephan Kolassa wrote: > Hi, > > does this do what you want? > > d <- cbind(d,apply(d[,c(2,3,4)],1,mean),apply(

[R] counting the number of times a string appears

2010-01-13 Thread Jesse Sinclair
Hi all, I have a vector of strings and need to count the number of times a string appears in the vector. eg: [1] spp6 spp10 spp6 spp6 spp4 spp2 spp9 spp10 spp5 spp2 spp2 spp3 [13] spp4 spp3 spp6 spp10 spp6 spp4 spp9 spp3 spp6 spp1 spp10 spp8 [25] spp2 spp10 spp9 spp7 spp

[R] merging issue.........

2010-01-13 Thread karena
hi, I have a question about merging two files. For example, I have two files, the first file is like the following: id trait1 110.2 211.1 39.7 610.2 78.9 10 9.7 11 10.2 The second file is like the following: idtrait2 1 9.8 2 10.8 4 7.8 5 9.8 6 10.1

Re: [R] R package dependencies

2010-01-13 Thread Gabor Grothendieck
See the dep function defined here: http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7159.html On Wed, Jan 13, 2010 at 11:39 AM, Colin Millar wrote: > Hi there, > > My question relates to getting information about R packages.  In particular i > would like to be able to find from within R: >  what

Re: [R] Operating on each row of data frame

2010-01-13 Thread Pete B
Look at the apply function ?apply x = data.frame(x1=c(1,2,3,4,5),x2=c(2,4,6,8,10),x3=c(1,3,5,7,9)) x$x5=apply(x,1,mean) x$x6=apply(x,1,sd) print(x) Abhishek Pratap wrote: > > Hi All > > I have a data frame in which there are 4 columns . > > Column 1 : name > > Column 2-4 : values > > I w

Re: [R] Rollapply

2010-01-13 Thread Gabor Grothendieck
See: http://tolstoy.newcastle.edu.au/R/help/04/03/1446.html On Wed, Jan 13, 2010 at 3:45 PM, Pete B wrote: > > Hi > > I would like to understand how to extend the function (FUN) I am using in > rollapply below. > > ## > With the following simplified data, test

Re: [R] merging issue.........

2010-01-13 Thread Pete B
Try the merge function ?merge in1 = "id trait1 110.2 211.1 39.7 610.2 78.9 10 9.7 11 10.2 " in2 = "id trait2 1 9.8 2 10.8 4 7.8 5 9.8 6 10.1 1210.2 1310.1 " data1 = read.table(textConnection(in1), header=T) data2 = read.table(tex

[R] Operating on each row of data frame

2010-01-13 Thread Abhishek Pratap
Hi All I have a data frame in which there are 4 columns . Column 1 : name Column 2-4 : values I would like to calculate mean/Standard error of values in column 2-4 and store them in column 5,6 respectively. I have done the following but doesn't seem to work mean_N_SE <-function(x) { name

Re: [R] Ask for histogram

2010-01-13 Thread Yi Du
Thanks all, I fixed it. On Wed, Jan 13, 2010 at 2:47 PM, Don MacQueen wrote: > If I do > > b <- rnorm(4332) > hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) > rug(b) > > The plot looks entirely reasonable. > > As far as being different from SAS, perhaps SAS and R use different

Re: [R] Ask for histogram

2010-01-13 Thread Don MacQueen
If I do b <- rnorm(4332) hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) rug(b) The plot looks entirely reasonable. As far as being different from SAS, perhaps SAS and R use different breakpoints, that is, different boundaries between the histogram bars. -Don At 11:58 A

[R] Rollapply

2010-01-13 Thread Pete B
Hi I would like to understand how to extend the function (FUN) I am using in rollapply below. ## With the following simplified data, test1 yields parameters for a rolling regression data = data.frame(Xvar=c(70.67,70.54,69.87,69.51,70.69,72.66,72.65,73.36),

[R] Advantages of using SQLite for data import in comparison to csv files

2010-01-13 Thread Juliet Jacobson
Hello everybody out there using R, I'm using R for the analysis of biological data and write the results down using LaTeX, both on a notebook with linux installed. I've already tried two options for the import of my data: 1. Import from a SQLite database 2. Import from individual csv files edited

Re: [R] convert factor data to numeric

2010-01-13 Thread Rolf Turner
On 14/01/2010, at 6:00 AM, Nathalie Yauschew-Raguenes wrote: Hello, I find a way to convert data in factor type to numeric : data_numeric <- as.numeric(as.character(data_factor)). It's treaky but works. Possibly even more ``treaky'' but more efficient is: data_numeric <- as.numeric(

[R] [R-pkgs] New sp release

2010-01-13 Thread Roger Bivand
The sp package provides class definitions for spatial data, and utilities for spatial data handling and manipulation. The release of sp version 0.9-56 introduces changes in the ways in which Polygon, Polygons, and SpatialPolygons objects are created, moving from R code to compiled C code. Beca

[R] Formula for normal distribution with know mean and standard error and n terms

2010-01-13 Thread Steve_Friedman
Hello, I am searching for a method to calculate a normal distribution. For example this equation is used to calculate the normal curve when the mean and standard deviation are know. p(x) = (1/σ*sqrt(2π)) x exp (- (x-μ)2/2σ2) or (Embedded image moved to file: pic27350.jpg)Normal Probability Dis

Re: [R] Help, How can I boxplot mse and mtry using 20 5-fold cross-validation?

2010-01-13 Thread Max Kuhn
In caret, see ?trainControl. Use returnResamp = "all" Max On Wed, Jan 13, 2010 at 9:47 AM, bbslover wrote: > >  Hello, >   I am learning randomForest, now I want to boxplot mse and mtry using 20 > 5-fold cross-validation(using median value), but I have no a good method to > do it, except a not g

Re: [R] Method for reduction of independent variables

2010-01-13 Thread Daniel Malter
Hi, please read the posting guide. You are not likely to get an extensive answer to your question from this list. Your question is a "please solve/explain my statistical problem for me" question. There are two things problematic with that. First, "statistical", and second "please solve for me." Fi

Re: [R] Simulation numbers from a probability table

2010-01-13 Thread Peter Ehlers
Try this: dat <- data.frame(x=11:14, pa=1:4/10, pb=4:1/10) f <- function(numreps, data){ pmat <- as.matrix(data[-1]) x <- data[,1] result <- matrix(0, nrow=numreps, ncol=ncol(pmat)) colnames(result) <- c("A", "B") for(i in seq_len(numreps)){ result[i,] <- apply(pmat, 2, function(p)

Re: [R] optimization challenge

2010-01-13 Thread Albyn Jones
The key idea is that you are building a matrix that contains the solutions to smaller problems which are sub-problems of the big problem. The first row of the matrix SSQ contains the solution for no splits, ie SSQ[1,j] is just the sum of squares about the overall mean for reading chapters1 through

Re: [R] Ask for histogram

2010-01-13 Thread Steve Lianoglou
Hi, On Wed, Jan 13, 2010 at 12:58 PM, Yi Du wrote: > Hi, > > > I use a vector of data to draw the histogram, but it is different from the > graph by SAS. Can you check it for me please? How are we supposed to check something without data, pictures, etc? What do you want checking, exactly? > b i

Re: [R] convert factor data to numeric

2010-01-13 Thread S Devriese
On 01/13/2010 05:41 PM, Peter Ehlers wrote: > S Devriese wrote: >> On 01/13/2010 10:47 AM, Ahmet Temiz wrote: >>> hello >>> >>> could you give me a hint to convert data in factor type to numeric >>> (float) ? >>> >>> regards >>> >>> -- >>> Open WebMail Project (http://openwebmail.org) >>> >>> >

[R] Ask for histogram

2010-01-13 Thread Yi Du
Hi, I use a vector of data to draw the histogram, but it is different from the graph by SAS. Can you check it for me please? b is a column vector of 4332 hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) rug(b) When I used rug, I find the records are smaller than 4332. I don't know w

Re: [R] Simulation numbers from a probability table

2010-01-13 Thread Tal Galili
If the trials are not connected then I would consider melting the table using melt() from the reshape package. And then using lapply() with the function random.function <- function(my.prob, number.of.observations = 10) { sum(rbinom(number.of.observations, 1, my.prob)) } in case the trials are con

Re: [R] Applying function to parts of a matrix based on a factor

2010-01-13 Thread Heinz Tuechler
If your matrix were a data.frame, it could work like this: df <- data.frame(age=1:100, sex=rep(1:2, 50)) with(df, by(age, sex, mean)) without the "lapply, sapply etc. family". h At 18:16 13.01.2010, Doran, Harold wrote: with(yourdataframe, tapply(age,sex,mean)) -Original Message- Fro

Re: [R] optimization challenge

2010-01-13 Thread Greg Snow
WOW, your results give about half the variance of my best optim run (possibly due to my suboptimal use of optim). Can you describe a little what the algorithm is doing? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Ori

[R] Simulation numbers from a probability table

2010-01-13 Thread Kelvin
Dear friends, If I have a table like this, first row A B C D ... are different levels of the variable, first column 0 1 2 4 ... are the levels of the "numbers", the numbers inside the table are the probabilities of the "number" occuring. A B C D... 0 0.20.30.1

Re: [R] How can I store the results

2010-01-13 Thread Gavin Simpson
On Wed, 2010-01-13 at 15:59 +0100, Alex Roy wrote: > Dear R users, > I am running a R code which gives me 10 columns and > 160 rows. I need to run the code for 100 times and each time I need to store > the results in a single file. > I do not know how can I store them in a s

Re: [R] Applying function to parts of a matrix based on a factor

2010-01-13 Thread Dimitris Rizopoulos
try this: with(Data, tapply(Age, Sex, mean)) I hope it helps. Best, Dimitris John Sorkin wrote: R 2.9 Windows XP I have a matrix, Data, which contains a factor Sex and a continuous variable Age. I want to get mean age by sex. I know I can do this with two statements, mean(Data["Age,Data[,

Re: [R] Applying function to parts of a matrix based on a factor

2010-01-13 Thread Doran, Harold
with(yourdataframe, tapply(age,sex,mean)) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of John Sorkin Sent: Wednesday, January 13, 2010 12:11 PM To: r-help@r-project.org Subject: [R] Applying function to parts of a matrix based on a

[R] Applying function to parts of a matrix based on a factor

2010-01-13 Thread John Sorkin
R 2.9 Windows XP I have a matrix, Data, which contains a factor Sex and a continuous variable Age. I want to get mean age by sex. I know I can do this with two statements, mean(Data["Age,Data[,"Sex"]=="Male") and mean(Data["Age,Data[,"Sex"]=="Female") I know this can be done in a single comman

Re: [R] convert factor data to numeric

2010-01-13 Thread Nathalie Yauschew-Raguenes
Hello, I find a way to convert data in factor type to numeric : data_numeric <- as.numeric(as.character(data_factor)). It's treaky but works. Peter Ehlers a écrit : S Devriese wrote: On 01/13/2010 10:47 AM, Ahmet Temiz wrote: hello could you give me a hint to convert data in factor type to

[R] Method for reduction of independent variables

2010-01-13 Thread rubystallion
Hello I am currently investing software code metrics for a variety of software projects of a company to determine the worst parts of software products according to specified quality characteristics. As the gathering of metrics correlates with effort, I would like to find a subset of the metrics

[R] Help, How can I boxplot mse and mtry using 20 5-fold cross-validation?

2010-01-13 Thread bbslover
Hello, I am learning randomForest, now I want to boxplot mse and mtry using 20 5-fold cross-validation(using median value), but I have no a good method to do it, except a not good method. randomforest package itself did not contain cross-validating method, and caret package contain cross vali

[R] exporting data frame - write foreign inconsistencies

2010-01-13 Thread John Cullen
Hello List, I have a data frame object (wa2) that I am exporting for use in another statistics package. Using library(foreign) write.foreign(wa2, choose.files(), choose.files(), package='SPSS') I noticed that there were several differences between the data sets as seen within R (View(wa2)) and w

Re: [R] convert factor data to numeric

2010-01-13 Thread Peter Ehlers
S Devriese wrote: On 01/13/2010 10:47 AM, Ahmet Temiz wrote: hello could you give me a hint to convert data in factor type to numeric (float) ? regards -- Open WebMail Project (http://openwebmail.org) you could try as.numeric but without more details it is difficult to see if this will

[R] R package dependencies

2010-01-13 Thread Colin Millar
Hi there, My question relates to getting information about R packages. In particular i would like to be able to find from within R: what are a packages dependencies what are a packages reverse dependencies does a package contain a dll The reason i ask is: The organisation that i work

Re: [R] How can I store the results

2010-01-13 Thread jim holtman
Collect the results in a list (one entry for each matrix) and then 'save' the list. When you 'load' it back in, you can easily reference each element for further processing. On Wed, Jan 13, 2010 at 9:59 AM, Alex Roy wrote: > Dear R users, >I am running a R code which giv

Re: [R] How can I store the results

2010-01-13 Thread Greg Snow
You could put all of your results into a single list, then just save the list. Or, functions like write.table and write have an append argument, set that to true and the information will be appended to the file rather than overwriting it. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center

Re: [R] Problem fitting a non-linear regression model with nls

2010-01-13 Thread Nathalie Yauschew-Raguenes
Actually, the data that I used are measurements of plant growth during an entire year.It is usual to model the growth with logistic models. I have already tried the simple logistic model (which works). But the problem is that with this model the inflexion point occurs half-way up or down the logis

Re: [R] Ask about large data set

2010-01-13 Thread Magnus Torfason
On 1/12/2010 8:29 PM, Yi Du wrote: Hi, Is that okay to let R to read data set more than 1 rows and use it to do some kernel density estimation? Thanks. Yi Why don't you just try it and see? Nothing bad will happen - the absolute worst case scenario is that R will hang. But I can tell y

Re: [R] wrong with using subset

2010-01-13 Thread Duncan Murdoch
On 13/01/2010 10:45 AM, Don MacQueen wrote: I would suggest that first you look at the results of (as.numeric(as.character(dfpr2_r$pr2))) > 0.2 && (dfpr2_r$landa > 10) by itself. Does it give all FALSE ? I'd guess the problem is using && instead of &. Duncan Murdoch Then look at eac

Re: [R] wrong with using subset

2010-01-13 Thread Don MacQueen
I would suggest that first you look at the results of (as.numeric(as.character(dfpr2_r$pr2))) > 0.2 && (dfpr2_r$landa > 10) by itself. Does it give all FALSE ? Then look at each of the parts separately. What are the results of (as.numeric(as.character(dfpr2_r$pr2))) > 0.2 and dfpr2_r$l

Re: [R] Problem fitting a non-linear regression model with nls

2010-01-13 Thread Bert Gunter
> My question is how could I estimate those initial values so that the nls > fitting works. > You can't. Your parameters are almost certainly nonidentifiable (which is what Gabor told you more gracefully). Just because you believe in a complex (often mechanistic) nonlinear model and have some data

Re: [R] Dynamic file / url name with read.csv

2010-01-13 Thread ivan popivanov
A few packages have support for basic download from Yahoo Finance. If that's what you are trying to achieve - you may want to try quantmod (getSymbols function) or tseries (get.hist.quote function). If you want to do something not supported yet - first take a look at their source code. Regards

Re: [R] <= returns wrong result? Why

2010-01-13 Thread Magnus Torfason
Yupp, FAQ 7.31 is definitely your friend here. You might also want to take a look at these two very recent threads on this help list: "Strange behaviour of as.integer()" http://tolstoy.newcastle.edu.au/R/e9/help/10/01/index.html#547 "Newbie question on precision" http://tolstoy.newcastle.edu.

[R] wrong with using subset

2010-01-13 Thread Ahmet Temiz
hello is it wrong with this expression: subset(dfpr2_r,(as.numeric(as.character(dfpr2_r$pr2))) > 0.2 && (dfpr2_r$landa > 10)) it gives nothing regards -- Open WebMail Project (http://openwebmail.org) -- This message has been scanned for viruses and dangerous content by MailScanner, and is

Re: [R] Problem fitting a non-linear regression model with nls

2010-01-13 Thread Gabor Grothendieck
You could try the brute force of nls2 package; however, note that you have 8 parameters and only 16 points so you might look for a more parsimonious model. Plotting it it seems somewhat gaussian in shape so: mod <- nls(y ~ a * dnorm(x, b, c), start = c(a = mean(y)/dnorm(0, 0, sd(x)), b = mean(x),

[R] How can I store the results

2010-01-13 Thread Alex Roy
Dear R users, I am running a R code which gives me 10 columns and 160 rows. I need to run the code for 100 times and each time I need to store the results in a single file. I do not know how can I store them in a single file without over writting the results? Thanks Alex

Re: [R] plotting moving range control chart

2010-01-13 Thread Tom Hopper
I have been having the same problem as poster Hodgess, below. It appears that her question was never answered, so I would like to share a solution with the community. The problem is the (apparent?) inability to produce moving range process behavior (a.k.a. "control") charts with individuals data i

[R] Problem fitting a non-linear regression model with nls

2010-01-13 Thread Nathalie Yauschew-Raguenes
Hi, I'm trying to make a regression of the form : formula <- y ~ Asym_inf + Asym_sup * ( (1 / (1 + (n1 * (exp( (tmid1-x) / scal1) )^(1/n1) ) ) ) - (1 / (1 + (n2 * (exp( (tmid2-x) / scal2) )^(1/n2) ) ) ) ) which is a sum of the generalized logistic model proposed by richards. with data such

[R] reading fifo with read.table hangs

2010-01-13 Thread Mads Jeppe Tarp-Johansen
To R-helpers, Running R version 2.10.0 (2009-10-26) Linux ... 2.6.25.20-0.5-default #1 SMP 2009-08-14 01:48:11 +0200 x86_64 x86_64 x86_64 GNU/Linux openSUSE 11.0 (X86-64) and having difficulties reading a fifo from within R. A short example that I find simply haning is shown as 'SHORT SCR

Re: [R] selection of multiple subscripts

2010-01-13 Thread Duncan Murdoch
On 13/01/2010 8:09 AM, e-letter wrote: On 13/01/2010, Duncan Murdoch wrote: > On 13/01/2010 7:36 AM, e-letter wrote: >> Readers, >> >> For a data set 'x': >> >> 1 a >> 2 b >> 3 c >> 4 d >> 5 e >> 6 f >> 7 g >> 8 h >> 9 i >> >> How to select multiple subscripts to plot? For example to plot values

[R] Plotting a linear step function without vertical lines

2010-01-13 Thread walter.djuric
--- Begin Message --- --- End Message --- __ 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, reprod

[R] column width in .dbf files using write.dbf ... to be continued

2010-01-13 Thread Arnaud Mosnier
Dear UseRs, I did not have any answer to my previous message ("Is there a way to define "manually" columns width when using write.dbf function from the library foreign ?"), so I tried to modify write.dbf function to do what I want. Here is my modified version : write.dbfMODIF <- function (datafr

Re: [R] selection of multiple subscripts

2010-01-13 Thread e-letter
On 13/01/2010, e-letter wrote: > On 13/01/2010, Duncan Murdoch wrote: >> On 13/01/2010 7:36 AM, e-letter wrote: >>> Readers, >>> >>> For a data set 'x': >>> >>> 1 a >>> 2 b >>> 3 c >>> 4 d >>> 5 e >>> 6 f >>> 7 g >>> 8 h >>> 9 i >>> >>> How to select multiple subscripts to plot? For example to pl

Re: [R] selection of multiple subscripts

2010-01-13 Thread e-letter
On 13/01/2010, Duncan Murdoch wrote: > On 13/01/2010 7:36 AM, e-letter wrote: >> Readers, >> >> For a data set 'x': >> >> 1 a >> 2 b >> 3 c >> 4 d >> 5 e >> 6 f >> 7 g >> 8 h >> 9 i >> >> How to select multiple subscripts to plot? For example to plot values >> 1:3 and 9:10: >> >> plot(x[1:3,1],x[,

[R] How to do FMOLS and DOLS?

2010-01-13 Thread John Hust
Hi, Can R do FMOLS(Fully Modified OLS) and DOLS(Dynamic OLS)? I cannot find any useful thing in the present package. Thanks in advance! -- View this message in context: http://n4.nabble.com/How-to-do-FMOLS-and-DOLS-tp1012976p1012976.html Sent from the R help mailing list archive at Nabble.com

Re: [R] selection of multiple subscripts

2010-01-13 Thread Duncan Murdoch
On 13/01/2010 7:36 AM, e-letter wrote: Readers, For a data set 'x': 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i How to select multiple subscripts to plot? For example to plot values 1:3 and 9:10: plot(x[1:3,1],x[,2]) and plot(x[9:10,1],x[,2]) into one plot? Neither of those will work, because yo

[R] Odp: selection of multiple subscripts

2010-01-13 Thread Petr PIKAL
Hi see ?points or ?lines which you would surely found out if you bother to look at ?plot help page Regards Petr r-help-boun...@r-project.org napsal dne 13.01.2010 13:36:57: > Readers, > > For a data set 'x': > > 1 a > 2 b > 3 c > 4 d > 5 e > 6 f > 7 g > 8 h > 9 i > > How to select multiple

Re: [R] Illustrating kernel distribution in wheat ears

2010-01-13 Thread Carl-Göran CG . Pettersson
Hi, Thanks a lot for your suggestions and the very detailed instructions, I needed them... Everything worked fine also in the full dataset, up until the last suggestion (the box plots) Here I also got an error message, but a different one from what you got. And no output... Here are the last

[R] selection of multiple subscripts

2010-01-13 Thread e-letter
Readers, For a data set 'x': 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i How to select multiple subscripts to plot? For example to plot values 1:3 and 9:10: plot(x[1:3,1],x[,2]) and plot(x[9:10,1],x[,2]) into one plot? Yours, rhelpatconference.jabber.org r251 _

  1   2   >