[R] subset function unexpected behavior

2010-02-02 Thread David Katz
I was surprised to see this unexpected behavior of subset in a for loop. I looked in subset.data.frame and it seemed to me that both versions should work, since the subset call should be evaluated in the global environment - but perhaps I don't understand environments well enough. Can someone

Re: [R] Odp: How to repeat for function?

2010-02-02 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.02.2010 18:14:04: Dear Petr, The intention is to get a ratio value for every observations (1400 obs) for every variable (4 variables). Well, maybe that mat-matrix(runif(12),4,3) ratiomat-t(t(mat)/vec) And from the ratios, I would like

Re: [R] subset function unexpected behavior

2010-02-02 Thread Dennis Murphy
Hi: Try this for your second loop instead: for(s in school.list){ print(s) print(subset(input.data, sch == s)) } [1] 1 sch pop 1 1 100 2 1 200 [1] 2 sch pop 3 2 300 4 2 400 Don't confound the 'sch' variable in your data frame with the index in your loop :) HTH, Dennis On Mon,

Re: [R] Weighted SD

2010-02-02 Thread Patrick Burns
There is 'cov.wt'. (If you have univariate data, then you need to use 'as.matrix'.) On 01/02/2010 20:32, Thomas Lumley wrote: On Mon, 1 Feb 2010, David Winsemius wrote: On Feb 1, 2010, at 12:37 PM, Антон Морковин wrote: Dear all, what function can be used to calculate weighted SD or/and

Re: [R] character variables in substitute()

2010-02-02 Thread Dennis Murphy
Hi: I played around with this earlier, but had only limited success. This is what I got; perhaps others can embellish this with more efficient (and correct) code. I couldn't get more than one expression in a line without overplotting. Here's an example: plot(c(0, 1), c(0, 1)) text(0.5, 0.5,

[R] Suppressing scientific notation on plot axis tick labels

2010-02-02 Thread Dimitri Shvorob
Is there a better alternative to x = c(1e7, 2e7) x.lb = c(0,1e7,2e7) s.lb = format(x.lb, scientific = FALSE, big.mark = ,) barplot(x, yaxt = n, ylab = ) axis(side = 2, at = x.lb, labels = s.lb) (I am sure there is a better alternative to line 2 :)). Thank you. -- View this message in

[R] how to use optim() or nlm() to solve three nonlinear equations

2010-02-02 Thread Nai-Wei Chen
Dear all, I just know how to solve an eaquation by using optim() or nlm(). But, now, I have three nonlinear equations, how could we use optim() or nlm() to solve  a system of nonlinear equations in R?  Thank you so much. Sincerely, Joe ___

Re: [R] character variables in substitute()

2010-02-02 Thread Eik Vettorazzi
Hi David, there is a solution using bquote instead of substitute expr-bquote(italic(.(pname[1]))==.(params[1])~, ~.(as.name(pname[2]))==.(params[2])) plot(1,1,main=expr) hth. dkStevens schrieb: In trying to create a plotmath expression for plot labeling, such as R = 6, beta = 15 where I

[R] Yield to Maturity using R

2010-02-02 Thread Madhavi Bhave
Dear R helpers,     Yesterday I had raised following query which was addressed by Mr Ellison. The query and the wonderful solution as provided by Mr. Ellison are as given below.    ## PROBLEM   I am calculating the 'Yield to Maturity' for the Bond with following characteristics.    Its a $1000

Re: [R] character variables in substitute()

2010-02-02 Thread Dennis Murphy
That's the trick, Eik! Nice job. To return to the problem I was struggling with, it works with the following incantation: names - c('R', 'P', 'k', 'alpha') vals - c(13.34859, 2.53071, 4.06000, 0.00719) expr - bquote(.(names[1])==.(vals[1])~, ~.(as.name(names[2]))[m]==.(vals[2])~,

[R] Memory Problem

2010-02-02 Thread Meenakshi
Hi, When I run the repeat loop in R for large dataset, I got Memory problem. How can I solve these problem. -- View this message in context: http://n4.nabble.com/Memory-Problem-tp1459740p1459740.html Sent from the R help mailing list archive at Nabble.com.

[R] Abstract submission deadline, useR! 2010

