[R] Dataframe subset - why doesn't this work?

2012-02-17 Thread Ajay Askoolum
data(mtcars) mtcars[rownames(mtcars)!=Valiant,] # fails mtcars[list(rownames(mtcars))!=Valiant,] # runs but I am not getting the expected result With the latter statement, I expected all rows except the one where the name is Valiant. I must have got something simple wrong; what is it?

Re: [R] Reading Text Files with RODBC

2012-02-17 Thread Jeff Newmiller
To be fair, RODBC is just an interface to ODBC, and this is not an ODBC support forum. In my experience, ODBC works alright when used to connect to a SQL database, but is pretty flaky when used to connect to Excel or CSV files.

Re: [R] Creating XML using apply

2012-02-17 Thread Jeff Newmiller
Undoubtedly. However, it probably won't affect the time it takes to finish by very much. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.

Re: [R] RODBC sqlSave / append problem (windows XP, R 2.13.2)

2012-02-17 Thread taby gathoni
Hi MJ, Thanks alot for this. I will try and revert.   Taby An idea not coupled with action will never get any bigger than the brain cell it occupied. Arnold Glasgow .. Attempt something large enough that failure is guaranteed…unless God steps in!

Re: [R] Dataframe subset - why doesn't this work?

2012-02-17 Thread Jorge I Velez
Hi Ajay, In the first case, you need == instead of = : R mtcars[ rownames(mtcars) == Valiant, ] mpg cyl disp hp drat wt qsec vs am gear carb Valiant 18.1 6 225 105 2.76 3.46 20.22 1 031 For the second case, R mtcars[rownames(mtcars) != Valiant,] will do it. See also

[R] QQ plot

2012-02-17 Thread nandan amar
Hello, I am having two data set original and predicted. I want to dind QQ-plot fot it. I tried in following manner : qq(original~predicted) and error was : Error in qq.formula(o ~ p) : y must have exactly 2 levels There is an option qtype which dosent make any difference. What is the correct

Re: [R] how to get r-squared for a predefined curve or function with other data points

2012-02-17 Thread protoplast
it's that easy, eh? thank you for your input, it's much appreciated. i will have a look at nlmer as well. markus On Thu, Feb 16, 2012 at 23:17, David Winsemius [via R] ml-node+s789695n4395634...@n4.nabble.com wrote: On Feb 16, 2012, at 11:43 AM, protoplast wrote: hello mailing list!

Re: [R] QQ plot

2012-02-17 Thread Rolf Turner
On 17/02/12 21:32, nandan amar wrote: Hello, I am having two data set original and predicted. I want to dind QQ-plot fot it. I tried in following manner : qq(original~predicted) and error was : Error in qq.formula(o ~ p) : y must have exactly 2 levels There is an option qtype which dosent

[R] Different cp values in rpart() using plotcp() and printcp()

