Hi everyone,
I am trying to calculate the number of days between any two dates in a year
regardless of the year. Specifically, image two dates:
MonDay1 <- "01-30" #January 30
MonDay2 <- "12-31" #December 31
I want the difference of those two dates to be
MonDay1- MonDay2=30 days #
Hi everyone,
I have a data.table with 200 columns and few million rows and am trying to
calculate the .1 and .9 quantiles for each row across all 200 columns.
I have found different ways to do this, all with different performances. The
examples I used are below. I wonder whether there is a fast
In total I found 8 different way to calculate quantile in very a large
data.table. I share below their performances for future reference. Tests 1, 7
and 8 were the fastest I found.
Best,
Camilo
library(data.table)
v <- data.table(x=runif(1),x2 = runif(1),
x3=runif(1),x4=runif(100
Hi everyone,
I wonder if there is a code in r that can generate a 3d convex hull from a
data-frame containing 3 columns and then use another database with the same
three columns and for each row determine if the xyz point is inside or not the
convex hull generated with the first database?
The
Hi everyone,
This may be a trivial solution but I would appreciate any help.
I have a database with three variables. I would like to plot the first two
variables in a xy plot making the color of points proportional to the values in
the third variable. Given that many points overlap, I decided
.
Thanks again,
Camilo
From: Jim Lemon
Sent: Sunday, October 19, 2014 10:27 AM
To: r-help@r-project.org
Cc: Camilo Mora
Subject: Re: [R] Plotting sum rather than count in hexbin
On Sun, 19 Oct 2014 08:09:28 AM Camilo Mora wrote:
> Hi everyone,
>
> Th
I figure out a way to display the hexbins color coded proportional to a third
attribute of the points falling on a given hexbin. I share it for future
reference or in case anyone has a way to improve it.
Cheers
C
library(plotrix)
library(hexbin)
#creates a
Hi everyone,
I have a two column (x,y) database with say 20 million rows. I want to check
the points that are inside of a hull created with the package alphahull. The
function that does this is call �inahull�, and it runs well when I use it for
one point at a time. But when I try to optimize th
Hi Bart,
Even after putting the variables in the apply function, the results come not
right:
library (alphahull)
DT=data.frame(x=c(0.25,0.25,0.75,0.75),y=c(0.25,0.75,0.75,0.25))
Hull <- ahull(DT, alpha = 0.5)
TEST<- data.frame(x=c(0.25,0.5),y=c(0.5,0.5))
plot(Hull)
points(TEST)
InHul2D <- func
Yes, that works. curiously, I tried that initially but it did not work because
of the "" around x.
Thank you very much for your help
for future readers inhull can be used with apply using:
library (alphahull)
DT=data.frame(x=c(0.25,0.25,0.75,0.75),y=c(0.2
Hi everyone,
This may be a trivial solution but I have not been able to figure what is wrong
with this code.
The basic premise of the code is to use data.table to append a new column to a
data.table that indicates if the values per row at two other columns are
within a 2d hull generated with
the issue that the code
reaches the RAM limit. This makes me to suspect that the error in
64bit is related to a default value on how big the files could be.
Anyway, any help will be highly appreciated.
Cheers,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Current
crashes within a millisecond from running the line that tries to open
the file. Anyway, I wanted to provide this info in case you may know
what could be causing this Runtime error in r.
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in
).
If of interest to anyone, I ended up splitting my files (making them
smaller than 2GB) using a software call NCO:
http://www.ncl.ucar.edu/Support/talk_archives/2007/1053.html
and then working in R at 64..
Cheers,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Hi Dave,
I run into this problem with windows 7 and 8. I used the latest
versions of r and ncdf as taken from icran.
I found my way around this problem breaking the files but it is a
petty that ncdf has this bug as it is a quite useful package.
Thanks,
Camilo
Camilo Mora, Ph.D
one knows the reason of this error or is there an alternative
to replace the values in one column based on the values of another?
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
http://www.soc.hawaii.edu/mora/
__
ata.table
con recognize the names of the columns?.
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colombia
Phone: Country code: 57
Provider code: 313
Phone 776 2282
From the USA or Canada you have to dial
n e as well.
ANy help will be greatly appreciate.
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colombia
Phone: Country code: 57
Provider code: 313
Phone 776 2282
From the USA or Canada you have
###
###Our loop is:###
nrows=nrow(data)
a=c()
for(b in 1:nrows)
{
c= ColChange(data[b,1],data[b,2],data[b,3:6],2)
a=rbind(a,c)
}
#########
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colom
to the cell to the left. So the results for the
example above should be something like:
a b c d
0 0 0 0
1 2 3 0
1 0 1 2
I wonder if you may know?.
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently
ot;,"j","k", "l","m")
dat2<-dat1
dat2[]<-t(apply(!dat1,1,function(x)
unlist(lapply(split(x,cumsum(c(0,abs(diff(x),cumsum
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colom
NAs gets NAs in the output, which is what I am looking for.
I guess a solution is to subset complete rows and then run your line
of code. Unless there is an alternative, to tell cumsum to leave NAs
as NAs?
Thanks again,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of
Nice!.
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colombia
Phone: Country code: 57
Provider code: 313
Phone 776 2282
From the USA or Canada you have to dial 011 57 313 776 2282
http://www.soc.hawaii.edu
if something like this possible?
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colombia
Phone: Country code: 57
Provider code: 313
Phone 776 2282
From the USA or Canada you have to dial 011 57 313 776 2282
hi:
I have a datatable with two columns (see below) and I want to create
another column that adds the values of the rows in the first two
columns. I am trying this:
DT[ , col3 :=rowSums(.SD, na.rm = TRUE), .SDcols = c("col1","col2")]
but I get this error:
Error in inherits(x, "data.frame")
in setting "max" in match to be dynamic for each
row. I have play around with different configurations and google it
with no success.
Any input will be greatly appreciated,
best,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colo
Hi
I am comparing different interpolation methods on climate data. I have
found quite a few functions (e.g. spline and kriging) but I wonder if
Nearest-neighbor interpolation and Natural neighbor function are
available in an R package?
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of
Hi everyone,
I am using the package "raster" to interpolate a large number of
rasters (~1million) of different resolutions to a unique 1degree
resolution grid and wonder if you know if it is possible to do this in
parallel computer?.
My code (example below) works like a charm but it will
ll be much appreciated,
Best,
Camilo
Camilo Mora, Ph.D.
Department of Biology
Dalhouisie University
Halifax, Canada
Phone: (902) 494-7720
http://as01.ucis.dal.ca/fmap/people.php?pid=53
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listi
x3. That is
NewColumn
.1
.2
.4
Any input greatly appreciated,
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
12 .4 .5 .6
0112 .2 .3 NA
0111 .1 NA NA
0110 NA NA NA
",sep="",header=TRUE)
the last value (from left to right) should be:
.6
.3
.1
NA
NAs are always consecutive once they appear.
Thanks again,
Camilo
Camilo Mora, Ph.D.
Department of Geography, Univers
color. My problem is that that the plot does
not work well in the layout with the other image.
Any help very much appreciated.
Again, my question is how to set the background color of an image in a
layout?.
Thanks,
Camilo
Camilo Mora, Ph.D.
Department of Geography,
mann's projection is 30.
Unfortunately, the resulting output, although similar in shape to the
outputs in R and Arcgis, is still not quite the same. Any thoughts why
these differences in supposedly the same calculations?
Any input will be greatly appreciated,
Thanks,
Camilo
Cami
s,
Camilo
p.s. I always pride R. It is just hard to image academic life without it...
Camilo Mora, Ph.D.
Department of Geography, University of Hawaii
Currently available in Colombia
Phone: Country code: 57
Provider code: 313
Phone 776 2282
From the USA or Canada y
Hi:
I wonder if anyone may know the answer to this question:
COnsider the following data frame (DF):
ColumnA ColumnB ColumnC
a d d
s s e
e r e
y w y
t u i
q e l
What I need is to repl
,
Camilo
Camilo Mora, Ph.D.
SCRIPPS Institute of Oceanography
University of California San Diego
San Diego, USA
Phone: (858) 822 1642
http://cmbc.ucsd.edu/People/Faculty_and_Researchers/mora/
And
Department of Biology
Dalhouisie University
Halifax, Canada
Phone: (902) 494 3910
http://as01.ucis.dal.ca
36 matches
Mail list logo