2010-02-02 Thread Katharine Mullen
The abstract submission deadline for the R Users Conference, useR! 2010, is just one month away. Submission deadline: 2010-03-01 Early registration will also close on 2010-03-01. Now is the perfect time to prepare an abstract presenting innovations or exciting applications of R. The call

[R] [R-pkgs] Major update: mboost 2.0-0 released

2010-02-02 Thread Benjamin Hofner
Dear useRs, we are happy to announce the release of mboost 2.0-0 on CRAN: http://cran.r-project.org/package=mboost This version contains major updates and changes to the implementation of the main algorithm. Some slight changes to the user-interface where necessary. Please consult the manual

Re: [R] Suppressing scientific notation on plot axis tick labels

2010-02-02 Thread Dimitri Shvorob
Ruben Roa has kindly suggested using 'scipen' option - cf. fixed notation will be preferred unless it is more than ‘scipen’ digits wider. However, options(scipen = 50) x = c(1e7, 2e7) barplot(x) still does not produce the desired result. -- View this message in context:

[R] 3D plot of following data

2010-02-02 Thread walter.djuric
Hello R-experts, I am having difficulties with 3D plotting (i.e. the evolution of various forward curves through time). I have two comma seperated files both ordered by date (in the first column) one containing contracts (meaning forward delivery months from YEAR_ Letter F ... January

Re: [R] how to use optim() or nlm() to solve three nonlinear equations

2010-02-02 Thread Berend Hasselman
Nai-Wei Chen wrote: I just know how to solve an eaquation by using optim() or nlm(). But, now, I have three nonlinear equations, how could we use optim() or nlm() to solve  a system of nonlinear equations in R?  Thank you so much. You don't use general optimize routines to solve a

Re: [R] Solving an optimization problem: selecting an quot; optimalquot; subset

2010-02-02 Thread Hans W Borchers
Erwin Kalvelagen-2 wrote: Hans W Borchers hwborchers at googlemail.com writes: # Prepare inputs for MILP solver obj - c(rep(0, n), 0, 1, 1, 0) typ - c(rep(B, n), B, C, C, B) mat - matrix(c(s, -z, -1, 1, 0,# a = a_p + a_m rep(0, n), 1, 0, 0,

Re: [R] Yield to Maturity using R

2010-02-02 Thread Eik Vettorazzi
Hi Madhavi, the error message means, that your function returns NA evaluated at the lower limit of the search interval. try f.ytm(0) to check that. I think, for (i in 1 : (tenure * no_comp - 1)) E = NULL F = NULL { E[i] = cash_flow[i]/(1+ytm)^i F = (sum(E) + (face_value +

[R] hvcluster() with distance method from vegdist(), package = vegan

2010-02-02 Thread Kay Cichini
hello, i'd be happy if someone could provide help with the following problem: i have a dist.matrix that comes from vegdist() function of the vegan package. the used method = horn is not accepted as argument in hvcluster(...,dist.method=...). is there a way to incorporate the method horn in

Re: [R] hvcluster() with distance method from vegdist(), package = vegan

2010-02-02 Thread Kay Cichini
sorry, it should say pvclust(), of course... -- View this message in context: http://n4.nabble.com/hvcluster-with-distance-method-from-vegdist-package-vegan-tp1459859p1459865.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Yield to Maturity using R

2010-02-02 Thread Madhavi Bhave
Dear Sir,   Thank you for valuable guidance. Though I have been using R occassionally, it was limited to some basics and that way I am new to R. As suggested by you, I have gone through the said chapter of Introduction to R manual, though I have some urgent comittments to meet.   I have tried

Re: [R] Memory Problem

2010-02-02 Thread Uwe Ligges
On 02.02.2010 11:33, Meenakshi wrote: Hi, When I run the repeat loop in R for large dataset, I got Memory problem. How can I solve these problem. buy more memory, bigger machine, more efficient programming, import of only relevant data, use of specific tools, .. or in other words:

Re: [R] 3D plot of following data

2010-02-02 Thread Uwe Ligges
Since your files did not come through the mail list, I'd suggest to put them on some webside and provide a link. Uwe Ligges On 02.02.2010 13:01, walter.dju...@chello.at wrote: Hello R-experts, I am having difficulties with 3D plotting (i.e. the evolution of various forward curves through

[R] Biclustering / Co-clustering in more than 2 dimensions

2010-02-02 Thread Tim Smith
Hi, I was wondering if there existed a package in R that would bicluster / co-cluster in more than 2 dimensions. thanks! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Subtracting time series

2010-02-02 Thread Nick Torenvliet
Hi all, I've got a time series object (xts) called table. Table contains closing price and volume for each market day of 2009 on a given equity. I'd like to get another xts object, say table2, that contains for each market day holds the close of that day minus the close of the day before and

[R] strange behaviour: recognition of decimal numbers by 'which'

2010-02-02 Thread J . delasHeras
It is a strange behaviour in that I did not expect it... but I am sure there is a simple explanation for it and it'll have to do with the way numbers are stored in R, but it's caught me by surprise and I don't find it obvious. Here's a simplified example reproducing the behaviour I

Re: [R] strange behaviour: recognition of decimal numbers by 'which'

2010-02-02 Thread Erik Iverson
FAQ 7.31 j.delashe...@ed.ac.uk wrote: It is a strange behaviour in that I did not expect it... but I am sure there is a simple explanation for it and it'll have to do with the way numbers are stored in R, but it's caught me by surprise and I don't find it obvious. Here's a simplified

Re: [R] Biclustering / Co-clustering in more than 2 dimensions

2010-02-02 Thread Gábor Csárdi
Hi Tim, maybe you are looking for something like this: http://www.nature.com/nbt/journal/v26/n5/full/nbt1397.html It is relatively easy to implement in R, I think. Best, Gabor On Tue, Feb 2, 2010 at 3:44 PM, Tim Smith tim_smith_...@yahoo.com wrote: Hi, I was wondering if there existed a

Re: [R] Subtracting time series

2010-02-02 Thread Achim Zeileis
On Tue, 2 Feb 2010, Nick Torenvliet wrote: Hi all, I've got a time series object (xts) called table. Table contains closing price and volume for each market day of 2009 on a given equity. I'd like to get another xts object, say table2, that contains for each market day holds the close of

[R] finding files whose name does NOT contain a given character

2010-02-02 Thread mauede
Unluckily I dela with miRNA files whose name may contain the character *. Because of the special meaning of * I have to remove it. I found out how to make list.files() extract only those file names which contain a * Namely: # list.files(pattern=\\*) Now I have to process all files whose name

[R] Plot - specification for grid of x axis

2010-02-02 Thread Trafim Vanishek
Dear all, I have a simple question for which I cannot find the answer. I need to make an easy plot, but for the x axis I need to be able to specify by myself the division of x axis from x[,1] either every single observation, or every 5th, or 10th or 20th x - matrix(data=NA, nrow=100, ncol=2)

Re: [R] finding files whose name does NOT contain a given character

2010-02-02 Thread Peter Dalgaard
mau...@alice.it wrote: Unluckily I dela with miRNA files whose name may contain the character *. Because of the special meaning of * I have to remove it. I found out how to make list.files() extract only those file names which contain a * Namely: # list.files(pattern=\\*) Now I have to

Re: [R] finding files whose name does NOT contain a given character

2010-02-02 Thread Erik Iverson
mau...@alice.it wrote: Unluckily I dela with miRNA files whose name may contain the character *. Because of the special meaning of * I have to remove it. I found out how to make list.files() extract only those file names which contain a * Namely: # list.files(pattern=\\*) Now I have to

[R] Finding the difference between two vectors

2010-02-02 Thread anna
Hello everyone, I have two vectors having only one element different: vector1 vector2 vector1 TWC TWC TWC VFC TWX

Re: [R] merging data frames gives all NAs

2010-02-02 Thread James Rome
David, Now the code is: for (j in seq_along(rwy)) { # subset the data and merge them ar4rw = ar4rw - subset(arrgnd, arrgnd$Runway==rwy[j]) if(j == 1) { arrw = ar4rw } else { arrw = merge(arrw, ar4rw) } } I attach the data. I needed 500 rows to get both runways in rwy. The suggestions did not

Re: [R] 3D plot of following data

2010-02-02 Thread Uwe Ligges
On 02.02.2010 16:01, walter.dju...@chello.at wrote: Here they are for now for you. And I will put them somewhere in a few minutes and poost the link. No need to do so. If you really want to use 3D plots (which I doubt you really want since you could do better in 2D using dotcharts or so):

Re: [R] finding files whose name does NOT contain a given charac

2010-02-02 Thread Ted Harding
On 02-Feb-10 15:18:28, Peter Dalgaard wrote: mau...@alice.it wrote: Unluckily I dela with miRNA files whose name may contain the character *. Because of the special meaning of * I have to remove it. I found out how to make list.files() extract only those file names which contain a * Namely:

Re: [R] Suppressing scientific notation on plot axis tick labels

2010-02-02 Thread Dimitri Shvorob
options(scipen = 50, digits = 5) x = c(1e7, 2e7) barplot(x) Still scientific... -- View this message in context: http://n4.nabble.com/Suppressing-scientific-notation-on-plot-axis-tick-labels-tp1459697p1459828.html Sent from the R help mailing list archive at Nabble.com.

[R] R assistance

2010-02-02 Thread dragomir nedeltchev
Dear Madam/Sir, I read carefully The R Installation and Administration paper. I downloaded Rtools11.exe and I run it. As a result there is a directory R on my PC. Could you please tell me what should I do next in order to run R? Thank you in advance. BR Dragomir Nedeltchev

Re: [R] hiding/protecting utility functions in .Rprofile

2010-02-02 Thread Chris Campbell
On Mon, Feb 1, 2010 at 13:19, Michael Friendly frien...@yorku.ca wrote: [Env: WinXp, R 2.9.2] In my .Rprofile, I define a number of utility functions I'd like to have available in my R session, but don't want them to be *normally* listed by ls(), or more importantly, saved if I save my

Re: [R] 3D plot of following data

2010-02-02 Thread walter.djuric
a link to the 3D plot data files http://members.chello.at/gwd the files are NG_contracts and NG_values -- mfg WD __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] R assistance

2010-02-02 Thread stephen sefick
Download the R installer from CRAN, and run that. A desktop icon should pop up, and you should be set. Stephen On Tue, Feb 2, 2010 at 8:16 AM, dragomir nedeltchev dnedelche...@yahoo.com wrote: Dear Madam/Sir, I read carefully The R Installation and Administration paper. I downloaded

Re: [R] Suppressing scientific notation on plot axis tick labels

2010-02-02 Thread Meyners, Michael, LAUSANNE, AppliedMathematics
Strange, the following works reproducibly on my machine (Windows 2000 Pro): options(scipen = 50, digits = 5) x = c(1e7, 2e7) ?barplot barplot(x) while I also get scientific with your code. After I called ?barplot once, I'm incapable of getting the scientific notation again, though... But I

[R] Odp: Finding the difference between two vectors

2010-02-02 Thread Petr PIKAL
Hi Option one vec1-sample(letters[1:10]) vec2-vec1[-5] vec2-c(vec2,NA) # missing position mis-which(!(vec1 %in% vec2)) c(vec2[1:(mis-1)], NA,vec2[mis:((length(vec2)-1))]) [1] f e g d NA j c i b h gives you desired vector. For two or more values missing it shall be rephrased probably by rle

Re: [R] Plot - specification for grid of x axis

2010-02-02 Thread Greg Snow
When you create your plot us the argument xaxt='n'. That will suppress the default axis labels and tick marks. Then use the axis function which lets you specify exactly where you want the tick marks and exactly what you want the labels to be. You can also specify tck=1 as an argument if you

[R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread anna
Hi, I have a data frame datas with half of the columns with the same name A. I want to delete all those columns from the data frame so here is what I did: datas$A - NULL The problem is that it deleted only one column, I would have to do it as many times as there are A columns. Is there a way to

Re: [R] create an object in a loop (v3)

2010-02-02 Thread Ivan Calandra
Hi David, Thanks for your answer. But I don't really see how I can extend it with my real data. The thing is that I have more than 3 names and 1 value for each name. Moreover, each is different from one run to another. That is why I was trying with a modification of names(). Also to be noted

Re: [R] using rbind in a for loop

2010-02-02 Thread Steve Lianoglou
Hi, On Mon, Feb 1, 2010 at 11:16 PM, Eunjung Kim eunjung.haw...@gmail.com wrote: *Dear R users, *I'm facing a trivial problem but I cannot solve it. My question is: I want to make data set like this. i_lon1 i_lat1 i_lon2 i_lat2 i_lon3 i_lat3 i_lon4 i_lat4 i+1_lon1 i+1_lat1 i+1_lon2

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread anna
This is what I just found now but I guess there is a simpler way: datas[which(names(datas)==A)]-list(rep(NULL,length(which(names(datas)==A but it worked - Anna Lippel -- View this message in context:

Re: [R] character variables in substitute()

2010-02-02 Thread dkStevens
This is an interesting approach but it doesn't quite get what I want. The sample below is what I'm looking for where Eik's Title is compared with the text line within the plot. My text line was produced by the explicit text(0.6,1.2,expression(R *'= 13.35, ' *P[m] *'= 2.531, ' *alpha[r] *'=

Re: [R] subset function unexpected behavior

2010-02-02 Thread David Katz
Thanks, that helps! Subset creates a new context where a name clash can occur. So if I don't want to check for that possibility, I should use a special kind of index like .sch, or avoid subset: for(sch in school.list){ print(sch) print(input.data[input.data[,school.var] == sch,])} which

Re: [R] Plot - specification for grid of x axis

2010-02-02 Thread Ally
Have a look at ?par and check out the 'xaxp' parameter par(mfrow=c(1,2)) plot(x[,2] ~ x[,1], xaxp=c(0,100,5)) plot(x[,2] ~ x[,1], xaxp=c(0,100,10), cex.axis=0.5) -- View this message in context: http://n4.nabble.com/Plot-specification-for-grid-of-x-axis-tp1460005p1460083.html Sent from the R

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread Gabor Grothendieck
Try: newdf - datas[names(datas) != A] On Tue, Feb 2, 2010 at 11:47 AM, anna lippelann...@hotmail.com wrote: This is what I just found now but I guess there is a simpler way: datas[which(names(datas)==A)]-list(rep(NULL,length(which(names(datas)==A but it worked - Anna Lippel --

Re: [R] character variables in substitute()

2010-02-02 Thread Gabor Grothendieck
Try this: leg - function(pNames, vparams) parse(text = paste(pNames, vparams, sep = ==)) plot(0, main = leg(Sigma, 3.2)) legend(topleft, legend = leg(c(alpha[beta], delta), 1:2)) On Tue, Feb 2, 2010 at 11:44 AM, dkStevens david.stev...@usu.edu wrote: This is an interesting approach but it

Re: [R] Error with toString

2010-02-02 Thread anna
Romain, to keep it simple, I reproduced the example that you can find in the toString function help and I still got the same error: x - c(a, b, aaa) toString(x) Error in toString(x) : could not find function .jcall - Anna Lippel -- View this message in context:

Re: [R] barplot y axis too short

2010-02-02 Thread Jack Siegrist
Thanks for the replies. Apparently you cannot adjust the extension factor used by yaxs (which is set at 4%), so what I did is wrote a function (barplotCovered) to get y-axis limits based on the range of the data and a user-defined axis expansion factor (axExFact). I included an example below

Re: [R] population variance and sample variance

2010-02-02 Thread Peng Yu
On Mon, Oct 19, 2009 at 12:53 PM, Kingsford Jones kingsfordjo...@gmail.com wrote: sum((x-mean(x))^2)/(n) [1] 0.4894708 ((n-1)/n) * var(x) [1] 0.4894708 But this is not a built-in function in R to do so, right? hth, Kingsford On Mon, Oct 19, 2009 at 9:30 AM, Peng Yu pengyu...@gmail.com

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread Phil Spector
Anna - You could also look at the problem from the other direction: data[,names(datas) != 'A'] - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] Error with toString

2010-02-02 Thread jim holtman
What packages are loaded? On the basic system, it works fine: toString(123) [1] 123 toString(c('a', 'b', 'zz')) [1] a, b, zz On Tue, Feb 2, 2010 at 12:17 PM, anna lippelann...@hotmail.com wrote: Romain, to keep it simple, I reproduced the example that you can find in the toString

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread Jeff Laake
Here is one way with an example: datas=data.frame(x=1:3,A=1:3,A=1:3) names(datas)=c(x,A,A) datas datas=datas[,names(datas)!=A,drop=FALSE] datas On 2/2/2010 8:35 AM, anna wrote: Hi, I have a data frame datas with half of the columns with the same name A. I want to delete all those columns from

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread Uwe Ligges
datas[ , A != colnames(datas)] Uwe Ligges On 02.02.2010 17:35, anna wrote: Hi, I have a data frame datas with half of the columns with the same name A. I want to delete all those columns from the data frame so here is what I did: datas$A- NULL The problem is that it deleted only one column, I

Re: [R] subset function unexpected behavior

2010-02-02 Thread Thomas Lumley
On Tue, 2 Feb 2010, David Katz wrote: Thanks, that helps! Subset creates a new context where a name clash can occur. So if I don't want to check for that possibility, I should use a special kind of index like .sch, or avoid subset: for(sch in school.list){ print(sch)

[R] Doubt about cluster analysis

2010-02-02 Thread Francisco Javier Santos Alamillos
Dear R community, I'm a beginner with Cluster Analysis. I would like to know if there is a criterion to select the best set of clusters to do this analysis. Thanks in advance, [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread Steve Lianoglou
Hi, On Tue, Feb 2, 2010 at 11:47 AM, anna lippelann...@hotmail.com wrote: This is what I just found now but I guess there is a simpler way: datas[which(names(datas)==A)]-list(rep(NULL,length(which(names(datas)==A but it worked For what it's worth, you could also have done: clean -

Re: [R] Error with toString

2010-02-02 Thread Peter Ehlers
anna wrote: Romain, to keep it simple, I reproduced the example that you can find in the toString function help and I still got the same error: x - c(a, b, aaa) toString(x) Error in toString(x) : could not find function .jcall .jcall() is an rJava function. toString() is a base R

Re: [R] using rbind in a for loop

2010-02-02 Thread jim holtman
This might give you a hint as to how to do it since I have no idea of what your data looks like: lon - lat - matrix(1:100, nrow=5) output - file('/tempxx.txt', open='w') for (i in 1:5){ x - cbind(lon[,i], lat[,i]) write.table(x, row.names=FALSE, col.names=FALSE, file=output) cat('\n',

[R] Doubt about cluster analysis... y más

2010-02-02 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal? No sé si la conoces, pero te invito a participar en la lista oficial de ayuda de R en español: https://stat.ethz.ch/mailman/listinfo/r-help-es A través de ella, además de atender dudas de usuarios, tratamos de crear una comunidad. De hecho, hace no mucho organizamos las

Re: [R] Error with toString

2010-02-02 Thread anna
Here is the list of the loaded packages: package:lattice package:fSeries [5] package:fCalendarpackage:fEcofin package:fUtilities package:MASS [9] package:robustbase package:caTools

Re: [R] Error with toString

2010-02-02 Thread anna
No I just did it on the R console, I built the vector just before. - Anna Lippel -- View this message in context: http://n4.nabble.com/Error-with-toString-tp1290327p1460192.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread Henrique Dallazuanna
Try this: subset(DF, select = setdiff(names(DF), A)) On Tue, Feb 2, 2010 at 2:47 PM, anna lippelann...@hotmail.com wrote: This is what I just found now but I guess there is a simpler way: datas[which(names(datas)==A)]-list(rep(NULL,length(which(names(datas)==A but it worked -

[R] List of object properties

2010-02-02 Thread Philipp Rappold
Dear all, I have a simple question: How can I retrieve a list with all properties of an object? Example: If I fit a regression with model - coxph(Surv()~...) I know that I can access the coefficients with model$coefficients[...] afterwards, but how do I know which other variables are

Re: [R] Deleting many columns of a data frame with the same name ina row

2010-02-02 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Steve Lianoglou Sent: Tuesday, February 02, 2010 9:05 AM To: anna Cc: r-help@r-project.org Subject: Re: [R] Deleting many columns of a data frame with the same name ina row

[R] Error with write.table

2010-02-02 Thread jlwoodard
I was trying to save a data frame to an excel file using the following command: write.table(myData, file=myData.csv,sep=,, row.names=F) The command works for some data frames, but for other data frames, I get the following error: Error in if (inherits(X[[j]], data.frame) ncol(xj) 1L) X[[j]]

[R] Subset and point plot

2010-02-02 Thread Marlin Keith Cox
OK, I need help plotting. I have column headings of Day, Wgt, Foodin, Rep, Grp and Tanks. Rep=c(1,2,3) and Tanks=c(a1,a2,a3,a4,a5,a6, c1,c2,c3,c4,c5,c6, h1,h2,h3,h4,h5,h6). I created a subset where I only would like Rep=2, and Tanks=c(a4,c4,h4) and would like to graph (points) of Wgt and Day.

[R] Retrieve distinct values within a whole data frame

2010-02-02 Thread anna
Hello everyone, I am trying to retrieve the list of distinct values within a whole data frame. I tried to use unique() function but it retrieves the distinct values within each column or row, I want it for the entire data frame, any idea? - Anna Lippel -- View this message in context:

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread anna
thanks this is actually shorter :) - Anna Lippel -- View this message in context: http://n4.nabble.com/Deleting-many-columns-of-a-data-frame-with-the-same-name-in-a-row-tp1460078p1460208.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread anna
yes it looks really simpler, thank you! - Anna Lippel -- View this message in context: http://n4.nabble.com/Deleting-many-columns-of-a-data-frame-with-the-same-name-in-a-row-tp1460078p1460213.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Retrieve distinct values within a whole data frame

2010-02-02 Thread Steve Lianoglou
Hi, On Tue, Feb 2, 2010 at 1:19 PM, anna lippelann...@hotmail.com wrote: Hello everyone, I am trying to retrieve the list of distinct values within a whole data frame. I tried to use unique() function but it retrieves the distinct values within each column or row, I want it for the entire

Re: [R] Error with write.table

2010-02-02 Thread Erik Iverson
How about a MINIMAL example of a data.frame that produces the error message you see? That will help track down what's going on... jlwoodard wrote: I was trying to save a data frame to an excel file using the following command: write.table(myData, file=myData.csv,sep=,, row.names=F) The

Re: [R] Retrieve distinct values within a whole data frame

2010-02-02 Thread anna
ok it worked so the key is unlist() from what I see :working: - Anna Lippel -- View this message in context: http://n4.nabble.com/Retrieve-distinct-values-within-a-whole-data-frame-tp1460205p1460217.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] create an object in a loop (v3)

2010-02-02 Thread Chris Campbell
On Tue, Feb 2, 2010 at 11:44, Ivan Calandra ivan.calan...@uni-hamburg.de wrote: Hi David, Thanks for your answer. But I don't really see how I can extend it with my real data. The thing is that I have more than 3 names and 1 value for each name. Moreover, each is different from one run to

Re: [R] Error with toString

2010-02-02 Thread Peter Ehlers
Anna, Try omitting pkg:RBloomberg. If you really need to use that package, you will have to install the non-CRAN package RDCOMClient from omegahat. I still don't see why toString() wouldn't do its job, even with RBloomberg loaded. -Peter Ehlers anna wrote: Here is the list of the loaded

Re: [R] character variables in substitute()

2010-02-02 Thread Dennis Murphy
Hi: Taking David's and Gabor's contributions, I came up with a function that I hope satisfies David's needs: parText - function(names, pars) { p1 - paste(* '= , pars[-length(pars)], , '*, sep = ) p2 - paste(* '= , pars[length(pars)], ') p - c(p1, p2) txt - paste(names, p,

Re: [R] merging data frames gives all NAs

2010-02-02 Thread James Rome
On 2/1/2010 5:51 PM, David Winsemius wrote: I figured this out finally. I really believe that the R help write-ups are sorely lacking. As soon as I looked at http://www.statmethods.net/management/merging.html, it was obvious: Adding Columns To merge two dataframes (datasets) horizontally,

Re: [R] List of object properties

2010-02-02 Thread David Winsemius
On Feb 2, 2010, at 1:08 PM, Philipp Rappold wrote: Dear all, I have a simple question: How can I retrieve a list with all properties of an object? Example: If I fit a regression with model - coxph(Surv()~...) I know that I can access the coefficients with model $coefficients[...]

Re: [R] Deleting many columns of a data frame with the same name in a row

2010-02-02 Thread David Winsemius
On Feb 2, 2010, at 12:04 PM, Steve Lianoglou wrote: Hi, On Tue, Feb 2, 2010 at 11:47 AM, anna lippelann...@hotmail.com wrote: This is what I just found now but I guess there is a simpler way: datas[which(names(datas)==A)]- list(rep(NULL,length(which(names(datas)==A but it worked

Re: [R] Subset and point plot

2010-02-02 Thread Peter Ehlers
I tried your code and a funny thing happened: I got an error object 'Foodin' not found Hmmm; could you try to post something _reproducible_ (and minimal, please)? But here are some suggestions: 1. investigate '%in%' 2. put a comma after Wgt in your plot call 3. see what you get from

Re: [R] merging data frames gives all NAs

2010-02-02 Thread Erik Iverson
James Rome wrote: On 2/1/2010 5:51 PM, David Winsemius wrote: I figured this out finally. I really believe that the R help write-ups are sorely lacking. The help docs are probably not the best way to learn R, but they are great for users of the functions. I have found that after going

Re: [R] List of object properties

2010-02-02 Thread Peter Ehlers
Philipp, Check ?str which displays the structure of R objects. And do use extractor functions when available: coef(yourModel) instead of yourModel$coef -Peter Ehlers Philipp Rappold wrote: Dear all, I have a simple question: How can I retrieve a list with all properties of an object?

Re: [R] population variance and sample variance

2010-02-02 Thread Ista Zahn
Probably a simple typo, but just to keep things straight: you want to divide by n when describing the standard deviation of a sample, and divide by n-1 when estimating a population standard deviation (your initial description had it backwards I think). On Tue, Feb 2, 2010 at 5:25 PM, Peng Yu

[R] factorial map?

2010-02-02 Thread Sacha Viquerat
hello! i'm dealing with the following: i've collected a factor covariable at irregularly placed sampling points along a line with spatial informations, i.e.: dataset-c(x-coordinates, y-coordinates, level-of-factor) the factor describes the density of vegetation between 0 (no ground cover) and

Re: [R] merging data frames gives all NAs

2010-02-02 Thread James Rome
I agree. I have a foot of books on R now, for example the R Book by Michael Crowly. But so far, Googling the archives of this list has been the most help. Nonetheless, if I cannot understand the documentation of a function, then the documentation needs to be updated. For example, there needs to be

Re: [R] merging data frames gives all NAs

2010-02-02 Thread David Winsemius
Yeah, sometimes the vocabulary we bring to a task does not match up (or merge properly) with the vocabulary that the developers use. In this case the merge operation is one that has a precise meaning in database lingo, which apparently you do not have background in. My experience in

[R] mysterious extra spaces appearing in expression paste

2010-02-02 Thread George Locke
Hi, i'm trying to put a legend on some figures and they're coming out a bit wonky. here's an example: a - c(1:10) par(mfrow=c(2,1)) plot(a,type=s,lwd=3) leg - c(expression(paste(data1 (,rho,=1))), expression(paste(data2 (,rho,=0.0 legend(bottomright,legend=leg,col=c(1,2),lwd=3)

Re: [R] StructTS standard errors

2010-02-02 Thread MY
I just did a search on StructTS on the same topic and ended up here. Did this issue ever get resolved here or elsewhere? Regards, Myron -- View this message in context: http://n4.nabble.com/StructTS-standard-errors-tp966079p1460216.html Sent from the R help mailing list archive at

Re: [R] Import fixed-format ascii file with mixed record types

2010-02-02 Thread trece por ciento
Thanks Jim, As I know nothing about Perl (is it really necessary?), I think that I will try with David's approach. What I want to do is to for a pseudo-panel with my survey data (that is collected periodically), and process it with the survey package. The resulting data set will be big (around

Re: [R] Import fixed-format ascii file with mixed record types

2010-02-02 Thread trece por ciento
Thanks again, David I think that this could work. Final questions: 1. I have read that read.fwt could be slow for big tables (my tables have aprox. 16 records, with 176 characters of recordlenght, almost 28MBytes). Could that be a problem? 2. If using read.fwt is not a problem, wouldn't be

Re: [R] Error with toString

2010-02-02 Thread anna
isn't there a way to specify from which library I am taking the method from...like rjava.toString or base.toString.. - Anna Lippel -- View this message in context: http://n4.nabble.com/Error-with-toString-tp1290327p1460262.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] mysterious extra spaces appearing in expression paste

2010-02-02 Thread anna
try putting sep= in your paste method - Anna Lippel -- View this message in context: http://n4.nabble.com/mysterious-extra-spaces-appearing-in-expression-paste-tp1460261p1460264.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] mysterious extra spaces appearing in expression paste

2010-02-02 Thread David Winsemius
On Feb 2, 2010, at 2:13 PM, George Locke wrote: Hi, i'm trying to put a legend on some figures and they're coming out a bit wonky. here's an example: a - c(1:10) par(mfrow=c(2,1)) plot(a,type=s,lwd=3) leg - c(expression(paste(data1 (,rho,=1))), expression(paste(data2 (,rho,=0.0

  1   2   >