Re: [R] = returns wrong result? Why

2010-01-13 Thread Peter Ehlers
Trafim Vanishek wrote: Dear all, Does anybody know the probable reason why = gives false when it should give true? These two variables are of the same type, and everything works in the cycle but then it stops when they are equal. this is the output result Rk[47] = RB[21] [1] FALSE Rk[47]

Re: [R] = returns wrong result? Why

2010-01-13 Thread Stephan Kolassa
Hi Trafim, take a look at FAQ 7.31. HTH Stephan Trafim Vanishek schrieb: Dear all, Does anybody know the probable reason why = gives false when it should give true? These two variables are of the same type, and everything works in the cycle but then it stops when they are equal. this is

[R] Dynamic data.frame headers

2010-01-13 Thread Mattias Nyström
I would like to create a data.frame with dynamic created headers. I will later fill it with percentiles. My percentiles vector is: percentiles = c(0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 0.95, 1.00) From this vector I would like to have headers like: p5, p10, p20, ..., p95,

Re: [R] Dynamic data.frame headers

2010-01-13 Thread Hans Gardfjell
Hi Mattias, Try this, percentiles - c(0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 0.95, 1.00) test - data.frame(matrix(NA,0,12)) names(test) - paste(p,percentiles*100,sep=) test [1] p5 p10 p20 p30 p40 p50 p60 p70 p80 p90 p95 p100 Cheers, Hans -Original

[R] convert factor data to numeric

2010-01-13 Thread Ahmet Temiz
hello could you give me a hint to convert data in factor type to numeric (float) ? regards -- Open WebMail Project (http://openwebmail.org) -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.

Re: [R] convert factor data to numeric

2010-01-13 Thread Dimitris Rizopoulos
check the following: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numeric_003f Best, Dimitris 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)

Re: [R] convert factor data to numeric

2010-01-13 Thread S Devriese
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 work. How

Re: [R] getting p values

2010-01-13 Thread S Ellison
Duncan Murdoch murd...@stats.uwo.ca 12/01/2010 18:07:46 I need to get the p values for a table with 15000 entries of t values. ... Put the t values into a vector, then use pt() in an appropriate way ... and don't forget any necessary correction for multiple comparisons; see ?p.adjust

Re: [R] expand.grid game

2010-01-13 Thread baptiste auguie
It did take me a good night's sleep to understand it. I was stuck with the exact same question but I see now how the remaining balls are shared among all 8 urns (therefore cases with 11, 12, 13, ... 17 balls are also dealt with). Thanks again, baptiste 2010/1/12 Rolf Turner

Re: [R] Recommended visualization for hierarchical data

2010-01-13 Thread Jim Lemon
On 01/13/2010 02:46 PM, Rex C. Eastbourne wrote: On Tue, Jan 12, 2010 at 5:26 PM, Rex C. Eastbournerex.eastbou...@gmail.com wrote: Let's say I have data in the following schema that describes the number of purchases a company has received from each County in the US: State |

Re: [R] Calculate the percentages of the numbers in every column.

2010-01-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.01.2010 01:36:31: tmp - scan() 0 2 1 0 1 0 2 1 2 3 0 0 0 0 1 0 0 2 3 1 dat - matrix(tmp, byrow=T, ncol=4) apply(dat, 2, function(x, min.val, max.val) { tmp - table(x)/length(x) res - rep(0, max.val - min.val + 1)

Re: [R] R for windows 64 bit

2010-01-13 Thread alessia matano
Thanks to all of you, therefore if I got it well, I could also use the command And, say, --max-mem-size=8G would work from outside R, to further increase the memory even if the machine is 6giga. I had an idea of that before, but I was not so sure! Many thanks again for all your advices. Best

[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

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] 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 subscripts to

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

[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

Re: [R] selection of multiple subscripts

2010-01-13 Thread e-letter
On 13/01/2010, Duncan Murdoch murd...@stats.uwo.ca 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[,2]) and

Re: [R] selection of multiple subscripts

2010-01-13 Thread e-letter
On 13/01/2010, e-letter inp...@gmail.com wrote: On 13/01/2010, Duncan Murdoch murd...@stats.uwo.ca 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] 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 (dataframe,

[R] Plotting a linear step function without vertical lines

2010-01-13 Thread walter.djuric
---BeginMessage--- ---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,

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 murd...@stats.uwo.ca 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

[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

[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

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 in

[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] 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] 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] = 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

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.

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] 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$landa

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 each of

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

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

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

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 alexroy2...@gmail.com wrote: Dear R users, I am

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

[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

[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

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] 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 command, but I

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

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,

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

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

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

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

[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

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) you could try as.numeric but

Re: [R] Ask for histogram

2010-01-13 Thread Steve Lianoglou
Hi, On Wed, Jan 13, 2010 at 12:58 PM, Yi Du abraham...@gmail.com 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,

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

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) sample(x,

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. First,

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 dlu...@yeah.net 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,

[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

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

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 -

[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

[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),

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

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 m...@llnl.gov 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

[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] 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 =

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 peter.breckn...@bp.com wrote: Hi I would like to understand how to extend the function (FUN) I am using in rollapply below. ## With the following

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 would like

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 c.mil...@marlab.ac.uk wrote: Hi there, My question relates to getting information about R packages.  In particular i would like to be able to find from

[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

[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

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 stephan.kola...@gmx.dewrote: Hi, does this do what you want? d -

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]

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

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 julietjacob...@aim.com 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

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

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

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 vector

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

[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] 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 dusa.adr...@gmail.com 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

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] 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) is

[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

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) muenc...@utk.edu 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

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 dr.jz...@gmail.com To:r-help@r-project.org 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 10

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 4 7

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 called

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 first

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

[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

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 matthew.walke...@ulaval.ca wrote: Hi everyone, Would somebody please explain (or point me to a reference that explains) the following error: Error: object of

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

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 literature I'm

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 jeffrey.mar...@nuance.com wrote: I think I figured this out. I should not have put the Driver name in braces.

[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

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=Var1)

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] ml-node+1013265-480375...@n4.nabble.com 写道: -原始邮件- 发件人:Max

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

  1   2   >