Re: [R] Representing 'Date' as 'Year - Quarter'
The zoo package has a yearqtr class that can represent quarterly data. It is also possible to create zoo series of quarterly data. Such series can be converted to ts class and that class can some builtin support for quarterly data as well. library(zoo) as.yearqtr(200706, %Y%m) [1] 2007 Q2 The read.zoo function has an aggregate= argument that can aggregate values at duplicate times into a single value as they are read in; however, it assumes one record per time point and it appears your data is the transpose so you may wish to read it in using read.table and then transpose it manually or creating separate series and then using merge.zoo to bind them into one multivariate series. See the corresponding help pages and the three vignettes. On Sat, May 31, 2008 at 4:39 AM, Vishal Belsare [EMAIL PROTECTED] wrote: I have financial data on a a set of firms, with a quarterly period (fundamental data). The data spans 10 years, and four quarters per year. The present file (.csv) reads the Date columns as 200706 for the second quarter of 2007; 199809 for the third quarter of 1997. Is there a way I can convert it to something like 2007 Q2, 1998 Q3? I am aware of the yearqtr feature of the zoo package and ts also has some facility to represent frequency. However, the problem is that, my data isn't exactly a time series right now. In each quarterly file, the date column has the same value f.e 200706, however each row contains fundamental data of a different firm. Ultimately, I intend to aggregate the 40 or so files into one data frame. So is it possible to read off the 199806 as a 'date' variable, with a quarterly frequency? The reason why I am keen on this is that I can then shape my further sub-setting in a form like which(... date == 1998 Q2) or so instead of forcing myself to write 1998/06/30 which would indicate end of second quarter (I just think that is redundant). Thanks in anticipation. We don't have a sample of your data to know for sure so lets just assume that column 1 is the year/quarter and the rest of the line is the data one quarter after another. We read it in and convert column 1 to yearqtr class. Then we lapply over the rows converting each one to a zooreg series and clean up its names. Then we merge them all into a single zoo series and optionally convert that to ts: # untested DF - read.table(myfile) DF$V1 - as.yearqtr(DF$V1, %Y%m) zl - lapply(1:nrow(DF), function(i) zooreg(unlist(DF[i, 2:ncol(DF)]), start = DF[i, 1], freq = 4)) names(z) - row.names(DF) z - do.call(merge, zl) # optional as.ts(z) See the corresponding help entries in the zoo package and the three vignettes accompanying the package. __ 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.
[R] Regression Model with a Memory Covariate Process
Dear all: I am searching for a regression model (e.g. y=Xb+e) in which dummy-coded events (to time point t) on different regressors in X exhibit an effect on subsequent responses in the vector y (to time-points t+1, t+2,… t+n). My aim is to estimate how long the memory effect is and how strong a certain event influences subsequent responses (whether the memory decays e.g. linear or exponentially). My first impression is that state-space models are appropriate. However, according to my first understanding in these models regularities in the residuals are explained without using the knowledge of the event history. Or is a simple linear regression model with time-shifted regressors appropriate? The response vector y includes misses and the events in X are sampled on irregular time points. Many thanks Stefan -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten __ 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.
[R] How to adaptively sample a simulated population of individuals
Hello, I am looking for advice on how to adaptively sample from a simulated population. I have simulated a population of individuals in a matrix and need to do the following: 1) select a random sample from that population 2) apply a function to that sample to determine if I detect any individuals at each of the referenced site locations [i,j] in the matrix 3) then if I detect any individuals after that first function (adaptive condition y[i,j] 0) I need to sample the 4 adjacent plots in that matrix [i,j+1]; [i,j-1]; [i+1,j]; [i-1,j] 4) apply that function to those adjacent plots to see if I detect any individuals 5) continue in that fashion to eventually develop a network I have already simulated the population with spatial dependence (used a gamma-poisson mixture), so that in each [i,j] site there is a number of individuals such that the the adjacent sites (contained in a 4x3 sub-matrix) are distributed via the same lambda from a poisson distribution, but each 4x3 sub-matrix has a unique lambda describing the distribution. I have then been able to sample from that population using the sampling package and have been able to apply the function to determine if I detect any individuals. The real problem is how to adapt the sampling protocol to the adjacent plots in the matrix given I have initially detected an individual. I am not sure what the best approach is to do this. I have thought that because I have the population simulated in a matrix I already have spatially referenced information about the population through the [i,j] locations in the matrix, but am not sure if this is enough spatially referenced information and if it is how do I apply the function to the adjacent sites. An alternative would be to assign spatial coordinates to the sites so that they are referenced or put it into a data.frame that would keep the locations and the numbers of individuals at each of those locations. I am not sure if this is possible ( I am guessing it is) and if so how to do it. Any advice on how to do this or where to start would be greatly appreciated. Thank you very much, Krishna Krishna Pacifici Ph.D. Student Georgia Cooperative Fish and Wildlife Unit Warnell School of Forestry and Natural Resources University of Georgia Athens, GA 30602 (706) 248-9968 __ 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.
[R] problems with package.skeleton
Hi the list, I do not manage to build a package using package.skeleton. My pacakge in called 'partition' I run package.skeleton, then I write the Rd file. R CMD check partition is ok But R CMD build --binary partition does not compile. I get : WARNING * some HTML links may not be found installing R.css in c:/TEMP/Rinst322403595 cp: cannot stat 'c:/TEMPS/Rbuild322403595/partition/chm/partition.chm': no such file or directory make[1]: *** [chm-partition] Error 1 make: *** [pkg-partition] Error 2 *** installation of partition failed *** Removing 'c:/TEMP/Rinst322403595/partition' ERROR * installation failed Any idee of what is going wrong ? Thanks Christophe __ 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] problems with package.skeleton
[EMAIL PROTECTED] wrote: Hi the list, I do not manage to build a package using package.skeleton. My pacakge in called 'partition' I run package.skeleton, then I write the Rd file. R CMD check partition is ok But R CMD build --binary partition does not compile. I get : WARNING * some HTML links may not be found installing R.css in c:/TEMP/Rinst322403595 cp: cannot stat 'c:/TEMPS/Rbuild322403595/partition/chm/partition.chm': This tells us that probably the Mircosoft Compiled HTML compiler is not installed properly - it's the one that makes these chm files... Best wishes, Uwe Ligges no such file or directory make[1]: *** [chm-partition] Error 1 make: *** [pkg-partition] Error 2 *** installation of partition failed *** Removing 'c:/TEMP/Rinst322403595/partition' ERROR * installation failed Any idee of what is going wrong ? Thanks Christophe __ 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. __ 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.
[R] Advice for working with Sammon's Projection on image data
Hello all, I'm working on a project that uses a SOM to generate feature maps from image data. Each image is a 100x75 pixels and RGBA, so 30,000 elements per image. I wanted to observe the structure of the pixel by pixel euclidean distance (where each image is a point in 30,000 dimensional space) of my image data. Sammon's projection seems appropriate for this, though I'm a bit concerned 400 images with 30,000 dimensions make be too large for the algo. I'm planning on only publishing B+W images, so it is possible I could throw away the colour channels to make each image 7500 dimensions. Also I'm not sure how to structure my data to make using it with Sammon's projection easiest. A 30,000 dimensional matrix for each image occurs to me first, but I'm not sure what the best data format is for that. I'm using two data types currently, the raw file has 30,000 variables and one observation per image. This is converted to a data frame where each pixel is a observation and there are variables for its position per image, and which image in which it is contained which is used for ggplot2 tile plotting. What I am attempting to do is compare the topology of my test data in order to compare it to the topology of the SOM weights trained on that data. The projections should be similar is topology is being preserved correct? Any advice appreciated. Thanks, B. Bogart __ 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] R and Openmpi
Paul, On 30 May 2008 at 15:47, Paul Hewson wrote: | Hello, | | We have R working with Rmpi/openmpi, but I'm a little worried. Specifically, (a) the -np flag doesn't seem to override the hostfile (it works fine with fortran hello world) and (b) I appear to have twice as many processes running as I think I should. | | Rmpi version 0.5.5 | Openmpi version 1.1 That's old. Open MPI 1.2.* fixed and changed a lot of things. I am happy with 1.2.6, the default on Debian. | Viglen HPC with (effectively) 9 blades and 8 nodes on each blade. | myhosts file contains details of the 9 blades, but specifies that there are 4 slots on each blade (to make sure I leave room for other users). | | When running mpirun -bynode -np 2 -hostfile myhosts R --slave --vanilla task_pull.R | | 1. I get as many R slaves as there slots defined in my myhosts file (there are 36 slots defined, and I get 36 slaves, regardless of the setting of -np, the master goes on the first machine in the myhosts file. | 2. The .Rout file confirms that I have 1 comm with 1 master and 36 slaves | 3. When I top each blade it indicates that there are in fact 8 processes running on each blade and | 4. When I pstree each blade it indicates that there are two orted processes, each with 4 subprocesses. You never showed us task_pull.R ... And as I readily acknowledge that this can be tricky, why don't you experiment with simple setting?. Consider this token littler [1] invocation (or use Rscript if you prefer / have only that): [EMAIL PROTECTED]:~ r -e'library(Rmpi); cat(Hello rank, mpi.comm.rank(0), size, mpi.comm.size(0), on, mpi.get.processor.name(), \n)' Hello rank 0 size 1 on ron [EMAIL PROTECTED]:~ So without an outer mpirun (or orterun as the Open MPI group now calls it) we get one instance. Makes sense. Now with two hosts defined on the fly, and two instances each: [EMAIL PROTECTED]:~ orterun -n 4 -H ron,joe r -e'library(Rmpi); cat(Hello rank, mpi.comm.rank(0), size, mpi.comm.size(0), on, mpi.get.processor.name(), \n)' Hello rank 0 size 4 on ron Hello rank 2 size 4 on ron Hello rank 3 size 4 on joe Hello rank 1 size 4 on joe [EMAIL PROTECTED]:~ Adding '-bynode' and using '-np 4' instead of '-n 4' does not change anything. | From the point of view of getting a job done this ***seems*** OK (it's running very quickly), but it doesn't seem quite right - given I'm sharing the machine with other users and so on. Is there something I've missed in the useage of mpirun with R/Rmpi. I cannot quite determine from what you said here what your objective is. What exactly are you trying to do that you are not getting done? Using fewer instances? Maybe that is in fact an Open MPI 1.2.* versus 1.1.* issue. One thing to note is that if you wrap all this in the excellent snow packache by Tierney et al, then Open MPI's '-n' can always be one as determine from _within_ how many nodes you want: [EMAIL PROTECTED]:~ orterun -bynode -np 1 -H ron,joe r -e'library(snow); cl - makeCluster(4, MPI); res - clusterCall(cl, function() Sys.info()[nodename]); print(do.call(rbind, res))' Loading required package: utils Loading required package: Rmpi 4 slaves are spawned successfully. 0 failed. nodename [1,] joe [2,] ron [3,] joe [4,] ron [EMAIL PROTECTED]:~ Note the outer '-n 1' and the inner makeCluster(4, MPI) to give you 4 slaves. If you use a larger '-n $N' you will get $N instances each starting as many nodes as makeCluster asks for. Hope this helps, Dirk [1] Littler can be had via Debian / Ubuntu or from http://dirk.eddelbuettel.com/code/littler.html -- Three out of two people have difficulties with fractions. __ 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.
[R] How to add space between main title to leave space for legend?
Hello, everybody: I recently encountered an example with in which the graph was placed in a way that did not leave room for a legend. Maybe you would describe it as legend too big, I'm not sure. I found myself wishing I could force in some space after the title. Here's working example where I'd like to make room for a legend. x - rnorm(100) hist(x, freq=F, main=Different Meanings of Normality) lines(density(x)) xseq1 - seq( min(x), max(x), length.out=100) m1 - mean(x) sd1 - sd(x) obsNormal - dnorm(xseq1, mean=m1, sd=sd1) lines( xseq1, obsNormal, lty=2, col=red) truNormal - dnorm(xseq1) lines(xseq1, truNormal, lty=3, col=green) legend(0,0.4, legend=c(observed density, normal with observed mean sd, normal with 'true' mean and sd), lty=c(1,2,3), col=c(black, red, green)) I tried fiddling around with par to change the margins, but it has the bad effect of resizing the image and creating a blank space into which I'm not allowed to write the legend. Know what I mean? I try par( mar=c(1,1,3,1)) or par(mai=c(1,1,4,1)) before the hist and it makes space, but useless space. I've been considering something desperate, such as layout(). Isn't there a simpler way? -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas __ 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] How to add space between main title to leave space for legend?
Paul Johnson wrote: Hello, everybody: I recently encountered an example with in which the graph was placed in a way that did not leave room for a legend. Maybe you would describe it as legend too big, I'm not sure. I found myself wishing I could force in some space after the title. Here's working example where I'd like to make room for a legend. x - rnorm(100) hist(x, freq=F, main=Different Meanings of Normality) lines(density(x)) xseq1 - seq( min(x), max(x), length.out=100) m1 - mean(x) sd1 - sd(x) obsNormal - dnorm(xseq1, mean=m1, sd=sd1) lines( xseq1, obsNormal, lty=2, col=red) truNormal - dnorm(xseq1) lines(xseq1, truNormal, lty=3, col=green) legend(0,0.4, legend=c(observed density, normal with observed mean sd, normal with 'true' mean and sd), lty=c(1,2,3), col=c(black, red, green)) I tried fiddling around with par to change the margins, but it has the bad effect of resizing the image and creating a blank space into which I'm not allowed to write the legend. Know what I mean? I try par( mar=c(1,1,3,1)) or par(mai=c(1,1,4,1)) before the hist and it makes space, but useless space. I've been considering something desperate, such as layout(). Isn't there a simpler way? (1) par(xpd=TRUE) allows you to write outside the plotting region (2) xlim and ylim can squeeze the plot in suitable directions Combined with what you are alread aware of, I think these should do the trick. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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.
[R] How to identify overlapped items from two list and plot them?
Hi list, I have a question on how to identify the overlapped items from two vectors: x-c(0,1,2) y-c(1,2,2,3) and plot the number of the overlapped as well as non-overlapped in a diagram? Thanks much, Allen [[alternative HTML version deleted]] __ 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] How to add space between main title to leave space for legend?
Is this ok? set.seed(1) # ... your code ... legend(topright, title = Legend, legend=c(observed density, normal with \nobserved mean\n sd, normal with \n'true' mean sd), lty = 1:3, col = 1:3, box.lty = 0, text.width = 1.1, cex = 0.7) On Sat, May 31, 2008 at 3:06 PM, Paul Johnson [EMAIL PROTECTED] wrote: Hello, everybody: I recently encountered an example with in which the graph was placed in a way that did not leave room for a legend. Maybe you would describe it as legend too big, I'm not sure. I found myself wishing I could force in some space after the title. Here's working example where I'd like to make room for a legend. x - rnorm(100) hist(x, freq=F, main=Different Meanings of Normality) lines(density(x)) xseq1 - seq( min(x), max(x), length.out=100) m1 - mean(x) sd1 - sd(x) obsNormal - dnorm(xseq1, mean=m1, sd=sd1) lines( xseq1, obsNormal, lty=2, col=red) truNormal - dnorm(xseq1) lines(xseq1, truNormal, lty=3, col=green) legend(0,0.4, legend=c(observed density, normal with observed mean sd, normal with 'true' mean and sd), lty=c(1,2,3), col=c(black, red, green)) I tried fiddling around with par to change the margins, but it has the bad effect of resizing the image and creating a blank space into which I'm not allowed to write the legend. Know what I mean? I try par( mar=c(1,1,3,1)) or par(mai=c(1,1,4,1)) before the hist and it makes space, but useless space. I've been considering something desperate, such as layout(). Isn't there a simpler way? -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas __ 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. __ 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.
[R] Loading data into a list of environments
Dear All, Thanks to an answer which I received from a previous post, I'm now able to create a series of environments using the following: nmes - c(en1, en2, en3) for(i in nmes) assign(i, new.env(parent = .GlobalEnv)) My next question is how, using load, can I automatically place data into each of these newly created environments. The following, and variations thereof, does not work: nmes - c(en1, en2, en3) for(i in nmes) load(file = /home/testData/Data.RData, i) I've tried, among other attempts, to use as.environment(i) without success. My i is seen as a character, but I want it to be seen as the environment which it represents. Kind regards, J.Powell LEI Visserij Alexanderveld 5 2585 DB Den Haag The Netherlands __ 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.
[R] KPSS test - Lag selection
Hello everyone! Quite a similar question has been posed here some time ago, but there was no explicit solution offered. So I hope that it is OK to pose it again. I want to perform a KPSS test using the packages urca or tseries. But I neither want to use the predefined lag structures, short and long, nor specify the number of lags arbitrarily by myself. Unfortunately there is, or I have not found it yet, no possibility of an automatic lag selection. Using EViews there is such an option. Well, my questions are the following ones. Is there such an option in some package, which I have been too blind to find? Or otherwise; is there an easy kind of work-around to select the bandwith in advance and use it in the above mentioned packages? Thanks for your attention and help! Florian -- View this message in context: http://www.nabble.com/KPSS-test---Lag-selection-tp17575064p17575064.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is variable in one vector part of variable in another
darthgervais wrote: I have 2 vectors x z x has 10 variables in it z has 75 variable in it I need to check all 75 variables in z and see if they are present in the vector x. So far this is what I have: for (i in 0:75){ if (z[i]==x) (w=w+1) } Thanks in advance w Try: any(!(z%in%x) # if TRUE then extract with z[!(z%in%x)] - Blay S KATH Kumasi, Ghana. -- View this message in context: http://www.nabble.com/Is-variable-in-one-vector-part-of-variable-in-another-tp17574954p17575410.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Is variable in one vector part of variable in another
I have 2 vectors x z x has 10 variables in it z has 75 variable in it I need to check all 75 variables in z and see if they are present in the vector x. So far this is what I have: for (i in 0:75){ if (z[i]==x) (w=w+1) } Thanks in advance w -- View this message in context: http://www.nabble.com/Is-variable-in-one-vector-part-of-variable-in-another-tp17574954p17574954.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] figuring out the results from hclust
I have two examples that I run hclust on: a = c(0,1,1.5,1.5) b = c(1,0,1.5,1.5) c = c(1.5,1.5,0,0.5) d = c(1.5,1.5,0.5,0) ll = as.matrix(rbind(a,b,c,d)) test = as.dist(ll) long = hclust(test) a = c(0,0.3,1,1) b = c(0.3,0,1,1) c = c(1,1,0,0.5) d = c(1,1,0.5,0) ll = as.matrix(rbind(a,b,c,d)) test = as.dist(ll) short = hclust(test) The main difference between them is whether a and b gets clustered higher up or lower down than the b,c cluster. I am working on partitioning this kind of data into three clusters. I know I can do that with cutree. The result I get from that is the following: cutree(short, k=3) a b c d 1 1 2 3 cutree(long, k=3) a b c d 1 2 3 3 And I can also access the height matrix for both: short$height [1] 0.3 0.5 1.0 long$height [1] 0.5 1.0 1.5 So I know at what heights they get merged. What I seem to be unable to get at is which one of the clusters as shown by cutree correspond to what split. When I examine short in a plot I can easily see that the highest split (i.e corresponding to the last height, 1, in the height matrix) is between the cutree clusters 1 and 2,3. In the long example this split is between 1,2 and 3. I would however like to not examine all of the data I have by hand:) Could any of you point me to what I need to do to get at this data? I have tried to examine the merge data in both cases, but I am coming up short. Thanks! Karin -- Karin Lagesen, PhD student [EMAIL PROTECTED] http://folk.uio.no/karinlag __ 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] How to identify overlapped items from two list and plot them?
Hello, On May 31, 2008, at 4:10 PM, ss wrote: Hi list, I have a question on how to identify the overlapped items from two vectors: x-c(0,1,2) y-c(1,2,2,3) You can use the %in% operator to return a logical vector that indicates the overlap. x-c(0,1,2) y-c(1,2,2,3) y %in% x [1] TRUE TRUE TRUE FALSE and plot the number of the overlapped as well as non-overlapped in a diagram? I am not sure what you mean by plotting the number of overlaps. Do you mean show the overlaps with a special symbol? Or do you want to just show the number? If it is the former, perhaps the following would do? plot(x,rep(1,length(x)), xlim = c(0,5)) points(y, rep(1,length(y)), pch = +) iy = which(y %in% x) points(y[iy], rep(1,length(iy)), pch = +, col = red) Cheers, Ben Ben Thanks much, Allen [[alternative HTML version deleted]] __ 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. Ben Tupper [EMAIL PROTECTED] I GoodSearch for Ashwood Waldorf School. Raise money for your favorite charity or school just by searching the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo! __ 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] Is variable in one vector part of variable in another
I have 2 vectors x z x has 10 variables in it z has 75 variable in it I need to check all 75 variables in z and see if they are present in the vector x. In addition to the solution using %in% which has already been suggested, you may also want to play with something like this: # make up some data x = sample(1:8, 10, rep=T) z = sample(1:25, 75, rep=T) # find intersection between x and z intersect(x,z) cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan 85350 Freising, Germany and Institut für Bioinformatik und Systembiologie / MIPS Helmholtz Zentrum München - Deutsches Forschungszentrum für Gesundheit und Umwelt Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel __ 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] Loading data into a list of environments
On Sat, 31 May 2008, Powell, Jeff wrote: Dear All, Thanks to an answer which I received from a previous post, I'm now able to create a series of environments using the following: nmes - c(en1, en2, en3) for(i in nmes) assign(i, new.env(parent = .GlobalEnv)) My next question is how, using load, can I automatically place data into each of these newly created environments. The following, and variations thereof, does not work: nmes - c(en1, en2, en3) for(i in nmes) load(file = /home/testData/Data.RData, i) I've tried, among other attempts, to use as.environment(i) without success. My i is seen as a character, but I want it to be seen as the environment which it represents. More generally as the object it represents... Try for(i in nmes) load(file = /home/testData/Data.RData, get( i )) See ?get HTH, Chuck Kind regards, J.Powell LEI Visserij Alexanderveld 5 2585 DB Den Haag The Netherlands __ 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. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ 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] How to identify overlapped items from two list and plot them?
I have a question on how to identify the overlapped items from two vectors: x-c(0,1,2) y-c(1,2,2,3) intersect(x,y) and plot the number of the overlapped as well as non-overlapped in a diagram? Are you talking about a Venn diagram? There is a vennDiagram function in the limma package and possibly in others. You will find some hints here: http://research.stowers-institute.org/efg/R/Math/VennDiagram.htm cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan 85350 Freising, Germany and Institut für Bioinformatik und Systembiologie / MIPS Helmholtz Zentrum München - Deutsches Forschungszentrum für Gesundheit und Umwelt Ingolstädter Landstrasse 1 85764 Neuherberg, Germany http://mips.gsf.de/staff/pagel __ 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.
[R] tolstoi.newcastle dead?
Anyone know what's up w/ tolstoi.newcast.edu.au (home of the threaded R-help archives)? I've got a can't connect for several days now. Carl __ 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.
[R] package.skeleton again
Hi the list I do not manage to build a package using package.skeleton. My pacakge in called 'partition' I have no probleme to source the file. Then I run package.skeleton(partition) I get : Saving function and data... Error in file(file,ifelse(append,a,w)): impossible to open the connexion In addition, I get more than 50 warnings : In dump(internalsObjs,file=file.path(code-dir,sprintf(%s-internal.R,...: deparse of an S4 object will not be source()able Any idee of what is going wrong ? Thanks Christophe __ 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.
[R] function
hi i have to make my function y=b*(1-exp(lambda*(t^m)) and my data are in excel file with names: Year /b/lambda/m and t is an age in another file calls pcb could u help me please to calculate all y for all years please i can make this step by step but i want an program for having all y and plot them in the same windows with legend could u help me please thank u [[alternative HTML version deleted]] __ 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.
[R] Cannot handle object of mode list
Hello..!!! I got a problem while built R program with tcltk. I try to list the name of all data frame in my memory by tklistbox. when we choose the name of data frame, then i capture the name, and catch the data frame by tclObj(dat)-as.data.frame(get(x,envir=.GlobalEnvir)) tclvalue(dat) where x is the name of the data frame.The error is Cannot handle object of mode list. Note, that i have assign variable dat by dat-tclVar(). so that it can be accesed by another function in my program. I have tried things like this, and it can work well. But why this time cannot work well? Please tell me what happen and how to fix it. Thank You - Kunjungi halaman depan Yahoo! Indonesia yang baru! [[alternative HTML version deleted]] __ 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.
[R] optim error
I saw a similar question but I still don't fully understand how to implement optim. Can someone help me out with this? Thanks. Keun-Hyung vol-rep(c(0.03, 0.5, 2, 4, 8, 16, 32), 3) time-rep(c(2,4,8),each=7) p.mated-c(0.47, 0.48, 0.43, 0.43, 0.26, 0.23, null, 0.68, 0.62, 0.64, 0.58, 0.53, 0.47, + 0.24, 0.8, 0.79, 0.71, 0.56, 0.74, 0.8, 0.47) eury-as.data.frame(cbind(vol, time, p.mated)) eury-eury[-7,]; eury vol time p.mated 1 0.0320.47 2 0.520.48 3 220.43 4 420.43 5 820.26 61620.23 8 0.0340.68 9 0.540.62 10240.64 11440.58 12840.53 13 1640.47 14 3240.24 15 0.038 0.8 16 0.580.79 17280.71 18480.56 19880.74 20 168 0.8 21 3280.47 p0- c(f=0.87, b=0.1, c=150) eury.fit - function (f, time, vol) + { + f-p[1]; b-p[2]; c-p[3] + p.mated = p[1] * ( (1 - exp(-p[2]*time))-(p[2]/(p[2]-(p[3]/vol))) +* (exp(-p[3]/vol*time)-exp(-p[2]*time))) + } eury.opt- optim(p0, fn=eury.fit, NULL, method = BFGS, hessian = TRUE) Error in fn(par, ...) : argument time is missing, with no default [[alternative HTML version deleted]] __ 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.