2012-02-17 Thread silje skår
hi, I have a question regarding cp values in rpart(). When I use plotcp() I get a figure with cp values on the x-axsis, but then I use printcp() the cp values in that list are different from the values in the figure by plotcp(). Does someone know why? Silje [[alternative HTML version

Re: [R] import .csv file into R

2012-02-17 Thread Marion Wenty
Hi Michael and Rui, thanks a lot for the tips. It worked with both your suggestions! I also found out, that this problem only exists if I put header=T. Thanks again! Marion If you don't need to refer to colnames you should be fine. If you do need to subset by colnames, you can still do it

[R] Error message in gamm. Problem with temporal correlation structure

2012-02-17 Thread HERNANDEZ PLAZA, MARIA EVA
HELLO ALL, I AM GETTING AN ERROR MESSAGE WHEN TRYING TO RUN A GAMM MODEL LIKE THE ONE BELOW. I AM USING R VERSION 2.14.1 (2011-12-22) AND MGCV 1.7-12. M1 -gamm(DepVar ~ Treatment + s(Year, by =Treatment), random=list(Block=~1), na.action=na.omit, data = mydata, correlation =

Re: [R] QQ plot

2012-02-17 Thread nandan amar
Thanks a lot Turner. Latter I also tried following : oo-quantile(original, probs = seq(0, 1, 0.01), type = 8) pp-quantile(predicted, probs = seq(0, 1, 0.01), type = 8) plot(oo,pp) But plot for above and following (as you suggested) are not same. What may be the error ? Thanks. On Fri, Feb 17,

Re: [R] Plotting monthly maps from yearly data

2012-02-17 Thread uday
Thank you Michael -- View this message in context: http://r.789695.n4.nabble.com/Plotting-monthly-maps-from-yearly-data-tp4391704p4396787.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Plotting issue

2012-02-17 Thread uday
I have two different datasets 1) is in monthly format (obs) 2) yearly format (model) in obs I have 84 files ( 2003:2009)for different months in model I have 4 different files which has yearly data (2005:2008) So for calculating my requirement I need these both data sets. The sample

Re: [R] Error message in gamm. Problem with temporal correlation structure

2012-02-17 Thread Simon Wood
eva, I can't manage to replicate this by simulation. Is there any chance you could send me the data off-list, and I can take a look (if so I'll only use the data for the purpose of finding out what's wrong, of course). best, Simon On 17/02/12 09:35, HERNANDEZ PLAZA, MARIA EVA wrote:

[R] (subscript) logical subscript too long in using apply

2012-02-17 Thread Soheila Khodakarim
Dear ALL I have this function in R: func_LN - function(data){ med_ge - matrix(c(rep(NA,nrow(data)*ncol(data))), nrow = nrow(data), ncol=ncol(data), byrow=TRUE) T - matrix(c(rep(NA,length(n)*ncol(data))), nrow = length(n), ncol=ncol(data), byrow=TRUE) Tdiff-

[R] Load packages from source

2012-02-17 Thread David Cassany
Hi all, I'm developing an R package and I'd like to load it easly while developing, debugging and testing. I would like to load it without having to install it. Installing it causes me some problems for debugging it, as the code file it is executing it not the one I'm editing. I've seen the

Re: [R] (subscript) logical subscript too long in using apply

2012-02-17 Thread Petr Savicky
On Fri, Feb 17, 2012 at 12:44:44PM +0100, Soheila Khodakarim wrote: Dear ALL I have this function in R: func_LN - function(data){ med_ge - matrix(c(rep(NA,nrow(data)*ncol(data))), nrow = nrow(data), ncol=ncol(data), byrow=TRUE) T - matrix(c(rep(NA,length(n)*ncol(data))), nrow =

Re: [R] Control number of assets in resulting portfolio with optimizations using package fPortfolio

2012-02-17 Thread Joshua Ulrich
Alex, You may find an answer to your question by searching the R-SIG-Finance archives (via rseek.org). If not, you may want to consider asking your question on the R-SIG-Finance list. Best, -- Joshua Ulrich  |  FOSS Trading: www.fosstrading.com R/Finance 2012: Applied Finance with R

Re: [R] (subscript) logical subscript too long in using apply

2012-02-17 Thread Petr PIKAL
Hi apply probably does not understand you function. I do not want to go too deeply into it but I noticed few issues in it. See inline Dear ALL I have this function in R: func_LN - function(data){ med_ge - matrix(c(rep(NA,nrow(data)*ncol(data))), nrow = nrow(data),

Re: [R] ACM Software Copyright and License Agreement

2012-02-17 Thread Hans W Borchers
peter dalgaard pdalgd at gmail.com writes: On Feb 16, 2012, at 12:31 , Hans W Borchers wrote: I have often seen the use of routines from the ACM Collected Algorithms, i.e. netlib.org/toms/≥ (CALGO, or Trans. On Math. Software, TOMS), in Open Source programs, maybe also in some R packages

Re: [R] ACM Software Copyright and License Agreement

2012-02-17 Thread peter dalgaard
On Feb 17, 2012, at 13:42 , Hans W Borchers wrote: peter dalgaard pdalgd at gmail.com writes: On Feb 16, 2012, at 12:31 , Hans W Borchers wrote: I have often seen the use of routines from the ACM Collected Algorithms, i.e. netlib.org/toms/≥ (CALGO, or Trans. On Math. Software, TOMS), in

[R] How to change the order of columns in a data frame?

2012-02-17 Thread Joel Fürstenberg-Hägg
Dear all, I have a data frame in which the columns need to be ordered. The first column X is at the right position, but the remaining columns X1-Xn should be ordered like this: X1, X2, X3 etc instead of like below. colnames(pos1) [1] X X1 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X2 X20

Re: [R] help with ancestral.pars in phangorn package

2012-02-17 Thread Ben Bolker
mredfar marhat at gmail.com writes: Hello, I'm struggling with understanding the output on the ancestral.pars() command from the phangorn package, I'm new to doing phylogenetic analyses using R. I used it on nucleotide data, and it works fine, I'm just not sure how to read the output.

Re: [R] lmer - error message

2012-02-17 Thread Ben Bolker
Sean Godwin sean.godwin at gmail.com writes: Hi all, I am fairly new to mixed effects models and lmer, so bear with me. Here is a subset of my data, which includes a binary variable (lake (TOM or JAN)), one other fixed factor (Age) and a random factor (Year). lake FishID Age

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread Sarah Goslee
fakedata - data.frame(A=c(0,0,0), X2=c(2,2,2), X1=c(1,1,1), X3=c(3,3,3)) fakedata A X2 X1 X3 1 0 2 1 3 2 0 2 1 3 3 0 2 1 3 pos - colnames(fakedata)[2:ncol(fakedata)] pos - c(1, 1+as.numeric(gsub(X, , pos))) fakedata[, pos] A X1 X2 X3 1 0 1 2 3 2 0 1 2 3 3 0 1 2 3

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread jim holtman
pos2 - pos1[, c(X, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19, X20)] 2012/2/17 Joel Fürstenberg-Hägg jo...@life.ku.dk: Dear all, I have a data frame in which the columns need to be ordered. The first column X is at the right position, but the

Re: [R] How can I tabulate time series data (in RStudio or any other R editor)?

2012-02-17 Thread David Winsemius
On Feb 16, 2012, at 8:32 PM, jpm miao wrote: Hello, I have a question on how to tabulate the time series data. I use RStudio, but if can be done in any other R editor, it should work in RStudio as well. Most people have given up on using R's time series class and have moved over to

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread Petr Savicky
On Fri, Feb 17, 2012 at 02:26:52PM +0100, Joel Fürstenberg-Hägg wrote: Dear all, I have a data frame in which the columns need to be ordered. The first column X is at the right position, but the remaining columns X1-Xn should be ordered like this: X1, X2, X3 etc instead of like below.

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread Joel Fürstenberg-Hägg
It does not work when using more variables, and my data frames usually contains about thousand columns... Best, Joel fakedata - data.frame(A=c(0,0,0), X1=c(1,1,1), X6=c(6,6,6), X7=c(7,7,7), X3=c(3,3,3), X4=c(4,4,4), X9=c(9,9,9), X2=c(2,2,2), X8=c(8,8,8), X5=c(5,5,5)) fakedata A X1 X6 X7

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread Joel Fürstenberg-Hägg
@Alfredo The X is removed, but the reordering does not work: colnames(df)[1] - Mass columnNames - colnames(df) colnames(df) [1] Mass X1 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X2 X20 X3 X4 X5 X6 X7 X8 X9 colnames(df) - gsub(X,,colnames(df)) colnames(df)

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread Joel Fürstenberg-Hägg
@ Jim That would work for just a few columns, but I will have around 1000 of them so I need something more generic. best, Joel jim holtman jholt...@gmail.com 17-02-2012 14:44 pos2 - pos1[, c(X, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X18, X19,

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread Sarah Goslee
Sorry, it should be: fakedata[, order(pos)] A X1 X2 X3 X4 X5 X6 X7 X8 X9 1 0 1 2 3 4 5 6 7 8 9 2 0 1 2 3 4 5 6 7 8 9 3 0 1 2 3 4 5 6 7 8 9 Using order also ensures that non-sequential column ids will work: fakedata - data.frame(A=c(0,0,0), X1=c(1,1,1), X6=c(6,6,6),

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread Joel Fürstenberg-Hägg
Thank you Sarah, now it works!! Sarah Goslee sarah.gos...@gmail.com 17-02-2012 15:13 Sorry, it should be: fakedata[, order(pos)] A X1 X2 X3 X4 X5 X6 X7 X8 X9 1 0 1 2 3 4 5 6 7 8 9 2 0 1 2 3 4 5 6 7 8 9 3 0 1 2 3 4 5 6 7 8 9 Using order also ensures that

Re: [R] stepwise selection for conditional logistic regression

2012-02-17 Thread Weidong Gu
stepAIC works for an object of clogit. Weidong Gu On Fri, Feb 17, 2012 at 2:10 AM, Subha P. T. subha_...@yahoo.com wrote:  Hi, Is there any function available to do stepwise selection of variables in Conditional(matched) logistic regression( clogit)? step, stepwise  etc are failing in

Re: [R] Error message in gamm. Problem with temporal correlation structure

2012-02-17 Thread Simon Wood
eva, The problem is that the random effects and correlation structure that you have specified don't meet the restrictions required by lme (which gamm calls). You can see this by trying M0 -lme(H ~ Tillage , random=list(Block=~1), na.action=na.omit, data = mydata, correlation = corARMA(form

Re: [R] Dataframe subset - why doesn't this work?

2012-02-17 Thread R. Michael Weylandt
Hi Ajay, Like Jorge, I can't seem to reproduce the behavior you are worried about. mtcars[rownames(mtcars) != Valiant,] returns a 31x11 data.frame as expected. When you say it fails, what error message / result are you seeing? Michael On Fri, Feb 17, 2012 at 3:27 AM, Jorge I Velez

Re: [R] Load packages from source

2012-02-17 Thread Duncan Murdoch
On 17/02/2012 7:01 AM, David Cassany wrote: Hi all, I'm developing an R package and I'd like to load it easly while developing, debugging and testing. I would like to load it without having to install it. Installing it causes me some problems for debugging it, as the code file it is executing

[R] Standard errors from predict.gam versus predict.lm

2012-02-17 Thread Dunbar, Michael J.
I've got a small problem. I have some observational data (environmental samples: abiotic explanatory variable and biological response) to which I've fitted both a multiple linear regression model and also a gam (mgcv) using smooths for each term. The gam clearly fits far better than the lm

Re: [R] Plotting issue

2012-02-17 Thread R. Michael Weylandt
Thank you for trying to improve your question, but it's still impossible to help: the problem is almost certainly in this block of code: plotting## year - 2005:2008 month- (jan,Feb,March,..Dec) for ( y in year) for (m in month) here I use Sp plot and plot

Re: [R] stepwise selection for conditional logistic regression

2012-02-17 Thread David Winsemius
On Feb 17, 2012, at 2:10 AM, Subha P. T. wrote: Hi, Is there any function available to do stepwise selection of variables in Conditional(matched) logistic regression( clogit)? step, stepwise etc are failing in case of conditional logistic regression. Failing is open to a variety

Re: [R] Standard errors from predict.gam versus predict.lm

2012-02-17 Thread Simon Wood
Mike, Isn't this just an example of the wrong model giving a spurious impression of precision? or more accurately, precision at the expense of accuracy? Here's a linear model example of the same thing... set.seed(1) n - 400 x - runif(n)-.5 y - 2+ x*.2+ x^2 + rnorm(n)*.5 m1 - lm(y~1) m2 -

Re: [R] stepwise selection for conditional logistic regression

2012-02-17 Thread Steve Lianoglou
Also, when you're doing reading through David's suggestions: On Fri, Feb 17, 2012 at 10:41 AM, David Winsemius dwinsem...@comcast.net wrote: [snip] Stepwise procedures are supported somewhat grudgingly on r-help. You ought to read some of the critical comments about stepwise procedures in the

Re: [R] lmer - error message

2012-02-17 Thread ilai
I think my problem is that I can't incorporate the 'lake' variable in a fixed-effect interaction because it is only has one binary observation.  But I don't know what to do to be able to fit this model.  Any help would be greatly appreciated! -Sean  In principle you should be able to fit

[R] QR codes can be generated with R-cran?

2012-02-17 Thread Agustin Munoz (Forestal LA)
Srs. QR codes (barcode) can be generated with R-cran?, there is a package that allows it. Watch for your answers. Agustín M. Carpe Diem! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Neighbour List to Matrix

2012-02-17 Thread A J
Hi everybody!I'm a new user of R. I've been having a look to sotored mails in list, but I've been not able to find one suiting to my need. The issue is I have a neighbour list in a TXT file, just as lists generated by social network softwares (f.i. Pajek), where you get Field1, Field2, Value.

[R] basic help: graph multivariate analysis.

2012-02-17 Thread aoife
Hey guys, I'd really appreciate any help. I have a multivariate analysis done, the output of which is: GraphData -read.table(eigen.coa) GraphData V1 V2 V3 V4 1 1 0.371970 0.8552 0.8552 2 2 0.061785 0.1420 0.9972 3 3 0.001211 0.0028 1. 4 4 0.00 0. 1.

Re: [R] How to change the order of columns in a data frame?

2012-02-17 Thread Alfredo Alessandrini
Hi Joel, to replace the colnames: colnames(dataframe - )gsub(X,,colnames(dataframe)) to order by colnames: dataframe - dataframe[,colnames(dataframe)] Alfredo 2012/2/17 Joel Fürstenberg-Hägg jo...@life.ku.dk Dear all, I have a data frame in which the columns need to be ordered. The

Re: [R] Where command in ctree (party)

2012-02-17 Thread josephw
Hi, I'm running into the same issue. I run is.factor() on training data and validation data. All returned false. -- View this message in context: http://r.789695.n4.nabble.com/Where-command-in-ctree-party-tp3264187p4397640.html Sent from the R help mailing list archive at Nabble.com.

[R] editing import data, strings

2012-02-17 Thread gaja
Regards. I'm a beginner in programing, so I have a basic question for you. If someone could help me please.. I want to create a function, which will be able to export files from excel. I tried with a - read.csv(file, sep =,, as.is = TRUE, row.names = 1, header = TRUE), .. but instead of

Re: [R] Where command in ctree (party)

2012-02-17 Thread josephw
i run class(). Both have the same class. -- View this message in context: http://r.789695.n4.nabble.com/Where-command-in-ctree-party-tp3264187p4397693.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] basic help: graph multivariate analysis.

2012-02-17 Thread R. Michael Weylandt
There are lots of multivariate graphs.perhaps browsing this gallery will give you some idea of what you want (example code is provided): http://addictedtor.free.fr/graphiques/ This blog also does a nice job of introducing some graphs with the ggplot2 package: https://learnr.wordpress.com/

Re: [R] Error message in gamm. Problem with temporal correlation structure

2012-02-17 Thread HERNANDEZ PLAZA, MARIA EVA
Thank you Simon, that works well. I had tried previously m1 -gamm(H ~ Tillage + s(Year, by =Tillage), random=list(Block=~ Tillage), na.action=na.omit, data =mydata, correlation = corARMA(form =~ Year|Tillage/Block, p = 1, q = 0)) and that gave me convergence problems. Thank you!

[R] Hoe to resample matrices to test for the robustness of their correlation

2012-02-17 Thread camilleislande
Hello I have several populations where I have morphology and diet for each individual. I am interested in the correlation between diet and morphological distances. However the number of individuals in each population ranges from 22 to 80 individuals. I have looked at the correlation

Re: [R] editing import data, strings

2012-02-17 Thread R. Michael Weylandt
If you know all your data should be numeric, you could perhaps try something like this: apply(a, 2, function(x) as.numeric(gsub( , , x))) but it can't be tested without your actual data. (Look at dput() for the best way to send data by email) Michael On Fri, Feb 17, 2012 at 12:24 PM, gaja

Re: [R] Different cp values in rpart() using plotcp() and printcp()

2012-02-17 Thread Uwe Ligges
On 17.02.2012 11:18, silje skår wrote: hi, I have a question regarding cp values in rpart(). When I use plotcp() I get a figure with cp values on the x-axsis, but then I use printcp() the cp values in that list are different from the values in the figure by plotcp(). Does someone know why?

Re: [R] editing import data, strings

2012-02-17 Thread jim holtman
At least post the first 10 lines of the file so that we can see what it is. It may be that some of the data is enclosed in quotes, but it is hard to tell without seeing the actual data. On Fri, Feb 17, 2012 at 12:24 PM, gaja gajahor...@hotmail.com wrote: Regards. I'm a beginner in programing,

Re: [R] Neighbour List to Matrix

2012-02-17 Thread jim holtman
You might want to post a better example of what your data looks like. In the email, it is hard to tell how to split the data into rows that can be read with three fields since it looks like the data is composed of pairs of numbers. On Fri, Feb 17, 2012 at 7:42 AM, A J anxu...@hotmail.com wrote:

Re: [R] Neighbour List to Matrix

2012-02-17 Thread A J
Sorry too much. I was convinced it was able to view well. So, the structure of my data set is something like this: ID1 IDP2 SUMVAL 1 56 0.0659358951 900 0.0441101851 1409 0.1963141973 4 0.0713203883 83 0.0162695643 529 0.0113592393 883 0.0122425333 1242

Re: [R] Neighbour List to Matrix

2012-02-17 Thread jim holtman
Is this what you are after: x - read.table(text = ID1 IDP2 SUMVAL + 1 56 0.065935895 + 1 900 0.044110185 + 1 1409 0.196314197 + 3 4 0.071320388 + 3 83 0.016269564 + 3 529 0.011359239 + 3 883 0.012242533 + 3 1242 0.016558924 + 4 3 0.004307024 + 4 7

Re: [R] Where command in ctree (party)

2012-02-17 Thread Achim Zeileis
On Fri, 17 Feb 2012, josephw wrote: i run class(). Both have the same class. Without a reproducible example it is hard to say what is going on here. All columns of the learning and the test data need to have (a) the same name, (b) the same class, (c) the same levels in case they are

[R] Job posting for programmer with database skills

2012-02-17 Thread Bos, Roger
NYC-based equity asset management company is seeking a junior-level programmer with R, VBA, and MS-SQL skills. HTML skill is a plus. This permanent, full-time position will involve working on projects and improving our daily processes. Finance knowledge is helpful, but not necessary. We are an

Re: [R] editing import data, strings

2012-02-17 Thread gaja
Thanx for posting. :) I'm posting a link to excel file, same as I want import to table. Its dl link, don't be mad, hehe http://spreadsheets.google.com/pub?key=phAwcNAVuyj0XOoBL_n5tAQoutput=csv Thanx,G. ps: @Michael Weylandt; Thanx for your code,... I tried to used it, but unsucsesfully. I

Re: [R] Where command in ctree (party)

2012-02-17 Thread Joseph Wang
I was able to narrow down to a column that has different types using featurefields-c(7, 17, 19, 20, 22, 33, 35, 36, 38, 44:132) flag - rep(0, ncol(data)) for (i in featurefields) { flag[i] - class(data[,i]) != class(validdata[,i]) } It is an integer class in the training data but is

Re: [R] Neighbour List to Matrix

2012-02-17 Thread A J
I don't know why data are not well shown... I have attached a PDF file to this message with the structure of the begining list and the final matrix one. I think I have no explain the issue in a right way. Sorry for the inconveniences. The last thing I want is to disturb with technical

[R] covariance

2012-02-17 Thread Ali2006
can any one please tell me how can I Compute the covariance matrix of (Y) which is 5 variables .. without using a built-in function?? 2) how (cov) works ( I need to get the details for this function ??? -- View this message in context:

Re: [R] covariance

2012-02-17 Thread Doran, Harold
Yes, the function is based on the idea that you have two random variables, X and Y and the covariance is then computed as Cov(x,y) = E[(X - E(X)) (Y - E(Y))] Where E[.] is the expectation operator. -Original Message- From: r-help-boun...@r-project.org

Re: [R] Neighbour List to Matrix

2012-02-17 Thread David Winsemius
On Feb 17, 2012, at 2:19 PM, A J wrote: I don't know why data are not well shown... I have attached a PDF file to this message with the structure of the begining list and the final matrix one. You should have attached the sample.txt file. I think I have no explain the issue in a right

Re: [R] covariance

2012-02-17 Thread Sarah Goslee
This sounds remarkably like homework. You can address your own issue using the built-in help system and R's capability to allow you to view source code for functions, but we can't help you do your assignments. Sarah On Fri, Feb 17, 2012 at 2:36 PM, Ali2006 nasser-d2...@hotmail.com wrote: can

[R] convert zoo object to standard R object so I can plot and output to csv file

2012-02-17 Thread Henry
Another newbie question I got the 1 minute spine interpolation and 15 mean aggregation working with many thanks to Gabor Grothendieck using Zoo functions. I got a tip from Hasan Diwan to look at xts but it seemed I would make better progress using code from Gabor. Now I'm having trouble plotting

Re: [R] covariance

2012-02-17 Thread David Winsemius
On Feb 17, 2012, at 2:36 PM, Ali2006 wrote: can any one please tell me how can I Compute the covariance matrix of (Y) which is 5 variables .. without using a built-in function?? 2) how (cov) works ( I need to get the details for this function ???

Re: [R] convert zoo object to standard R object so I can plot and output to csv file

2012-02-17 Thread R. Michael Weylandt
?write.zoo Perhaps with sep = , if you have multiple columns. Michael On Fri, Feb 17, 2012 at 2:56 PM, Henry hcco...@lbl.gov wrote: Another newbie question I got the 1 minute spine interpolation and 15 mean aggregation working with many thanks to Gabor Grothendieck using Zoo functions.  I

[R] R's list data structure

2012-02-17 Thread Ajay Askoolum
Given dayOfWeekName-c(Mon,Tue,Wed,Thu,Fri,Sat,Sun); dayOfWeekOrdinal-c(1,2,3,4,5,6,0); dayOfWeekWorkDay-c(TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE); weekProfile-list(dow=dayOfWeekName,dowI=dayOfWeekOrdinal,dowW=dayOfWeekWorkDay) 1. How can I conditionally get dow, dowI, and dowW from weekProfile?

Re: [R] R's list data structure

2012-02-17 Thread Sarah Goslee
HI Ajay, On Fri, Feb 17, 2012 at 3:20 PM, Ajay Askoolum aa2e...@yahoo.co.uk wrote: Given dayOfWeekName-c(Mon,Tue,Wed,Thu,Fri,Sat,Sun); dayOfWeekOrdinal-c(1,2,3,4,5,6,0); dayOfWeekWorkDay-c(TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE);

Re: [R] Dataframe subset - why doesn't this work?

2012-02-17 Thread Ajay Askoolum
Thank you Jorge Michael. I was being stupid - its the only explanation! The line I had been executing was mtcars[rownames==Valiant] # missing rownames argument but the line I quoted in my post was mtcars[rownames(mtcars) != Valiant,]  # How could I write the correct line in the mailing

Re: [R] R's list data structure

2012-02-17 Thread Ajay Askoolum
Hi Sarah,     Thanks you for the clarifications; I had worked round the problem by switching to a data.frame.     However, I am still unclear about 'list': as it exists, it must have a purpose. When is the use of the list data structure appropriate? [[alternative HTML

Re: [R] R's list data structure

2012-02-17 Thread Sarah Goslee
On Fri, Feb 17, 2012 at 3:37 PM, Ajay Askoolum aa2e...@yahoo.co.uk wrote: Hi Sarah,     Thanks you for the clarifications; I had worked round the problem by switching to a data.frame.     However, I am still unclear about 'list': as it exists, it must have a purpose. When is

Re: [R] covariance

2012-02-17 Thread Naser Albalwi
Thank, thats what I need, using the built-in help system and R's capability to allow you to view source code for functions, but how??? Date: Fri, 17 Feb 2012 14:55:10 -0500 Subject: Re: [R] covariance From: sarah.gos...@gmail.com To: nasser-d2...@hotmail.com CC: r-help@r-project.org

Re: [R] covariance

2012-02-17 Thread Ali2006
could you help with example ?? -- View this message in context: http://r.789695.n4.nabble.com/covariance-tp4398242p4398470.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] covariance

2012-02-17 Thread Petr Savicky
On Fri, Feb 17, 2012 at 11:06:23PM +0300, Naser Albalwi wrote: Thank, thats what I need, using the built-in help system and R's capability to allow you to view source code for functions, but how??? Hi. First, type cov without quotation marks to R's prompt. The printed code calls

Re: [R] QQ plot

2012-02-17 Thread Rolf Turner
On 18/02/12 00:15, nandan amar wrote: Thanks a lot Turner. Latter I also tried following : oo-quantile(original, probs = seq(0, 1, 0.01), type = 8) pp-quantile(predicted, probs = seq(0, 1, 0.01), type = 8) plot(oo,pp) But plot for above and following (as you suggested) are not same. What may

Re: [R] RODBC for 64-bit R with 32-bit Access

2012-02-17 Thread GreatDana
This was my experience connecting remotely to an Oracle database with R 64 bit on Windows 7 64-bit. I already had a configuration for 32-bit R and 32-bit Oracle using RODBC that worked, but I wanted to only use R-64. Here was what I did that works: This was assuming an install to the root c:\ and

[R] error with read.zoo, Error in xy.coords(x, y) : (list) object cannot be coerced to type 'double'

2012-02-17 Thread Henry
I'm now trying to read.zoo in a rather long txt file with two columns: date/time and value in kW e.g. 432.2189 The read.zoo function finally ran without errors but not sure it is correct. I took the header off, and put in commas and added a at the beginning and at the end.

Re: [R] Asking About packages rimage

2012-02-17 Thread chuan_zl
Thanks a lot -- View this message in context: http://r.789695.n4.nabble.com/Asking-About-packages-rimage-tp4395719p4398726.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Neighbour List to Matrix

2012-02-17 Thread ilai
I think is good to know that list contain more than 60 rows with around 14000 nodes (participants). ?read.table may be unreliable for large matrices and with 14/600 you'll end up with many NA's. You might do better with nbrs- scan('nbrs.txt',skip=1,what=list('integer','integer',double(0)))

Re: [R] editing import data, strings

2012-02-17 Thread jim holtman
Is this what you want to do: this will remove the commas and convert to numeric x - read.csv(C:\\jph\\indicatorgapminderpopulation.csv + , as.is = TRUE + , check.names = FALSE + ) # convert to numeric column 2+ for (i in 2:ncol(x)){ + x[, i] -

Re: [R] R's list data structure

2012-02-17 Thread Bert Gunter
FWIW: Lists are a fundamental, universal, recursive data structure. All other data structures (i.e. r.e. sets) can be represented as lists. Indeed, one of the earliest high level (non-machine instructions) computer languages, McCarthy's LISP = List Processing, is based on lists. R was designed to

Re: [R] editing import data, strings

2012-02-17 Thread Henrique Dallazuanna
Try this: setClass(myClass) setAs(character, myClass, function(from)as.numeric(gsub(,, , from))) d - read.table(clipboard, sep = ,, check.names = FALSE, quote = '', header = TRUE, fill = TRUE, colClasses = c('character', rep('myClass', 232))) On Fri, Feb 17, 2012 at 3:24 PM, gaja

[R] still need read.zoo command help

2012-02-17 Thread Henry
The problem now is it looks like my read.zoo isn't working. Sorry for sort of double posting. Someone please assist if you have time with my read.zoo command line. my data is as just below this line, a time stamp and a real number with a comma sep. 10/11/2011 23:00:06,432.12

Re: [R] still need read.zoo command help

2012-02-17 Thread Hasan Diwan
Henry, You're reading a CSV with read.zoo. This is not likely to work. The way I'd do this is: data - read.csv('/tmp/Kevin-0-comma-ITPower.txt', header=FALSE) z - zoo(data[,2], order.by=as.POSIXct(data[,1], format='%d/%m/%y %H:%M:%S') # or whatever your format actually is... -- H Sent from my

[R] assigning NULL to a list element

2012-02-17 Thread Benilton Carvalho
Hi everyone, For reasons beyond the scope of this message, I'd like to append a NULL element to the end of a list. tmp0 - list(a=1, b=NULL, c=3) append(tmp0, c(d=4)) ## works as expected append(tmp0, c(d=NULL)) ## list with a/b/c only Given that I could use tmp0$a - NULL to remove 'a', I seem

Re: [R] assigning NULL to a list element

2012-02-17 Thread David Winsemius
On Feb 17, 2012, at 8:51 PM, Benilton Carvalho wrote: tmp0 - list(a=1, b=NULL, c=3) length(tmp0) - 4 tmp0 $a [1] 1 $b NULL $c [1] 3 [[4]] NULL David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list

Re: [R] assigning NULL to a list element

2012-02-17 Thread Benilton Carvalho
Thank you very much, David. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] assigning NULL to a list element

2012-02-17 Thread Mark Leeds
Hi Benilton: David's solution is short and sweet but below also works. I searched and searched and finally found it in the R-inferno by Patrick Burns. I never looked at the R-inferno carefully before. After glancing at it, I'm printing it out and binding it tomorrow. It's the got ya book for R.

Re: [R] editing import data, strings

2012-02-17 Thread R. Michael Weylandt michael.weyla...@gmail.com
It looks like you've gotten answers elsewhere, but for completeness, I'll explain my shot in the dark: The construction function (x) sin(x^2) to pick one example, is what's called an anonymous (or lambda) function. In R, they are often used in conjunction with the *apply() family to

Re: [R] lmer - error message

2012-02-17 Thread Joshua Wiley
Hi Sean, Thanks for the data. Your first problem is that Age is a factor with 14 levels. Second, Year is a factor with 16 levels. Now consider what interactions of these will be---factors with a huge number of levels, exceeding what is reasonable to fit to your size of data. I included inline

Re: [R] sequencing environments

2012-02-17 Thread Ben quant
Thanks Gabor/Duncan, I might give that proto package a try. The R.oo package is more intuitive for someone coming from a traditional OO background, but compared to proto, it looks like it requires a lot more typing to create the same amount of functionality. I've used R.oo for a number of months

[R] is there a command to withdraw already performed command in R?

2012-02-17 Thread YN Kim
Hi all, Is there any command or function to withdraw a command performed already in R? For instance, after drawing a line in existing plot, can I remove the line in the plot? I know I can use a way of overlapping on the former line so that it looks like a removing the line, but I'm wondering

Re: [R] still need read.zoo command help

2012-02-17 Thread Gabor Grothendieck
On Fri, Feb 17, 2012 at 7:54 PM, Henry hcco...@lbl.gov wrote: The problem now is it looks like my read.zoo isn't working. Sorry for sort of double posting. Someone please assist if you have time with my read.zoo command line. my data is as just below this line, a time stamp and a real number

Re: [R] convert zoo object to standard R object so I can plot and output to csv file

2012-02-17 Thread Gabor Grothendieck
On Fri, Feb 17, 2012 at 2:56 PM, Henry hcco...@lbl.gov wrote: Another newbie question I got the 1 minute spine interpolation and 15 mean aggregation working with many thanks to Gabor Grothendieck using Zoo functions.  I got a tip from Hasan Diwan to look at xts but it seemed I would make

  1   2   >