Re: [R] How to read only specified columns from a data file

2011-03-16 Thread Sarah Goslee
read.table() looks at the first five rows when determining how many columns there are. If there are more columns in row 7 and you do not specify that in the read.table() command directly, they will be wrapped to the next row. This was discussed on the list within the last couple weeks. Sarah On

Re: [R] how to set the starting value in lme

2011-03-16 Thread Ben Bolker
Daniel Kaschek daniel.kaschek at physik.uni-freiburg.de writes: Hi Jia, in order to test if the failing parameter estimation really has to do with wrong initial values, you could first simulate data with your mixed effects model. Just assume parameters, produce a data set with these

Re: [R] model fine, predict gives an error

2011-03-16 Thread Antje Niederlein
Yes, I did send an attachment - but I forgot that attachments might be removed, no? Here it is: http://rapidshare.com/files/452815636/drmData.RData Antje On 16 March 2011 12:19, Mike Marchywka marchy...@hotmail.com wrote: Date: Wed, 16 Mar

Re: [R] No response after click the show Rules button on Tab Associate.

2011-03-16 Thread XiaoboGu
-Original Message- From: Graham Williams [mailto:graham.willi...@togaware.com] Sent: Saturday, March 12, 2011 7:19 PM To: Xiaobo Gu Cc: r-help@r-project.org Subject: Re: No response after click the show Rules button on Tab Associate. On 10 March 2011 02:07, Xiaobo Gu

[R] table() reading problem

2011-03-16 Thread fre
I have the following problem: I have some string with numbers like k. I want to have a table like the function table() gives. However I am not able to call the first row, the 1, 2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem to work either. The levels keep bothering

[R] table() result issue

2011-03-16 Thread Frédérique Kuiper
Dear reader, I have the following problem: I have some string with numbers like k. I want to have a table like the function table() gives. However I am not able to call the first row, the 1, 2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem to work either. The

[R] objects memory limits

2011-03-16 Thread francesca bader
Dear list, I'm a quite new user of R-project, and I've a doubt on objects memory: I open a new R session and the command memory.limits() gives me 1535 Mb of memory (the PC has 2 Gb RAM and 32 bit), I create an integer vector object of 2e8 size, so about 2e8*4 bytes (800Mb) of memory are

[R] Aggregating dataset to means/day

2011-03-16 Thread OA Fatnes
Hi, I have a dataset with many observations some days while only one others. I would like to calculate a mean value per day and then do regression analysis on the means. This is what I have: YearDayTimeherring.density 200747 10.36 2.2 200747 11.50

[R] a question

2011-03-16 Thread Jeela Mohammadian
Hi, I must seek a favour regarding of R project, can we make an application out of R. I mean a small application that automatically runs and do the estimation automatically. Because the things I do is that I copy codes from script to work book and then it runs and gives the output. can it be

Re: [R] proportional symbol map ggplot

2011-03-16 Thread Strategische Analyse CSD Hasselt
Hello Scott, Thank you for the tips (I have posted the issue on the google group too), but there's nothing on these or other websites that gives an answer on our question. Following the traditional used rules of making a symbol plot, the used symbols should have the same proportions, based on

Re: [R] Matrix building to remove for loops

2011-03-16 Thread Brian Pellerin
Thanks, we're almost there. The 3rd statement needs to satisfy fi_2[r,c]-fi_2[c,r] where rc. On Tue, Mar 15, 2011 at 10:06 PM, Henrique Dallazuanna www...@gmail.comwrote: Try this: fi_2 - diag(1, i) fi_2[lower.tri(fi_2)] - 1 - runif(sum(lower.tri(fi_2))) ^ .5 fi_2[upper.tri(fi_2)] -

Re: [R] Does R have a const object?

2011-03-16 Thread Michael Friendly
On 3/15/2011 2:23 PM, Uwe Ligges wrote: On 15.03.2011 15:53, xiagao1982 wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to avoid being modified unintentionally. Thanks! Although there is almost never a No in R,

[R] get information out of table() result

2011-03-16 Thread fre
I have the following problem: I have some string with numbers like k. I want to have a table like the function table() gives. However I am not able to call the first row, the 1, 2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem to work either. The levels keep bothering

[R] Scope of variable?

