Re: [R] change file name from file0.1_data.RData to file1_data.Rdata

2012-07-20 Thread Yasir Kaheil
use function system in R for (x in 1:100){ system (paste(rename file0.,x,_data.RData file,x,_data.Rdata,sep=)) } - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/change-file-name-from-file0-1-data-RData-to-file1-data-Rdata-tp4637135p4637136.html Sent from the R

Re: [R] Entering Data Files

2012-07-18 Thread Yasir Kaheil
type ?read.table in R - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/Entering-Data-Files-tp4636943p4636959.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https

Re: [R] PCA

2012-07-18 Thread Yasir Kaheil
in biplot you could set the limits xlim, ylim of the axes to zoom in on the plot. - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/PCA-tp4636840p4636961.html Sent from the R help mailing list archive at Nabble.com

Re: [R] Merging Data Frames in R

2012-07-18 Thread Yasir Kaheil
type ?merge in R - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/Merging-Data-Frames-in-R-tp4636781p4636962.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https

Re: [R] read.table with numeric row names

2012-07-12 Thread Yasir Kaheil
just do this: colnames(r)-substr(colnames(r),2,nchar(colnames(r))) This will remove the X. Later when you want to use the headed to plot something, cast it as numeric: plot(colMeans(r)~as.numeric(colnames(r))) - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com

Re: [R] Subset based on multiple values

2012-07-11 Thread Yasir Kaheil
yes just use %in% instead of == AllMax.. but also use table for count - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/Subset-based-on-multiple-values-tp4636159p4636183.html Sent from the R help mailing list archive at Nabble.com

[R] Spectral analysis with mtm-svd Multi-Taper Method Combined with Singular Value Decomposition

2009-01-26 Thread Yasir Kaheil
Hi list, Does anyone know if there is a library in R that does MTM-SVD method for spectral analysis? Thanks - Yasir H. Kaheil Columbia University -- View this message in context:

[R] create sequences from two from and to vectors

2009-01-09 Thread Yasir Kaheil
hi all, how can I create sequences that start from a known vector, say x1 and end with another say x2- also suppose all the sequences will be the same length. I don't want to use a for loop x1-c(1,2,3,4); x2-(3,4,5,6); what I want is 1 2 3 4 2 3 4 5 3 4 5 6 Thanks - Yasir H. Kaheil

Re: [R] create sequences from two from and to vectors

2009-01-09 Thread Yasir Kaheil
Great! thank you so much! Dimitris Rizopoulos-4 wrote: one way is using mapply(), e.g., mapply(:, 1:4, 3:6) I hope it helps. Best, Dimitris Yasir Kaheil wrote: hi all, how can I create sequences that start from a known vector, say x1 and end with another say x2- also

[R] generating a random signal with a known correlation

2008-08-11 Thread Yasir Kaheil
Hi, How can I generate a random signal that's correlated with a given signal at a given correlation (say 0.7)? I've been looking at rmvnorm etc but don't seem to figure it out. Thanks - Yasir H. Kaheil Columbia University -- View this message in context:

Re: [R] generating a random signal with a known correlation

2008-08-11 Thread Yasir Kaheil
(yp[,1],index.return=TRUE)$ix yp-yp[ypix,]; yps-yp[,1];# dummy initialization yps[xix]-yp[,2]; #adjust mean and sd here. yqs-qnorm(yps,mean=mean(x),sd=sd(x)); cor(x,yqs) Yasir Kaheil wrote: Hi, How can I generate a random signal that's correlated with a given signal at a given correlation

Re: [R] Is there way to multiple plots on gap.plot?

