similar to: Meaning of following function

Displaying 20 results from an estimated 9000 matches similar to: "Meaning of following function"

2010 Aug 03
4
Need help on upper.tri()
HI, I am really messing up to make a symmetrical matrix using upper.tri() & lower.tri() function. Here is my code:   > set.seed(1) > mat = matrix(rnorm(25), 5, 5) > mat            [,1]       [,2]       [,3]        [,4]        [,5] [1,] -0.6264538 -0.8204684  1.5117812 -0.04493361  0.91897737 [2,]  0.1836433  0.4874291  0.3898432 -0.01619026  0.78213630 [3,] -0.8356286  0.7383247
2010 Jun 09
1
[R-sig-Geo] How to extract coordinates values from a shapefile?
I'm not sure if this is what you want. But the function coordinates() in sp package gives you the coordinates of SpatialObjects. Regards. Rodrigo. 2010/6/9 Nikhil Kaza <nikhil.list@gmail.com> > You need to execute gpclibPermit() to enable gpclib. > > library(maptools) should have issued a warning to that effect. > > > Nikhil Kaza > Asst. Professor, > City and
2010 Jul 19
2
replacing elements of distance matrix
Hi! I am trying to implement non-bipartite matching. I have around 500 sites which can be clustered by 10 regions. I am able to calculate pairwise Mahalanobis distances between sites (thanks to another post in the forum). However, I want to constrain my match to sites within the same region. Thus I want to replace elements of the distance matrix with a high value, say 999999, for sites not of the
2010 Jun 20
3
Spatial: number of independent components?
Hi all, I am sorry if this is a very basic quesion, but I have no experience with analyzing spatial data and could not find the right function/package quickly. Any hints would be much appreciated. I have a matrix of spatial point patterns like the one below and want to find the number of independent components (if that's the right term) in that matrix (or in that image). x=matrix(c(0,1,0,0,0,
2010 Jul 28
2
Beginner stucked with raster + geoR package.
Hello everyone. I am trying to build up understanding in R by trying to develop just some simple scenarios. I would like to explain you what I am trying to do and what I did so far. I would like to put inside a RasterLayer (raster package) a Gaussian field (for given covariance) using grf function (geoR package) 1. First I created a Raster Layer object r <- raster() # Default values are
2010 Jul 13
1
Batch file export
Dear all, I have a code that generates data vectors within R. For example assume: z <- rlnorm(1000, meanlog = 0, sdlog = 1) Every time a vector has been generated I would like to export it into a csv file. So my idea is something as follows: for (i in 1:100) { z <- rlnorm(1000, meanlog = 0, sdlog = 1) write.csv(z, "c:/z_i.csv") Where "z_i.csv" is a filename that is
2010 Oct 20
1
help identifying clusters
Dear list: I have a dataset of geographical data that looks like this example data: dat<- data.frame( lon = c(rnorm(1000, mean=-10), rnorm(1000, mean=10), rnorm(1000, mean=5)), lat = c(rnorm(1000, mean=40), rnorm(1000, mean=30), rnorm(1000, mean=0))) plot(dat$lon, dat$lat) My positions are clearly clustered (in this example there are 3 clusters). Is there any R algorithm that allows me to
2010 May 17
4
Adding a row at top of dataframe
I have a large data frame 48:2185 with different numbers. I would like to add only one row at the very top of my data frame with 0's or NA's. I don't know which approach to use. Should i create 2 different data frames and merge them? Ive also tried the rbind command with no luck. I would appreciate some help to achieve what I'm trying to create. Thanks!
2010 Jul 25
1
Left Outer Join 2 DF's on Multiple Conditions
Hi, I am trying to execute the following SQL statement using two data frames: tab1, tab2 : Two Tables Select tab1.*, tab2.*, tab1.tobiiTime - tab2.ruiTime as timeDiff, IFNULL(n-m, -9999999) as alwaysIncrement FROM tab1 LEFT OUTER JOIN tab2 On tab1.data1 - tab2.mouseX = 0 And tab1.data2 - tab2.mouseY = 0 I am trying to do the following in R:- *#Getting error here:* data
2010 Jul 22
1
Updating a Data Frame
Hi, I have a global data-frame in my R script. At some point in my script, I want to update certain columns of this data-frame by calling in an update function. The function looks like this: # get events data. This populates a global event data frame in the R-script events <- getEvents(con, eventsFilePath) # events has columns eventid, timeStamp, isSynchronized, timeDiff; with millions of
2010 Aug 09
2
efficient matrix element comparison
It is a simple problem in that I simply want to convert the For loop to a more efficient method. It simply loops through a large vector checking if the numeric element is not equal to the index of that element. The following example demonstrates a simplified example: > rows <- 10 > collusionM <- Matrix(0,10,10,sparse=TRUE) > matchM <- matrix(c(1,2,3,4,4,6,7,9,9,10)) > >
2010 Jul 07
1
Batch files process and String parsing
Here are what i am going to accomplish: I have 400 files named as xxx.txt. the content of the file looks like the following: name count 1. aaa 100 2. bbb 2000 3. ccc 300 4. ddd 3000 ........ more that 1000 rows in each files. these are the areas i need help: 1. how can i only read in the files with the string patterns ggg or fff as part of the file names? for instance, I
2010 Jun 18
2
Find the 50 highest values in a matrix
Hi, I have a huge matrix (4000 * 2000 data points) and I would like to retrieve the coordinates (column and row) for the top 50 (or x) values. Some positions in the matrix have NA as a value. These should be discarded. My current method is to replace all NAs by 0, then rank all the values and then extract the positions with the 50 highest ranks. It is very time-consuming! Is there a simpler
2010 Jul 13
2
Substring function?
Hi all, I would like to detect all strings in the vector 'content' that contain the strings from the vector 'search'. Here a code example: content <- data.frame(urls=c( "http://www.google.com/search?source=ig&hl=en&rlz=&=&q=stuff&aq=f&aqi=g10&aql=&oq=&gs_rfai=CrrIS3",
2010 Aug 17
1
replace loops with matrix
Hey, R users I am using?numerical method for my research paper and the computation burden is very heavy. first I tried to do it with loops, example code as following, and it take hours to converge for only 200 obs. and my real data has 4000 obs. and the optimization command that I use is: optim(guess,myfunc1,data=mydata, method="BFGS",hessian=T)) then I tried matrix
2009 Nov 06
2
another question: how to delete one of columes in two ones with high correlation(0.95)
my programe is below: a=c(1,2,1,1,1); b=c(1,2,3,4,1); c=c(3,4,3,3,3); d=c(1,2,3,5,1); e=c(1,5,3,5,1) data.f=data.frame(a,b,c,d,e) origin.data<-data.f cor.matrix<-cor(origin.data) origin.cor<-cor.matrix m<-0 for(i in 1:(cor.matrix[1]-1)) { for(j in (i+1):(cor.matrix[2])) { if (cor.matrix[i,j]>=0.95) { data.f<-data.f[,-i]; i<-i+1 }
2010 Aug 03
2
Collinearity in Moderated Multiple Regression
Dear all, I have one dependent variable y and two independent variables x1 and x2 which I would like to use to explain y. x1 and x2 are design factors in an experiment and are not correlated with each other. For example assume that: x1 <- rbind(1,1,1,2,2,2,3,3,3) x2 <- rbind(1,2,3,1,2,3,1,2,3) cor(x1,x2) The problem is that I do not only want to analyze the effect of x1 and x2 on y but
2007 Apr 18
5
Problem with ?curve
Dear all R gurus, I have following syntax: y = c(1:10) chippy <- function(x) { y[5] = x sin(cos(t(y)%*%y)*exp(-t(y)%*%y/2)) } curve(chippy, 1, 20, n=200) But I am getting error while executing : Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ In addition: Warning message: number of items to
2008 Sep 11
4
All possible pairs of two variables
I have two variables (x,y) : x : it takes all integer values from 0 to y and, y : takes all values from 0, 10 I am looking for some R code to find all possible pairs of (x,y). Can anyone please help me? New Email addresses available on Yahoo! Get the Email name you&#39;ve always wanted on the new @ymail and @rocketmail. Hurry before someone else does! [[alternative HTML version
2010 May 20
5
sort a data.frame
Hello,   I have a dataframe: dd <- data.frame(b = c("chr2", "chr1", "chr15", "chr13"),         x = c("A", "D", "A", "C"), y = c(8, 3, 9, 9),         z = c(1, 1, 1, 2))   >dd       b x y z 1  chr2 A 8 1 2  chr1 D 3 1 3 chr15 A 9 1 4 chr13 C 9 2 Now I want to sort them according column "b", but only its