2011-03-16 Thread Ravi Kulkarni
I know this is a very elementary question... I could not find a solution looking at old posts. I am unable to access a variable outside the scope of a for loop, even when the variable was defined before the loop: haar - function() { a = c(1.4560773, 2.3752412, 0.9798882, 3.0909252, 2.3986487,

Re: [R] How to read only specified columns from a data file

2011-03-16 Thread Luis Ridao
This is my code: mycols - rep(NULL, 430) ; mycols[c(1,3:5)] - rep(numeric, 4) ; mycols[c(2)] - rep(character,1) inp - read.table(myfile, skip=2, colClasses=mycols,fill=T) head(inp) Best, Luis On Wed, Mar 16, 2011 at 1:03 PM, David Winsemius dwinsem...@comcast.net wrote: On Mar 16, 2011, at

Re: [R] Questions on dividing lists and tapply

2011-03-16 Thread Rohit Pandey
Awesome,that worked! Thanks. On Wed, Mar 16, 2011 at 6:46 AM, Henrique Dallazuanna www...@gmail.comwrote: Try this: mapply('/', l1, l2, SIMPLIFY = FALSE) and tapply(1:5, lapply(indxLi, as.numeric), sum) On Tue, Mar 15, 2011 at 6:06 PM, Rohit Pandey rohitpandey...@gmail.com wrote:

Re: [R] table() reading problem

2011-03-16 Thread Sarah Goslee
It isn't entirely clear to me what you want. table() can function with many kinds of data, not just integers, so it returns a vector with names. For your case, with integer classes, you seem to possibly want: x - table(k) x - rbind(as.numeric(names(x)), as.numeric(x)) x [,1] [,2] [,3]

Re: [R] Persistent storage between package invocations

2011-03-16 Thread Hadley Wickham
No.  First, please use path.expand(~) for this, and it does not necessarily mean the home directory (and in principle it might not expand at all).  In practice I think it will always be *a* home directory, but on Windows there may be more than one (and watch out for local/roaming profile

Re: [R] How to read only specified columns from a data file

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 8:13 AM, Sarah Goslee wrote: read.table() looks at the first five rows when determining how many columns there are. If there are more columns in row 7 and you do not specify that in the read.table() command directly, they will be wrapped to the next row. This was

Re: [R] Aggregating dataset to means/day

2011-03-16 Thread Ivan Calandra
Hi, Look at ?aggregate. df - read.table(textConnection(Year Day Time herring.density 2007 47 10.36 2.2 2007 47 11.50 1.1 2007 47 14.24 1.4 2007 66 9.35 2.5), header=TRUE) You could do this: aggregate(herring.density~Year+Day, data=df, FUN=mean) And for the second question:

Re: [R] File Save As...

2011-03-16 Thread Hadley Wickham
No, defaults are evaluated in the evaluation frame of the function. That's why you can use local variables in them, e.g. the way rgamma uses 1/rate as a default for scale. Oops, yes, I was getting confused with promises - non-missing arguments are promises evaluated in the parent frame. But

Re: [R] How to read only specified columns from a data file

2011-03-16 Thread Sarah Goslee
On Wed, Mar 16, 2011 at 9:07 AM, Luis Ridao luri...@gmail.com wrote: This is my code: mycols - rep(NULL, 430) ; mycols[c(1,3:5)] - rep(numeric, 4) ; mycols[c(2)] - rep(character,1) rep(NULL, 430) does not give you a vector of length 430; it gives you a NULL vector, and at the end of this

Re: [R] a question

2011-03-16 Thread Jonathan P Daily
What operating system are you working with? On windows, making it run by double clicking on it from explorer is not going to work. You will probably have to write a batch file that invokes Rterm or Rscript (see documentation for which you want to use). So if your script file is myscript.r, you

Re: [R] get information out of table() result

2011-03-16 Thread Sarah Goslee
table() returns a named vector. You need the names and the values. Or you could read my reply to one of the OTHER appearances of this email in my inbox; I think I've seen three, though I only replied to one and now this. It truly is unnecessary to send your query several times in quick

Re: [R] Does R have a const object?

2011-03-16 Thread Dieter Menne
Michael Friendly wrote: This is just the flexibility of R. I've just discovered a new class of geometries based on pi - 2.3 ?Constants This is a must-fortune. Dieter -- View this message in context: http://r.789695.n4.nabble.com/Does-R-have-a-const-object-tp3356972p3381748.html

Re: [R] proportional symbol map ggplot

2011-03-16 Thread Hadley Wickham
On Mon, Mar 14, 2011 at 9:41 AM, Strategische Analyse CSD Hasselt csd...@fedpolhasselt.be wrote: Hello, we want to plot a proportional symbol map with ggplot. Symbols' area should have the same proportions as the scaled variable. Hereby an example we found on

Re: [R] Scope of variable?

2011-03-16 Thread Jonathan P Daily
?cat cat prints text, and returns an invisible NULL. Also, it is general practice to assign values using '-' even inside of functions, for reasons detailed in ?- -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville

Re: [R] a question

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 9:07 AM, Jonathan P Daily wrote: What operating system are you working with? On windows, making it run by double clicking on it from explorer is not going to work. You will probably have to write a batch file that invokes Rterm or Rscript (see documentation for which you

Re: [R] Scope of variable?

2011-03-16 Thread Martyn Byng
Hi, Not sure what you are trying to do with the cat command, but cat returns an invisible NULL (as described in the doc), so a = cat(a,v) just sets a to NULL Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ravi Kulkarni

[R] making dataframes

2011-03-16 Thread pelt
Dear all, I have a dataframe which looks like this (dummy): date-c(jan, feb, mar, apr, may, june, july, aug,sep,oct,nov,dec) col1-c(8.2,5.4,4.3,4.1,3.1,2.5,1.1,4.5,3.2,1.9,7.8,6.5) col2-c(3.1,2.3,4.7,6.9,7.5,1.1,3.6,8.5,7.5,2.5,4.1,2.3) dum-data.frame(cbind(date,col1,col2)) dum date col1

Re: [R] making dataframes

2011-03-16 Thread Scott Chamberlain
require(reshape2) melt(dum, id = 1) On Wednesday, March 16, 2011 at 9:28 AM, pelt wrote: Dear all, I have a dataframe which looks like this (dummy): date-c(jan, feb, mar, apr, may, june, july, aug,sep,oct,nov,dec) col1-c(8.2,5.4,4.3,4.1,3.1,2.5,1.1,4.5,3.2,1.9,7.8,6.5)

Re: [R] Scope of variable?

2011-03-16 Thread jim holtman
I think you meant: a - c(a, v) and not a - cat(a, v) On Wed, Mar 16, 2011 at 7:41 AM, Ravi Kulkarni ravi.k...@gmail.com wrote: I know this is a very elementary question... I could not find a solution looking at old posts. I am unable to access a variable outside the scope of a for loop,

[R] 'x' values must be positive.

2011-03-16 Thread rens
b [1] 2 1 1 1 1 1 pie(b) Error in pie(b) : 'x' values must be positive. Can someone help me? And sorry i am an beginner -- View this message in context: http://r.789695.n4.nabble.com/x-values-must-be-positive-tp3381744p3381744.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] a question on sqldf's handling of missing value and factor

2011-03-16 Thread xin wei
Dear Gabor: I did not have time to look at this issue these few days. Now I saw your investigation. I am very grateful that you quickly identify the root cause of this. It seems that a little caution needs to be exercised when applying sqldf to text file with large number of blanks (I have no

[R] instrumental variable as distance

2011-03-16 Thread tamergomah
Dear R-help , Here I try to explain the problem setting problem setting: we have four variables y: outcome x:exposure u:confounder z:Instrumental Variable ##we have instrumental variable as distance between centers and patients place, we have many ##centers for exp:three centers c1,c1,c3 and

Re: [R] making dataframes

2011-03-16 Thread Henrique Dallazuanna
Try this: reshape(dum, direction = 'long', idvar = 'date', varying = list(c('col1', 'col2'))) On Wed, Mar 16, 2011 at 11:28 AM, pelt p...@knmi.nl wrote: Dear all, I have a dataframe which looks like this (dummy): date-c(jan, feb, mar, apr, may, june, july, aug,sep,oct,nov,dec)

Re: [R] 'x' values must be positive.

2011-03-16 Thread rens
It's ok, i solved it. It wasn't an integer, -- View this message in context: http://r.789695.n4.nabble.com/x-values-must-be-positive-tp3381744p3381859.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] 'x' values must be positive.

2011-03-16 Thread jim holtman
'b' appears to be characters. try pie(as.integer(b)) On Wed, Mar 16, 2011 at 9:28 AM, rens picca...@hotmail.com wrote: b [1] 2 1 1 1 1 1 pie(b) Error in pie(b) : 'x' values must be positive. Can someone help me? And sorry i am an beginner -- View this message in context:

Re: [R] 'x' values must be positive.

2011-03-16 Thread Ted Harding
On 16-Mar-11 13:28:00, rens wrote: b [1] 2 1 1 1 1 1 pie(b) Error in pie(b) : 'x' values must be positive. Can someone help me? And sorry i am an beginner The problem (as indicated by the marks around each value) is that the variable 'b' is a vector of *characters*, not of numbers.

Re: [R] 'x' values must be positive.

2011-03-16 Thread Ivan Calandra
Hi, b is a character vector. Try as.numeric(b). You probably need to read some documentation about R. Ivan Le 3/16/2011 14:28, rens a écrit : b [1] 2 1 1 1 1 1 pie(b) Error in pie(b) : 'x' values must be positive. Can someone help me? And sorry i am an beginner -- View this message in

Re: [R] How to read only specified columns from a data file

2011-03-16 Thread Luis Ridao
Thanks Sarah. Best, Luis On Wed, Mar 16, 2011 at 1:19 PM, Sarah Goslee sarah.gos...@gmail.com wrote: On Wed, Mar 16, 2011 at 9:07 AM, Luis Ridao luri...@gmail.com wrote: This is my code: mycols - rep(NULL, 430) ; mycols[c(1,3:5)] - rep(numeric, 4) ; mycols[c(2)] - rep(character,1)

Re: [R] Does R have a const object?

2011-03-16 Thread Allan Engelhardt
On 16/03/11 13:04, Michael Friendly wrote: On 3/15/2011 2:23 PM, Uwe Ligges wrote: On 15.03.2011 15:53, xiagao1982 wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to avoid being modified unintentionally. Thanks!

[R] Error in X11

2011-03-16 Thread nqueralt
Dear all, I've installed R-2.12.2 on a server with Suse 10 linux OS. When I try to create images I got this error: png(filename=hola.png) Error in X11(paste(png::, filename, sep = ), width, height, pointsize, : unable to start device PNG In addition: Warning message: In

[R] export list to csv

2011-03-16 Thread andrija djurovic
Hi everybody. I have list like this: l-list(data.frame(q1=c(1,2,check),q2=c(3,check,5)), data.frame(q1=c(check,1),q2=c(4,5))) names(l)-c(A,B) rownames(l[[1]])-c(aa,bb,cc) rownames(l[[2]])-c(aa,bb) Every object has the same number of columns but different number of rows. Does anyone know if it

Re: [R] table() result issue

2011-03-16 Thread Dennis Murphy
k-c(1,1,1,1,1,3,5,6,2,1,3,9,2,3,1,1,1) table(k) k 1 2 3 5 6 9 9 2 3 1 1 1 names(table(k)) [1] 1 2 3 5 6 9 as.numeric(names(table(k))) [1] 1 2 3 5 6 9 x - table(k) as.numeric(names(table(k)))[4] [1] 5 You can always save the (numeric version of the) names as an object, too. Does that help?

[R] Data frame loop

2011-03-16 Thread Hosack, Michael
R users, I am trying to use a numeric vector to extract rows from a data frame. I want to extract two rows per unique WEEK (27 weeks) based on variable DOW_NUM by using pairs of vector (s3) elements in the order they appear. For example, vector initial elements 7 and 5 will be used to

Re: [R] export list to csv

2011-03-16 Thread Henrique Dallazuanna
Use dput: dput(l, file = l_str.txt) Then, to read again: l - dget(file = 'l_str.txt') On Wed, Mar 16, 2011 at 11:55 AM, andrija djurovic djandr...@gmail.com wrote: Hi everybody. I have list like this: l-list(data.frame(q1=c(1,2,check),q2=c(3,check,5)),

Re: [R] Does R have a const object?

2011-03-16 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 10:54 AM, Allan Engelhardt all...@cybaea.com wrote: On 16/03/11 13:04, Michael Friendly wrote: On 3/15/2011 2:23 PM, Uwe Ligges wrote: On 15.03.2011 15:53, xiagao1982 wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to

[R] calculating AUCs for each of the 1000 boot strap samples

2011-03-16 Thread taby gathoni
Hallo, I modified a code given by Andrija, a contributor in the list  to achieve two objectives: create 1000 samples from a list of 207 samples with each of the samples cointaining 20 good and 20 bad. THis i have achievedcalcuate AUC each of the 1000 samples, this i get an error. Please see

Re: [R] export list to csv

2011-03-16 Thread andrija djurovic
Soryy, I didn't explain well what I want. I would like to have a table in csv on txt file like this: $A q1q2 aa 1 3 bb 2 check cc check 5 $B q1 q2 aa check 4 bb 1 5 The same as write.csv of any data frame. On Wed, Mar 16, 2011 at 4:03 PM, Henrique

Re: [R] Error in X11

2011-03-16 Thread Ben Bolker
nqueralt at clinic.ub.es writes: I've installed R-2.12.2 on a server with Suse 10 linux OS. When I try to create images I got this error: png(filename=hola.png) Error in X11(paste(png::, filename, sep = ), width, height, pointsize, : FAQ 7.19:

[R] Re; Fitting a Beta distribution

2011-03-16 Thread Jim Silverton
I want to fit some p-values to a beta distribution. But the problem is some of the values have 0s and 1's. I am getting an error if I use the MASS function to do this. Is there anyway to get around this? -- Thanks, Jim. [[alternative HTML version deleted]]

Re: [R] Does R have a const object?

2011-03-16 Thread Allan Engelhardt
On 16/03/11 15:04, Gabor Grothendieck wrote: On Wed, Mar 16, 2011 at 10:54 AM, Allan Engelhardtall...@cybaea.com wrote: [...] Yes, but you can still print(base::pi) and rm(pi) to get back to our flat world, and you can't assign(pi, 4, pos = package:base) Error in assign(pi, 4, pos =

[R] Singularity problem

2011-03-16 Thread Feng Li
Dear R, If I have remembered correctly, a square matrix is singular if and only if its determinant is zero. I am a bit confused by the following code error. Can someone give me a hint? a - matrix(c(1e20,1e2,1e3,1e3),2) det(a) [1] 1e+23 solve(a) Error in solve.default(a) : system is

Re: [R] export list to csv

2011-03-16 Thread Ivan Calandra
Hi, You could try this (others surely have better solutions): out_file - file(file.csv, open=a) #creates a file in append mode for (i in seq_along(l)){ write.table(names(l)[i], file=out_file, sep=,, dec=., quote=FALSE, col.names=FALSE, row.names=FALSE) #writes the name of the list

Re: [R] Does R have a const object?

2011-03-16 Thread luke-tierney
Just as a heads-up: it is likely that unlocking the bindings in base for pi, T, F, probably all BULTIN and SPECIAL functions, and possibly more, will start signaling warnings in the near future. Doing this may be useful at times for debugging but it can mess up assumptions others make about how

Re: [R] Does R have a const object?

2011-03-16 Thread Henrik Bengtsson
On Wed, Mar 16, 2011 at 6:04 AM, Michael Friendly frien...@yorku.ca wrote: On 3/15/2011 2:23 PM, Uwe Ligges wrote: On 15.03.2011 15:53, xiagao1982 wrote: Hi, all, Does R have a const object concept like which is in C++ language? I want to set some data frames as constant to avoid being

Re: [R] Does R have a const object?

2011-03-16 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 11:49 AM, luke-tier...@uiowa.edu wrote: Just as a heads-up: it is likely that unlocking the bindings in base for pi, T, F, probably all BULTIN and SPECIAL functions, and possibly more, will start signaling warnings in the near future.  Doing this may be useful at times

Re: [R] Does R have a const object?

2011-03-16 Thread luke-tierney
On Wed, 16 Mar 2011, Gabor Grothendieck wrote: On Wed, Mar 16, 2011 at 11:49 AM, luke-tier...@uiowa.edu wrote: Just as a heads-up: it is likely that unlocking the bindings in base for pi, T, F, probably all BULTIN and SPECIAL functions, and possibly more, will start signaling warnings in the

Re: [R] Re; Fitting a Beta distribution

2011-03-16 Thread Kjetil Halvorsen
If yoy write out the likelihood equations for an independent sample size n from the beta(a,b) distribution: L \propto \prod_i dbeta(y_i,a,b) log(L) = constant + \sum_i dbeta(y_i,a,b,log=TRUE) log(L)= constant + \sum_i (a-1) log(y_i) + (b-i) log(1-y_i) you see that your problem comes from trying

Re: [R] Newbie-ish question on iteratively applying function to dataframe

2011-03-16 Thread Claus O'Rourke
Brilliant - that was really useful! On Tue, Mar 15, 2011 at 3:46 PM, Ista Zahn iz...@psych.rochester.edu wrote: Hi Claus, On Tue, Mar 15, 2011 at 9:33 AM, Claus O'Rourke claus.orou...@gmail.com wrote: Hi, I am trying to recursively apply a function to a selection of columns in a

Re: [R] Re; Fitting a Beta distribution

2011-03-16 Thread Ben Bolker
Jim Silverton jim.silverton at gmail.com writes: I want to fit some p-values to a beta distribution. But the problem is some of the values have 0s and 1's. I am getting an error if I use the MASS function to do this. Is there anyway to get around this? The probability *density* of an

Re: [R] Singularity problem

2011-03-16 Thread Allan Engelhardt
Numeric underflow. Try qr.solve(a) Allan On 16/03/11 15:28, Feng Li wrote: Dear R, If I have remembered correctly, a square matrix is singular if and only if its determinant is zero. I am a bit confused by the following code error. Can someone give me a hint? a-

Re: [R] Does R have a const object?

2011-03-16 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 12:16 PM, luke-tier...@uiowa.edu wrote: On Wed, 16 Mar 2011, Gabor Grothendieck wrote: On Wed, Mar 16, 2011 at 11:49 AM,  luke-tier...@uiowa.edu wrote: Just as a heads-up: it is likely that unlocking the bindings in base for pi, T, F, probably all BULTIN and SPECIAL

Re: [R] Does R have a const object?

2011-03-16 Thread Barry Rowlingson
On Wed, Mar 16, 2011 at 4:16 PM, luke-tier...@uiowa.edu wrote: That would defeat the purpose.  Unlocking things in base may be useful for experimenting or debugging but it is not a good idea otherwise. You are making experimenting in R more awkward? Then I'm throwing That would defeat the

Re: [R] Does R have a const object?

2011-03-16 Thread luke-tierney
On Wed, 16 Mar 2011, Barry Rowlingson wrote: On Wed, Mar 16, 2011 at 4:16 PM, luke-tier...@uiowa.edu wrote: That would defeat the purpose.  Unlocking things in base may be useful for experimenting or debugging but it is not a good idea otherwise. You are making experimenting in R more

Re: [R] Singularity problem

2011-03-16 Thread Peter Langfelder
On Wed, Mar 16, 2011 at 8:28 AM, Feng Li m...@feng.li wrote: Dear R, If I have remembered correctly, a square matrix is singular if and only if its determinant is zero. I am a bit confused by the following code error. Can someone give me a hint? a - matrix(c(1e20,1e2,1e3,1e3),2) det(a)

[R] R² for non-linear model

2011-03-16 Thread Anna Gretschel
Dear List, how can I obtain the value of r suqared for a non-linear model? For linear models it can be found in the summary() of the model but for non-linear models I just don't know. Please help! Anna __ R-help@r-project.org mailing list

[R] Saving summary outputs in a table form

2011-03-16 Thread Haillie
Dear R help, Is there a way to extract a variable ( one column) from my summary statistics to save it in a table form? My post-factor analysis summary statistics gave me the output below. Is there anyway to just save the mean of all the phi? The filename of this summary output is postun2010sum.

[R] How to read Cumulative proportion in using princomp?

2011-03-16 Thread ian_zhangty
Dear all, result-summary(princomp(x,cor=TRUE)) result Importance of components: Comp.1Comp.2 Comp.3 Comp.4 Standard deviation 1.642136 1.0114376 0.45146892 0.27669119 Proportion of Variance 0.674153 0.2557515 0.05095605 0.01913950 Cumulative Proportion

Re: [R] Scope of variable?

2011-03-16 Thread Ravi Kulkarni
Of course! Works fine now. Thanks, Martyn and Jim... Ravi -- View this message in context: http://r.789695.n4.nabble.com/Scope-of-variable-tp3381485p3381932.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] Reorganize data frame

2011-03-16 Thread chris99
Hi group, I am trying to convert the organization of a data frame so I can do some correlations between stocks, I have something like this: stock.returns - data.frame(rbind(c(MSFT,20110301,0.05),c(MSFT,20110302,0.01),c(GOOG,20110301,-0.01),c(GOOG,20110302,0.04))) colnames(stock.returns) -

[R] suppress GUI window when loading a library

2011-03-16 Thread Gregory Carey
When some libraries (e.g., VIM and Rcmdr) are loaded, they automatically display a GUI window. Is there a way to load the library but suppress the window? greg gregory carey university of colorado __ R-help@r-project.org mailing list

Re: [R] generate bivariate or multivariate gamma distribution in R

2011-03-16 Thread He, Yulei
Hi, there: Is there any quick function to generate bivariate or multivariate gamma distribution? Thanks. Yulei __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] fetch uneven

2011-03-16 Thread rens
Hi I have a vector m: m [1] ABC transporters [2] 2 [3] Acetyl-CoA [4] 1 [5] Energie [6] 1

Re: [R] adding linear regression data to plot

2011-03-16 Thread derek
I know I can add line to graph with abline(), but I would like to print R-squared, F-test value, Residuals and other statistics from lm() to a graph. I don't know how to access the values from summary(), so that I can use them in a following code or print them in a graph. -- View this message in

Re: [R] table() reading problem

2011-03-16 Thread Allan Engelhardt
On 16/03/11 09:20, fre wrote: I have the following problem: I have some string with numbers like k. I want to have a table like the function table() gives. However I am not able to call the first row, the 1, 2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem The

Re: [R] export list to csv

2011-03-16 Thread Roman Luštrik
How about? sink(andrija.csv) l sink() -- View this message in context: http://r.789695.n4.nabble.com/export-list-to-csv-tp3381992p3382062.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Bootstrap memory use?

2011-03-16 Thread Matthew Vernon
Hi, the boot function from the boot library seems to use an implausible quantity of memory; is this to be expected, or am I doing something wrong? Specifically, the vector I wish to bootstrap off is about 17000 entries long length(fes) [1] 16988 bm - function(x,indexes) mean(x[indexes]) then if

Re: [R] changing one character in the name of dataframes repeatedly

2011-03-16 Thread Laszlo
Hello Ivan, Thank you very much for your comments, they were really useful and I’ll try to memorize and use them in the future. Getting back to my problem… well, I try to put it in a different way because I’m afraid this is gonna be a little bit more difficult than I thought. So, here is my

[R] cross validation? when rlm, lmrob or lmRob

2011-03-16 Thread agent dunham
Dear community, I have fitted a model using comands above, (rlm, lmrob or lmRob). I don't have new data to validate de models obtained. I was wondering if exists something similar to CVlm in robust regression. In case there isn't, any suggestion for validation would be appreciated. Thanks,

Re: [R] fetch uneven

2011-03-16 Thread Henrik Bengtsson
See ?seq for generating index vectors of different kinds. /Henrik On Wed, Mar 16, 2011 at 7:43 AM, rens picca...@hotmail.com wrote: Hi I have a vector m:  m  [1] ABC transporters  [2] 2  [3] Acetyl-CoA  [4] 1  [5] Energie  [6] 1  [7] FAD Biosynthese  [8] 1  [9] Glyoxylate and

[R] read.table() with \t as seperator, all other programs report equal fields each row, read.table() returns unequal row length error

2011-03-16 Thread Yong Wang
hi, list R is undoudtedly my favorite statistic tool, however, the data inputnpart has long been a pain. most data I have to deal with are irregular and contains special character. Recently I get a tab delimited data, read.table(filename,sep=\t) constantly return erors for certain rows does not

Re: [R] How to read Cumulative proportion in using princomp?

2011-03-16 Thread Martyn Byng
Hi, The values are calculated on the fly in the summary function stats:::print.summary.princomp using vars - result$sdev^2 vars - vars/sum(vars) cumsum(vars) Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ian_zhangty

Re: [R] Singularity problem

2011-03-16 Thread Berend Hasselman
Peter Langfelder wrote: On Wed, Mar 16, 2011 at 8:28 AM, Feng Li lt;m...@feng.ligt; wrote: Dear R, If I have remembered correctly, a square matrix is singular if and only if its determinant is zero. I am a bit confused by the following code error. Can someone give me a hint? a -

Re: [R] Does R have a const object?

2011-03-16 Thread luke-tierney
On Wed, 16 Mar 2011, Gabor Grothendieck wrote: On Wed, Mar 16, 2011 at 12:16 PM, luke-tier...@uiowa.edu wrote: On Wed, 16 Mar 2011, Gabor Grothendieck wrote: On Wed, Mar 16, 2011 at 11:49 AM,  luke-tier...@uiowa.edu wrote: Just as a heads-up: it is likely that unlocking the bindings in

Re: [R] R² for non-linear model

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 12:53 PM, Anna Gretschel wrote: Dear List, how can I obtain the value of r suqared for a non-linear model? For linear models it can be found in the summary() of the model but for non-linear models I just don't know. Please help! You should do more searching. I can

Re: [R] How to read Cumulative proportion in using princomp?

2011-03-16 Thread Peter Ehlers
On 2011-03-16 10:31, Martyn Byng wrote: Hi, The values are calculated on the fly in the summary function stats:::print.summary.princomp using vars- result$sdev^2 vars- vars/sum(vars) cumsum(vars) Or you could use the prcomp summary function (maybe you should use prcomp() for you model?):

Re: [R] R² for non-linear model

2011-03-16 Thread Joshua Wiley
Dear Anna, What is your goal in obtaining a value for R^2 ? I believe it is not provided for a non-linear model, because it does not make much sense. It certainly will not have the same interpretation as in a linear model, and all the ways it *could* be defined come with their own sets of

Re: [R] R² for non-linear model

2011-03-16 Thread Anna Gretschel
Am 16.03.2011 18:15, schrieb David Winsemius: On Mar 16, 2011, at 12:53 PM, Anna Gretschel wrote: Dear List, how can I obtain the value of r suqared for a non-linear model? For linear models it can be found in the summary() of the model but for non-linear models I just don't know. Please

Re: [R] R² for non-linear model

2011-03-16 Thread Bert Gunter
You can't. R^2 has no (consistent, sensible) meaning for nonlinear models. If you don't understand why not, get local help or do some reading. Cheers, Bert On Wed, Mar 16, 2011 at 9:53 AM, Anna Gretschel ana-...@web.de wrote: Dear List, how can I obtain the value of r suqared for a

Re: [R] R² for non-linear model

2011-03-16 Thread Anna Gretschel
Am 16.03.2011 18:19, schrieb Joshua Wiley: Dear Anna, What is your goal in obtaining a value for R^2 ? I believe it is not provided for a non-linear model, because it does not make much sense. It certainly will not have the same interpretation as in a linear model, and all the ways it *could*

Re: [R] Does R have a const object?

2011-03-16 Thread Hadley Wickham
Its useful for being able to set defaults for arguments that do not have defaults.  That cannot break existing programs. Until the next program decides do co change those defaults and either can't or does and you end up with incompatible assumptions.  It also make the code with the added

[R] Data frame loop

2011-03-16 Thread Hosack, Michael
R users, I found a solution to my own question. I just needed to insert (j+(j-1)):(2*j) as the indices for vector s3. No need to respond. Thank you __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] adding linear regression data to plot

2011-03-16 Thread Martyn Byng
Hi, ?summary.lm describes what summary statistics get calculated and returned, so ll - lm(y ~ x) ss - summary(ll) ss$fstatistic for example would give the F statistic Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of

Re: [R] R² for non-linear model

2011-03-16 Thread Bert Gunter
Is there any way that this could be made into a fortune -- perhaps by omitting the poster's identity? yes there are threads concidering this topic but they are all about the theory not about how to get the value of r^2 for a non-linear model in R. :=) Cheers, Bert Anna: I say this because you

Re: [R] Reorganize data frame

2011-03-16 Thread Phil Spector
Here's one way: ans = reshape(stock.returns,idvar='Date', +varying=list(names(stock.returns)[-1]), +direction='long', +times=names(stock.returns)[-1], +v.names='Return',timevar='Ticker') rownames(ans) = NULL ans Date

Re: [R] Saving summary outputs in a table form

2011-03-16 Thread Ivan Calandra
Hi, You should carefully and thoroughly read the help page for the extraction operators. See ?[ Let's say your output below is in a data.frame called df. You can do something like this: df[, Mean] To select only some specific phi rows, you probably need to set some regular expressions,

Re: [R] R² for non-linear model + comparing linear + non-linear models

2011-03-16 Thread Anna Gretschel
Dear Bert, so what can I do to obtain a goodness of fit for a non-linear model if r² does not work? And here comes my next question: is it apropriate to comopare a linear and a non-linear model with anova()? Thank you so much for answering, Anna Am 16.03.2011 18:54, schrieb Bert Gunter:

Re: [R] adding linear regression data to plot

2011-03-16 Thread Peter Ehlers
On 2011-03-16 08:47, derek wrote: I know I can add line to graph with abline(), but I would like to print R-squared, F-test value, Residuals and other statistics from lm() to a graph. I don't know how to access the values from summary(), so that I can use them in a following code or print them

  1   2   >