2008-07-28 Thread Yasir Kaheil
yeah, just use points twogrp-c(rnorm(5)+4,rnorm(5)+20,rnorm(5)+5,rnorm(5)+22) gpcol-c(2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5) gap.plot(twogrp,gap=c(8,12),xlab=Index,ylab=Group values, main=Plot gap on Y axis,col=gpcol) twogrp2-c(rnorm(5)+4,rnorm(5)+20,rnorm(5)+5,rnorm(5)+22) points(twogrp2,

Re: [R] Fill in NA values in vector with previous character/factor

2008-07-28 Thread Yasir Kaheil
maybe this is easiest way to do it: x-c(A,B,NA,NA,C,NA,NA,NA,NA,D,NA,NA); x[is.na(x)]- D; x thanks y Owen Jones-3 wrote: I have a vector of data (species names) interspersed with NA values and I want a function to fill in the blanks, replacing NA values with whatever the last

Re: [R] Insurance review statistical methods

2008-07-15 Thread Yasir Kaheil
yes R has everything that TRICAST offers.. and much more Kenneth Cabrera-2 wrote: Hi R users: I will like to know if somebody works on insurance statistics (actuarial problems) and had use TRICAST, and can tell me if with all the R tools it can be build a solution like TRICAST or

Re: [R] outlining symbol in legend with blackline

2008-07-09 Thread Yasir Kaheil
yes use plotting chars 22, 21 replace your legend statement with: legend(x=topright, legend=c(2006 mean, 2007 mean, 2008 mean, 1964-2005 mean \n max and min flows ), pch=c(22, 22, 22, 21), col=c(1,1,1,1), pt.bg=c(grey.colors(3, gamma=4),black), cex=1.5) box(which=plot, lty=solid) thnaks y

Re: [R] netCDF to TIFF

2008-07-09 Thread Yasir Kaheil
the function is there in grDevices http://stat.ethz.ch/R-manual/R-patched/library/grDevices/html/png.html type ? png if tiff() is not listed, you need to update R to get the new base with new grDevices. thanks y Daniel Steinberg wrote: Greetings R users! I am working with the ENSEMBLE

Re: [R] array of arrays

2008-06-04 Thread Yasir Kaheil
Is it possible to have one array for bias and one for variance? such as.. biasAr= b1 b2 a1 biasbias a2 biasbias and varAr= b1 b2 a1 var var a2 var var then you can combine the two in a data frame? thanks y Michael Prince wrote: Dear R users, I

Re: [R] SVD on a matix

2008-05-25 Thread Yasir Kaheil
the variance is the eigen values of the correlation matrix of yoru matrix X.cor - cor(X) X.e - eigen(X.cor) X.e$values# Eigenvalues of cor(X) = variances you're asking about kayj wrote: Hi All, I performed an svd on a matrix X and saved the first three column of the left singular

Re: [R] R-Excel Macro Problem

2008-05-25 Thread Yasir Kaheil
hi Nate, could you please email me your excel workbook. thanks y nmarti wrote: I'm trying to write R functions into VBA code. I've done this many other times in other documents and everything has run great. But today I keep recieving an error message Run-time error '1004':

Re: [R] R-Excel Macro Problem

2008-05-25 Thread Yasir Kaheil
glad to hear things worked out. y nmarti wrote: Ok, so I'm embarrassed to admit I made a really dumb mistake. My VBA page was declared as Sheet1 code when it should have been Module1 code. I knew it was something stupid. Sorry for the inconvenience. Yasir Kaheil wrote: hi Nate

Re: [R] Question about Runuran (Triangular Distribution)

2008-05-23 Thread Yasir Kaheil
Please refer to: qtriangle function in VGAM library thanks y Alberto Monteiro wrote: The Runuran package includes a simulation for the Triangular Distribution, urtriang. But I didn't find an analogue of the q* functions (rnorm - qnorm, runif - qunif), that would invert the CDF

Re: [R] question for Logic Regression

2008-05-19 Thread Yasir Kaheil
= 2, ntrees=2, nleaves=3, anneal.control=Annealing) new-data.frame(Z) new-NULL alltrees - predict(logicfit, new) names(logicfit) doesn't have coef class. thanks Yasir Kaheil wrote: try alltrees - predict(fit

Re: [R] question for Logic Regression

2008-05-18 Thread Yasir Kaheil
try alltrees - predict(fit, model.dat2) # make sure response variable is not included in model.dat2 also to see the other attributes in fit, try: attributes(fit) thanks y coldeyes.Rhelp wrote: Hi All: how to get the coefficient for logic regression using selection=2 ( fit multiple

Re: [R] How to extract estimates, Std. Error, t Value and Pr(|t|) from summary

2008-05-16 Thread Yasir Kaheil
dat-array(runif(30),c(15,2)); dat-data.frame(x=dat[,1],y=dat[,2]); linm-lm(y~x,data=dat); linm.s-summary(linm); attributes(linm.s) #to see all attributes of the summary $names [1] call terms residuals coefficients [5] aliased sigma df

Re: [R] re ading and analyzing a text file

2008-05-16 Thread Yasir Kaheil
use the parameter 'skip' in read.table dat-read.table(filename,skip=number of rows you want to skip) thanks y DAVID ARTETA GARCIA wrote: Dear list, I have a text file from a scanner that includes 20 lines of text (scanner settings) before it actually starts showing the readings in a

