Look at clustering task view
http://cran.r-project.org/web/views/Cluster.html
A simple way to do it is
library(cluster)
dat$cluster <- pam(dat, 3, stand=T)$clustering
plot(dat$lon, dat$lat, col=dat$cluster)
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carol
apply(m, 1, function(x){print(as.polynomial(x))}) # Not sure why you
are using 2 i.e. applying the formula column wise instead of 1, row
wise.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Oct 4, 2010, at 9:10 PM, Raznahan, Arm
example(factor)
iris1$Species <- factor(iris1$Species, drop=T)
will get you what you need.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Sep 21, 2010, at 7:41 AM, pdb wrote:
I'm confused, hope someone can point out
Convert to strings and use grep functions.
using c for variable is a bad idea.
a <- paste(a, collapse="")
b <- paste(b, collapse="")
d <- paste(d, collapse="")
grepl(b,a)
grepl(d,a)
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of No
DF3 <- merge(DF1, DF2, by=c("Sample_id", "RepairHours), all.y=T)
DF3$subtract <- DF3$Day_0_Read1-DF3$ ZeroMean
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Sep 14, 2010, at 8:38 AM, rasanpreet wrote:
hi
Comments below
On Sep 7, 2010, at 9:37 PM, stephen sefick wrote:
Here is a striped down example that is not working because of the 1.00
to 1. Any help would be greatly appreciated.
measure_bkf <- (structure(list(measurment_num = c(0, 0.2, 0.4, 0.6,
0.8, 1, 1.2,
1.4, 1.6, 1.8, 2, 2.2, 2.2, 2.4
or use
#not checked
rm(setdiff(ls(),c("a", "b"))
On Aug 24, 2010, at 4:55 AM, Barry Rowlingson wrote:
2010/8/24 500600 :
a <- 1
b <- 2
c <- 3
ls()[-a] # set minus to all the objects you want to retain
rm(list = ls()[-a] # will remove all the objects - except a
ls() # presto
Only beca
http://www.econ.uiuc.edu/~roger/research/R1/R1.html
On Mon, Aug 23, 2010 at 2:15 PM, Steven Ranney wrote:
> All -
>
> Does anyone know if there is a method to calculate a goodness-of-fit
> statistic for quantile regressions with package quantreg?
> Specifically, I'm wondering if anyone has imple
In additiion to Ivan's comment, in this case, you are just plotting
Yes or No. I think thats not what you want.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 19, 2010, at 3:42 AM, Ivan Calandra wrote:
Hi,
I ha
what is nt? is that a typo for ns?
I don't see why you need to calculate lia within the loop.
Also
library(fBasics)
ccl <-rowprod(lia)
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 17, 2010, at 6:22 PM, Hey S
?all
nikhil.l...@gmail.com
On Aug 13, 2010, at 2:49 PM, Downey, Patrick wrote:
c(1,2,3) == c(1,2,3)
__
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
?as.numeric
On Aug 13, 2010, at 7:50 AM, Amit Patel wrote:
For the query below I have also included the follwing information.
Thanks for
your replies
str(FeaturePresenceMatrix)
chr [1:65530, 1:40] "0" "0" "0" "0" "1" "0" "0" "0" "0" ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:65530]
see whether assets swap2 and vol are
> cointegrated..
>
> Do you reckon you point me in the right direction as to how to do that?
>
> Thank you!
> Thiago
>
> -Original Message-
> From: Nikhil Kaza [mailto:nikhil.l...@gmail.com]
> Sent: 11 August 2010 12:35
> To: F
default device.
One way to overcome it is to plot them to a pdf and name them
appropriately for each iteration.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 11, 2010, at 6:34 AM, Ferreira, Thiago Alves wrote:
Hi everyo
How about
a <- which(row(matchM)!=matchM)
b <- matchM[a]
diag(collusionM[a,b]) <-1
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 8, 2010, at 8:43 PM, david h shanabrook wrote:
It is a simple problem in that I simpl
Another way is
t1<- c("3:00","1:59","3:00","2:00")
t2 <- strptime(t1, format="%H:%M")
t2[-4]>t2[-1]
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 4, 2010, at 8:47
you will have a better luck with R-sig-geo.
Unfortunately I could not find an easy way for polygon overlays.
plot(Tazshape)
lines(ugbshape) if ugbshape was a polyline instead of a polygon.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l
try using Matrix package instead
mat <- Matrix(rnorm(25),5,5)
forceSymmetric(mat)
The reason your method does not work is because matrix is effectively
a vector and the indices increase along rows within a column.
Nikhil
On Aug 3, 2010, at 7:36 AM, Ron Michael wrote:
HI, I am really messi
My usual strategy of dealing with multicollinearity is to drop the
offending variable or transform one them. I would also check vif
functions in car and Design.
I think you are looking for lm.ridge in MASS package.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North
Are x1 and x2 are factors (dummy variables)? cor does not make sense
in this case.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 3, 2010, at 9:10 AM, Michael Haenlein wrote:
Dear all,
I have one dependent variable y and
> a <- c( 20071031,20071130, 20071231)
b<- sort(as.Date(as.character(a), format="%Y%M%d"))
On Aug 2, 2010, at 8:03 PM, Leigh E. Lommen wrote:
I am unsure how to sort a column by date if it is currently in the
form:
MMDD
For example the months:
20071031
20071130
20071231
Etc.
Re
use 24 length vectors as parameters instead of numbers e.g. mu=rep(0.5,24)
On Mon, Aug 2, 2010 at 11:00 AM, Shentu, Yue wrote:
> Hi all,
> I'm trying to define and log-likelihood function to work with MLE.
> There will be parameters like mu_i, sigma_i, tau_i, ro_i, for i between
> 1 to 24. I
Try r-sig-geo
Look at spdep, geoR, splancs and sp packages for spatial autocorrelation.
Also look at
http://cran.r-project.org/web/views/Spatial.html
On Mon, Aug 2, 2010 at 3:40 AM, nuncio m wrote:
> Hi list,
> I am trying to fit arima model for a grid of 360x161x338 points,
> where
well
"*"(3,2) works but "*"(3,2,3) does not. You should now be able to
figure out the logic. It is related to the number of arguments that
make sense.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug
?replicate
?apply
?sapply
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 1, 2010, at 2:42 AM, leepama wrote:
hi!! imade many codes during these days..
I study Statistics
please one more question!!
ex1<-function(n,p,
Look at sqldf package, it is easier to do sql like statements with it.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jul 25, 2010, at 6:10 PM, harsh yadav wrote:
Hi,
I am trying to execute the following SQL statement using two
mp",
"isSynchronized","timediff)] <- cbind(dataF[,"tobiitime"],
rep(1,nrow(dataF), (dataF[i,"ruiTime"]-dataF[,"tobiitime"]))
}
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jul
My mistake, instead of colnames(d1)
use substr(colnames(d1),1,1) or similar
On Jul 19, 2010, at 2:15 PM, Nikhil Kaza wrote:
Michael,
You can modify the following code to suit. Also avoid using dist as
a variable name since it is a function in base. However, are you
sure you want to do
;- n.L[[i]]}
m2 <- function(i,j){mahalanobis(j, i, var(j))}
m3 <- function(k){apply(as.matrix(k),1,m2,as.matrix(k))}
d2 <- lapply(x.L, m3)
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jul 19, 2010, at 11:37 AM, Michael Ralph M. Ab
replace dist with mahalanobis distance in the following example.
a <- cbind(runif(10), sample(1:3, 10, replace=T))
a.L <- split(a,a[,2])
dist.L <- lapply(a.L, dist)
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jul
gsub(".", " ", "abc.degg.hijk", fixed=T)
On Jul 19, 2010, at 7:37 AM, Tolga I Uzuner wrote:
Actually, I think I got it, need to use gsub.
From: Tolga I Uzuner
Sent: 19 July 2010 12:11
To: 'r-help@r-project.org'
Subject: Help with replacing a substring in a string
Dear R Users,
I am trying to
Unless I am missing something this should do it
a<- cbind(runif(10),runif(10))
b <- cbind(a[,1]+a[,2], a[,1]/a[,2])
On Jul 16, 2010, at 7:00 AM, Ravi Ramaswamy wrote:
Hi -
I am trying to map a two dimensional area A to another two
dimensional area
B using a function. For instance A =
Building on Erik's solution and because it would easier to do date
arithmetic..
d1 <- as.character(date)
d1 <- ifelse(nchar(d1)<4, paste(0,d1,sep=""),d1)
d2 <- as.Date(date, "%m%d")
On Jul 15, 2010, at 1:21 PM, btc1 wrote:
Hello, I have a vector, "dates", as a series of 3 digit elements,
write.csv(z, paste("c:/z_",i,".csv"sep=''))
You will have to modify this to prepend 0s.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jul 13, 2010, at 10:03 AM, Michael Haenlein wrote:
Dear all,
well %in% is really checking if the element is in the set and is not a
substring operator.
To get the result you want, try
content[grepl(search$signatures, content$urls),]
For multiple operations you could try
sapply(search$signatures, grepl, x=content$urls)
Nikhil Kaza
Asst. Professor
?list.files
In particular look at pattern argument.
?file.rename
?lapply
?read.table
?"["
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jul 7, 2010, at 1:11 PM, jd6688 wrote:
Here are what i am going to accomplis
explicit call to print usually works for me.
library(audio)
for (i in 1:5){
wait(60)
print(Sys.time())
}
On Jul 1, 2010, at 4:30 PM, Matt Shotwell wrote:
> Try to flush output after printing:
>
> cat(paste(Sys.time()),"\n"); flush(stdout())
>
> On Thu, 2010-07-01 at 16:1
You can do this in reshape package as mentioned earlier.
However, if you need a solution with aggregate here it is
a <- with(data, aggregate(cbind(v1,v2), by=list(x,y,z),sum))
names (a) <- c("x","y","z","v1","v2")
Nikhil Kaza
Asst. P
require(reshape)
cast(data, first+second~ ., sum)
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jun 29, 2010, at 3:05 PM, Yi wrote:
first=c('u','b','e','k','j','c',
aggregate(data$third, by=list(data$first), sum)
or
reqiure(reshape)
cast(melt(data), ~first, sum)
On Jun 28, 2010, at 9:30 PM, Yi wrote:
first=c('u','b','e','k','j','c','u','f','c','e')
second
=
c
('usa
','Brazil
','England','Korea','Japan','China','usa','France','China','England')
third=1
.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jun 26, 2010, at 4:27 PM, Derek Ogle wrote:
I am trying to use optim() to minimize a sum-of-squared deviations
function based upon four parameters. The basic function is defined
as
-11 coda_0.13-5
[5] deldir_0.0-12 maptools_0.7-34
[7] foreign_0.8-40 nlme_3.1-96
[9] MASS_7.3-6 Matrix_0.999375-39
[11] lattice_0.18-8 boot_1.2-42
[13] sp_0.9-64
loaded via a namespace (and not attached):
[1] grid_2.11.1 tools_2.11.1
Nikhil Kaza
Asst. Professor,
C
I have spdep 4.58. Perhaps it is deprecated in the new version. Try looking
for sparse matrix representation in the help files for spdep
Nikhil
On Mon, Jun 21, 2010 at 6:10 AM, Daniel Malter wrote:
>
> as.spam.listw is an unknown function. Is it in a different package?
>
> Daniel
>
> other att
Instead of nb2mat try
as.spam.listw(nb2listw(cell2nb(...)))
this will coerce the adjacency matrix into a sparse matrix representation
saving lot of memory.
Nikhil
On Sun, Jun 20, 2010 at 10:27 PM, Daniel Malter wrote:
>
> Hi, thanks much. This works in principle. The corrected code is below:
lot(g)
clusters(g)
Nikhil
---
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jun 20, 2010, at 7:17 PM, Daniel Malter wrote:
Hi all, I am sorry if this is a very basic quesion, but I have no
experience
with analyzing spatial data an
Matrix is just a vector. So order should work
haven't verified the following code.
a <- matrix(rnorm(4000*2000), 4000, 2000)
b <- order(a, na.last=TRUE, decreasing=TRUE)[1:50]
use %% or %/% to get the row# and column #s
Nikhil Kaza
Asst. Professor,
City and Regional Planning
Un
On Jun 16, 2010, at 9:23 AM, Stefan Petersson wrote:
Just double all the backslashes and you are fine.
In order to see the outcome, use cat() (not print).
Uwe Ligges
On 16.06.2010 09:49, Stefan Petersson wrote:
Hi,
I'm trying to build a vector of latex commands. However, I need
the comm
function
> coordinates() in sp package gives you the coordinates of
> SpatialObjects.
>
> Regards.
>
> Rodrigo.
>
> 2010/6/9 Nikhil Kaza
> You need to execute gpclibPermit() to enable gpclib.
>
> library(maptools) should have issued a warning to that effect.
>
&
which(abs(v - .1) <= .Machine$double.eps)
seems to me too cumbersome to write. Any other easier way? all.equal
does not quite work
Nikhil
On Jun 9, 2010, at 7:54 AM, Petr PIKAL wrote:
Hi
r-help-boun...@r-project.org napsal dne 09.06.2010 13:16:40:
Dear R community,
I am puzzled by the f
Minor correction below. Use 0 instead of space if you are using %H
On Thu, Jun 3, 2010 at 8:55 PM, nikhil kaza wrote:
> ?ifelse
>
> > t2 <- ifelse(nchar(times)<4, paste("0", times, sep=""), times)
>
> > strptime(t2, "%H%M")
>
> Ni
?ifelse
> t2 <- ifelse(nchar(times)<4, paste(" ", times, sep=""), times)
> strptime(t2, "%H%M")
Nikhil
On Thu, Jun 3, 2010 at 5:21 PM, Peter Moore wrote:
> Hi,
> I'm newish to R, a recent convert from Matlab... So far I'm impressed, and
> determined to solve the following problem, which seems
Reduce might work. Not sure about the speed advantages though. It does
simplify code.
Unionall <- function(x) Reduce('union', x)
leaveout <- Unionall(leaves)
On Tue, Jun 1, 2010 at 9:53 PM, Remko Duursma wrote:
> Dear R-helpers,
>
> thanks for yesterday's speeding-up tip. Here is my next query
?difftime
?file.info
file.info(filename)$mtime
Sys.sleep(20)
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Jun 1, 2010, at 10:07 AM, zhangted001 wrote:
Hello, I have a question about how R can run automatically. Here is
?round
On May 24, 2010, at 9:26 PM, Mohan L wrote:
Dear All,
I have a data frame "data" and the below is the str of "data" :
$ Feb : int 1 1195 0 11 28 152 24 2 1 1470 ...
$ Mar : int 0 1212 0 17 27 184 15 1 1 1311 ...
$ Apr : int 2 1244 1 15 23 135 11 0 1 991 ...
$ May : int 2
Try this.
dd[order(gsub("chr","",dd$b)),]
You need regular expressions if chr is not the only characterstring
that is prepended to the numbers.
look for
?strsplit
Nikhil Kaza
University of North Carolina
nikhil.l...@gmail.com
On May 20, 2010, at 8:28 AM, Yuan Jia
My mistake.
cars2 should be initalized to have all the extra rows.
cars2 <- data.frame(matrix(rep(NA, prod(dim(cars)) + ncol(cars)),
nrow(cars)+1))
cars2[2:nrow(cars2),] <- cars
In this way, insertion at any row is possible.
Nikhil
On May 17, 2010, at 2:46 PM, Peter Ehlers wrote:
data(
Works with warnings for me. but your method is better.
Nikhil
On May 17, 2010, at 1:35 PM, Peter Ehlers wrote:
data(cars)
cars2 <- cars
cars2[2:nrow(cars)+1,] <- cars2[1:nrow(cars),]
cars2[1,] <- NA
__
R-help@r-project.org mailing list
https://sta
Does this work?
data(cars)
cars2 <- cars
cars2[2:nrow(cars)+1,] <- cars2[1:nrow(cars),]
cars2[1,] <- NA
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On May 17, 2010, at 11:28 AM, ecvet...@uwaterloo.ca wrote:
I hav
paths.
I am not sure about cycles. But I suppose you can just use the minimum
spanning tree and iteratively add the remaining edges to get the cycles.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On May 4, 2010, at 7:34 AM, jcano
Thats right. serves me for not checking the code before posting.
but paste should work in anycase with collapse or when x is a single
parameter.
Nikhil
On Sun, May 2, 2010 at 10:24 AM, David Winsemius wrote:
>
> On May 2, 2010, at 10:10 AM, Nikhil Kaza wrote:
>
> say x is
say x is the variable.
plot(..., title=paste(x, "whatever else"), ...) should work as well.
same should work with file names as well.
Nikhil
On May 1, 2010, at 9:56 PM, R K wrote:
Hello,
I was wondering if someone could tell me how I can make text
dependent on a variable in a R functio
rix(c(2,5,6), 3,1)-matrix(c(5,4,2), 3,1))
> }
> constrOptim((matrix(c(0,0,0,0,0,0,0,0,0),3,3)), fr)
> or
> nlm(fr, matrix(c(0,0,0,0,0,0,0,0,0),3,3))
> --
> the function also returned non-comformable error.
> Kind regards
> Jacob
>
>
>
> 2010/4/29 Nikhil
fr does not return a scalar.
Nikhil
On Apr 28, 2010, at 3:35 AM, Człowiek Kuba wrote:
Hello,
I have the following problem:
I have a set of n matrix equations in the form of :
[b1] = [A] * [b0]
[b2] = [A] * [b1]
etc.
vertical vectors [b0], [b1], ... are GIVEN. We try to estimate
matrix A.
?cat
On Apr 28, 2010, at 11:21 PM, Ian Seow wrote:
Hi, how do I convert a character vector into a string?
c("a","b","c") into "a b c"
Thanks!
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.c
try this
?which.max
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Apr 27, 2010, at 11:42 PM, vikrant wrote:
Hi All,
Suppose I have 2 time series
a = 1:20
b = 5:15
and I am finding the cross correlation between these two
If I understand it correctly
par(mfrow=c(2,2))
plot(x,y)
plot(y,z)
.
should work.
On Apr 24, 2010, at 8:11 AM, Jim Lemon wrote:
On 04/24/2010 02:52 AM, tamas barjak wrote:
Hi All!
I have 2 plain questions:
1.)
I know that very primitive question, but that to grant it, that the
drawi
a <- c(1, 8, 9, 10, 8)
a[which(a==8)] <- NA
Nikhil
On Apr 6, 2010, at 7:31 AM, David Foreman wrote:
Dear All,
I seem entirely unable to solve what should be a very simple
problem. I
have imported a SPSS dataset into R using spss.get from Frank
Harrell's
Hmisc library. The variables ar
I cannot replicate the error.
The following seem to work.
Y <- runif(100)
comp <- matrix(runif(6500),100,65)
par <- rep(.5, 28)
optim.results <- optim(par, fn=objective.function, method="Nelder-
Mead",comp=comp, Y=Y, n=100) # Not sure why you are selecting the
columns in the comp. That is pro
missed a c(...) here,
therefore no par defined.
On Mar 23, 2010, at 12:58 PM, ApproxGaussian wrote:
par<-(e.1,e.2,e.3,e.4,e.5,e.6,e.7,e.8,e.9,e.10,e.11,e.12,e.13,e.14,e.
15,e.16,e.17,e.18,e.19,e.20,e.21,e.22,e.23,e.24,e.25,e.26,e.27,e.28)
__
R-help
rm(setdiff(ls(), c("AA", "BB")) should work.
On Mar 20, 2010, at 12:27 PM, bogaso.christofer wrote:
Dear all, in my working project, I have created huge number of
different
kind of objects including "AA" and "BB". Now I want to delete all
objects
except that "AA" and "BB". Is there any proc
try this
t <- TazProperties..
v <- aggregate(t$Area, by=list(t$TAZ,t$Props), sum)
names(v) <- c("TAZ", "Prop", "area")
tapply(v$area, v$Prop, function(x) v$TAZ[which.max(x)])
note that you have to deal with the cases where there is a tie for the
maximum. The above just returns the first maximu
I don't think R will complain, if you use the approach below. However,
IF, VVS1 and VVS2 are linearly dependent.
Better use the factor approach and define which factor should be the
contrast
Nikhil
On 16 Dec 2009, at 10:12AM, Petr PIKAL wrote:
what commands did you use for regression
I su
I am not sure why you are reading and writing from disk so many times?
It will degrade performance.
Also avoid loops when you can.
just use
ONS$labels <- paste(ONS$Var1[i], ONS$Var2[i], ONS$Var3[i], ONS
$Var4[i], ONS$Var5[i], ONS$Var6[i], ONS$Var7[i], ONS$Var8[i],ONS
$Var9[i], ONS$Var10[i]
?merge
use all=L
On 10 Dec 2009, at 6:06AM, Venkatesh.P wrote:
Dear all,
I am facing problem with inserting the scheduled day of Observation
in the dataset. In the dataset I have only relative time (table 1)
and not
scheduled day of observation (day 1, 4, 8, 15, 22, 29, 36, 43).
I would
This is great!! Sqldf is exactly the kind of thing I was looking for,
other stuff.
I suppose you can speed up both functions 1 and 5 using aggregate and
tapply only once, as was suggested earlier. But it comes at the
expense of readability.
Nikhil
On 9 Dec 2009, at 7:59AM, Titus von de
How about creating an index using multiple columns.
a <- with(d, aggregate(dur, list(rt=rt,tid=tid,mood=mood,roi=roi),
sum))
b <- with(d, aggregate(x, list(rt=rt,tid=tid,mood=mood,roi=roi),
mean))
c <- merge(a, b, by=c("rt","tid","mood", "roi"))
I suppose one could save some time by not r
From an old post by Gabor
http://tolstoy.newcastle.edu.au/R/help/04/01/0147.html
apply
(outer
(landmark_c,t(store_c),"-"),c(1,4),function(x)sqrt(sum(diag(x*x
On 7 Dec 2009, at 10:58PM, dolar wrote:
Hi there
I have two tables, with longitudinal and latitudinal coordinates.
what I
?unlist
if I understand you correctly.
On 24 Nov 2009, at 5:50PM, Peng Yu wrote:
I have the following list. The second item in the list is a number.
I'm wondering how to write R code to return this information for any
list?
$`1`
integer(0)
$`2`
[1] 123
$`3`
integer(0)
$`4`
integer(0)
$`5
I 've used tiddlywiki a personal notebook for other things but not for
R. It may be useful to write a css that separates out code from
description.
http://www.tiddlywiki.com/
On 22 Nov 2009, at 11:53AM, Tal Galili wrote:
Hello all,
When using R for some time, one comes across more and mor
I think the issue is in the function fr,
?apply
apply returns a vector or array or list of values
So if the inner apply returns a list (this happens when different
number of elements in y are positive in different rows) then outer
apply cannot coerce it into the correct format to apply the pr
This is not an answer to your question, but I have used SparseM
package to represent large travel time matrices efficiently.
?as.matrix.ssr
if the traveltime matrix is symmetric.
On 9 Nov 2009, at 5:24PM, Hongwei Dong wrote:
Hi, R users,
I'm trying to transform a matrix A into B (see belo
How about
vec[1:min(which(vec==FALSE))-1]
This will return a character(0) vector if vec[1] is FALSE
Nikhil
On 9 Nov 2009, at 2:38PM, David Winsemius wrote:
vec= TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE TRUE TRUE FALSE
__
R-help@r-project.
try
sort (table(MAT), decreasing=T)
if MAT is your matrix
I think this is what you want. though if you want to sort by the first
occurrence then it is a different story.
Nikhil
On 2 Nov 2009, at 1:35PM, Val wrote:
V1 v2 v3 v4
569 10
347 10
46 10 18
Have you tried
readShapePoints
writePointsShape
both in maptools.
Also, I don't think you really need a proj4string specified unless
you are actually doing some spatial operations such as buffers and
distances.
I take it that you have already considered and discarded the
possibility of
I am having trouble with the recode function that is provided in the
CAR package. I trying to create a new factors based on existing factors.
E.g.
>x <- as.factor(1:20)
>y <- recode(x, " 1:5='A'; 6:10='B'; 11:15='C'; 16:20='D' ")
>y
[1] A A A A A 6 7 8 9 A A A A A A A A A A A
Levels: 6 7 8 9
85 matches
Mail list logo