Re: [R] Lattice box percentile plot

2008-05-16 Thread Yasir Kaheil
it's a good question.. my guess is using panel.bpplot prevents filling in the shape the coffins- since the box is now two mirrored graphs. i hope i'm wrong. trellis.par.get() br = trellis.par.get(box.rectangle) br$col = black br$fill = lightblue #this is the parameter that fills in the box,

Re: [R] merging data frames

2008-05-16 Thread Yasir Kaheil
DF1- data.frame(Name=as.factor(c(A,B,C)), Age= c(21,45,30)) DF2- data.frame(Name=as.factor(c(A,B,X)), Age= c(50,20,10)) DF3- data.frame(Name=as.factor(c(B,Y,K)), Age= c(40,21,30)) merge(merge(DF1,DF2, by.x= Name, by.y=Name, all=TRUE),DF3,by.x=Name,by.y=Name, all=TRUE); Name Age.x Age.y

Re: [R] plot 2 bars

2008-05-13 Thread Yasir Kaheil
try: obs_data- c(26,43,20,14,18); pre_gam-c(26.284,61.101,29.016,11.160,11.439) (obs.hist - hist(obs_data, breaks = 10, plot = FALSE)); plot(obs.hist) plot(obs.hist, border = dark blue, col = light blue, xlab =whatever) (pre.hist - hist(pre_gam, breaks = 10, plot = FALSE)); lines(pre.hist, col =

Re: [R] Creating data.frames dynamically

2008-05-11 Thread Yasir Kaheil
Hi Worik: Is this what you want? Names - letters[1:5]; Dates- 1:20; d- data.frame(dates=Dates, a = vector(mode=numeric, length=length(Dates))); for(i in 2:5){d[,paste(sep=,Names[i])]-with(d,a)}; d dates a b c d e 1 1 0 0 0 0 0 2 2 0 0 0 0 0 3 3 0 0 0 0 0 4 4 0 0 0 0

Re: [R] applying cor.test to a (m, n) matrix

2008-05-09 Thread Yasir Kaheil
interesting request..I'm looking forward to the replies All I could come up with is putting it in two lines.. pr-array(0,c(dim(x)[2],dim(x)[2])); for (i in 1:dim(x)[2]) for (j in 1:dim(x)[2]) pr[i,j]-cor.test(x[,i],x[,j])$p.val; y Monica Pisica wrote: Hi everybody, I would like to

Re: [R] question about subseting a dataframe

2008-05-09 Thread Yasir Kaheil
you need to redefine the factor on ex1$id.. cast it again as.factor to redefine the levels. Dipankar Basu wrote: Hi! I am using R version 2.7.0 and am working on a panel dataset read into R as a dataframe; I call it ex. The variables in ex are: id year x id: a character string

Re: [R] miniscule font size on R console output

2008-05-08 Thread Yasir Kaheil
from the upper menu, go to edit/gui preferences then you can increase the font size. i used windows so im not sure if this works on mac. thanks juanita choo wrote: Hi, I am having a situation where I cannot change the output size of the R console. I have played around with the font

Re: [R] help with regsubsets

2008-05-08 Thread Yasir Kaheil
is it possible that regsubsets divides the subset dataset into training and testing set.. so when it calculates R^2 it's not the same as what you'd get with lm. You probably need to look into the source code to know if this is true or not Edwards, David J wrote: Hi, I'm new to R and

Re: [R] pivoting - summing up factors

2008-05-07 Thread Yasir Kaheil
assuming what you have is a dataframe called x try: table(Plant=x$plant,Location=x$location) Location Plant x y z a 1 1 2 b 2 2 0 or simply: table(x$plant,x$location) x y z a 1 1 2 b 2 2 0 thanks juanita choo wrote: Hi I would like to know how to pivot a table

Re: [R] Is there in R a function equivalent to the mround, as found in most spreadsheets?

2008-05-06 Thread Yasir Kaheil
Hi Ottorino, You could just use the modulus operator %% as follows: x-c(1803.02, 193.51, 3.47); x-x%%c(50,5,1) #just using the modulus operator [1] 1800 1903 thanks Dr. Ottorino-Luca Pantani wrote: Dear R-users, I have the following problem In a lab experiment I have to mix three

Re: [R] General Plotting Question

2008-05-06 Thread Yasir Kaheil
cast the two vectors as.matrix-- see here: plot(as.matrix(f[2,4:26]), as.matrix(f[1,4:26])) y stephen sefick wrote: f - (structure(list(X = structure(96:97, .Label = c(119DAmm, 119DN, 119DNN, 119DO, 119DOC, 119Flow, 119Nit, 119ON, 119OPhos, 119OrgP, 119Phos, 119TKN, 119TOC, 148DAmm,

Re: [R] Plotting separate populations in scatterplot3d

2008-05-06 Thread Yasir Kaheil
#Install library rgl #here is the function which you need to run first: rgl.plot3d-function(z, x, y, cols=red,axes=T,new=T) {xr-range(x) x01-(x-xr[1])/(xr[2]-xr[1]) yr-range(y) y01-(y-yr[1])/(yr[2]-yr[1]) zr-range(z) z01-(z-zr[1])/(zr[2]-zr[1]) if(new) rgl.clear() if(axes)

Re: [R] General Plotting Question

2008-05-06 Thread Yasir Kaheil
I missing something easy, do I not understand the logic/philosophy, or...? thanks Stephen On Tue, May 6, 2008 at 12:53 PM, Yasir Kaheil [EMAIL PROTECTED] wrote: cast the two vectors as.matrix-- see here: plot(as.matrix(f[2,4:26]), as.matrix(f[1,4:26])) y stephen sefick wrote

Re: [R] Spatial join between two datasets using x and y co-ordinates

2008-05-06 Thread Yasir Kaheil
vector dat1.select is the selected records from dat1 by dat2. dat1.select- dat1$x1 %in% dat2$x2 dat1$y1 %in% dat2$y2 dat1[dat1.select,] x1 y1 descript 1 1824615 5980732 cat 2 1823650 5983220 dog Andrew McFadden wrote: Hi R users I am trying to create a spatial

Re: [R] bwplot

2008-05-05 Thread Yasir Kaheil
Hi Cedric, to change the names of different boxes, you could use levels on the dataframe factor variable you're plotting- see this example: library('lattice'); bwplot(voice.part ~ height, data=singer, xlab=Height (inches)) singer.m-singer levels(singer.m$voice.part)- c(a,f,g,j,k,o,y,t)

Re: [R] axis and tick widths decoupled (especially in rugs!)

2008-05-05 Thread Yasir Kaheil
Hi This is an ad-hoc fix.. d-rnorm(4) plot(1:4,d) g-3; rug((1:4),ticksize=-.03,lwd=g,side=1) rug((1:4),ticksize=0,lwd=(g-1),side=1,col=white) just drawing another white axis on top of the old one.. it looks ok :) y maiya wrote: Hi! (a complete newby, but will not give up easily!)

Re: [R] barplot with log base 2 scale or shift the x-axis

2008-05-03 Thread Yasir Kaheil
user parameter offset barplot(d,offset = -2) #assuming that d is your data Summer Nitely wrote: Hi, I have data that is on a log base 2 scale. It goes from negative factors of 2 to positive ones. I am using barplot. However, I don't want the data centered at 0 - I want the min of the

Re: [R] re moving rows from matrix

2008-05-02 Thread Yasir Kaheil
you could do it using apply like the first two replies mentioned or you could just use the index way for example: (assuming your matrix name is ym and the values are greater than 25 and less than 50 and the column is column 3).. if you mean any column use the first two replies.

Re: [R] Excluding/removing row and column names on text output files

2008-05-02 Thread Yasir Kaheil
try: write.table(x, file=/Users/Desktop/Data.txt, row.names= FALSE, col.names= FALSE, sep=, append=TRUE) this should do it. If you don't want to append, just turn that opion off. Stropharia wrote: Dear R users, I've had no joy finding a solution to this online or in any of my R books.

Re: [R] interactive rotatable 3d scatterplot

2008-05-02 Thread Yasir Kaheil
#Install library rgl #here is the is the function: rgl.plot3d-function(z, x, y, cols=red,axes=T,new=T) {xr-range(x) x01-(x-xr[1])/(xr[2]-xr[1]) yr-range(y) y01-(y-yr[1])/(yr[2]-yr[1]) zr-range(z) z01-(z-zr[1])/(zr[2]-zr[1]) if(new) rgl.clear() if(axes) {xlab-pretty(x)

Re: [R] predict.glm newdata

2008-04-30 Thread Yasir Kaheil
You could just say: yhat=predict(reg1,x2) the function predict will assing x2 to 'newdata' by default. thanks Daniel Malter wrote: Hi, could it be the newdata argument? When I run predict with the newdata argument, I get an error message - a different one though. The second reason