Harold,
I have dealt with this problem over the years and after much experimenting, I
can say that I *think* what you want is impossible. For RODBC, you need a
stored proc that uses SET NOCOUNT ON and that only returns a single result set.
You may want to try experimenting with the odbc
Tony,
I’m not sure what exactly you’re trying to do, but you're not really taking
advantage of vectorization in your R code. I've tried to clean it up a little.
The clamped lognormal is almost always 0 or L? That seems a little odd. You
seem to be using the inverse cdf method of drawing
The "lubridate" package will help simplify these time zone conversions. It
provides two simple functions with_tz and force_tz that conceptually make
things simpler.
library(lubridate)
> x <- as.POSIXct("2015-06-22 01:53:28", 'Europe/Berlin')
> with_tz(x, 'America/Toronto')
[1] "2015-06-21
On my system, the name of the Garamond font file is GARA.TTF.
Thus,
font_import(pattern = 'GARA')
will work, but
font_import(pattern=gara)
won't. Unfortunately, font_import seems to fail rather ungracefully when there
is no match to a pattern.
Jason
-Original Message-
From:
library(reshape2)
data.melt - melt(data, id.vars = c('BH_ID', 'BH_Name', 'Pack_Name'))
dcast(dm, BH_Name ~ Pack_Name)
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of drruddy gmail
Sent: Wednesday, February 19, 2014 7:18 AM
To:
Clint and Liviu,
Stackoverflow also has rss feeds available, if you prefer being pushed the
information that way. For the R tagged questions it's here:
http://stackoverflow.com/feeds/tag/r. Since some e-mail clients double as feed
readers, you may be able to read the feed from your e-mail
Natalie,
I'm assuming this is some kind of passive animal sampling? Instream PIT tags
for fish? In that case, you can get what I think you want using ggplot2 and
something like this:
dat$TagID - as.factor(dat$TagID)
dat$Station - as.factor(dat$Station)
dat$Station2 - as.numeric(dat$Station)
I use the spsurvey package a decent amount. The cont.cdftest function bins the
cdf in order to perform the test which I think is the root of the problem.
Unfortunately, the default is 3 which is the minimum number of bins.
I would contact Tom Kincaid or Tony Olsen at NHEERL WED directly to
See ?pmax for getting the max for each year.
do.call('pmax', oil[-1])
Or equivalently:
pmax(oil$TX, oil$CA, oil$AL, oil$ND)
apply and which.max will give you the index:
i - apply(oil[-1], 1, which.max)
which you can use to extract the state:
names(oil[-1])[i]
Jason
-Original
You just need the date, otherwise how would it know what time comes first? In
strptime(), a date is being assumed.
Try this:
testtime-c(20:00:00,22:10:00,22:20:00,23:15:00,23:43:00,00:00:00,00:51:00,01:00:00)
testday - rep(Sys.Date() - c(1,0), times = c(5,3))
plot(as.POSIXct(paste(testday,
If you want a dataframe rather than a matrix, I often use the as.data.frame
method for table objects. See ?table for the documentation. You can even
nicely name the dimensions and frequency.
OBJECT - sample(4, 20, TRUE)
as.data.frame(table(var1 = OBJECT), responseName = 'frequency')
Jason
library(abind)
library(plyr)
c - abind(a,b, along = 4)
results - alply(c, c(2,3), function(x) lm(x[,2] ~ x[,1]))
ldply(results, function(x) summary(x)$coef)
Jason Law
Statistician
City of Portland
Bureau of Environmental Services
Water Pollution Control Laboratory
6543 N Burlington Avenue
In the plyr package there are also the functions revalue and mapvalues:
library(plyr)
x - c(a, b, c)
revalue(x, c(a = A, c = C))
mapvalues(x, c(a, c), c(A, C))
mapvalues works on numeric, character and factor.
Jason
-Original Message-
From: r-help-boun...@r-project.org
Might be better off using a web service like ChemSpider to do the matching for
you http://www.chemspider.com/AboutServices.aspx?. The idea that you can
identify the synonyms by name is probably optimistic unless they are exact
matches.
Here's some python code that seems to make it pretty
Not sure what you're trying to do, but it looks like most of what you're
attempting to do in the code can be done just using vectors rather than loops,
at least the inner loop. For example:
k - 1.15
l - exp((1 / k) * (7.16 - 0.44 + 0.12 - 0.016))
z - (log(1 / p) * l)^k
See ifelse for how to
Hi Bruce,
I work with a lot of similar data and have to do these types of things quite
often. I find it helps to keep to vectorized code as much as possible. That
is, do as many of the calculations as possible outside of the aggregation code.
Here's one way:
library(reshape2)
# stick to a
This completes in about a second on my system and uses the actual matrix
dimensions you quote:
nr - 153899
nc - 3415
keep - rnorm(nr * nc, 80, 20)
dim(keep) - c(nr, nc)
shrink.to - 1000
system.time(
{
idx - rep(1:shrink.to, length.out = nr)
plot.me -
Try this:
library(plyr)
library(ggplot2)
library(lubridate)
data-read.csv(http://dl.dropbox.com/u/4236038/test_cumu.csv;)
data$Date - as.Date(data$Date)
cumu - ddply(data,.(year(Date)),transform, cumRain = cumsum(Rainfall))
ggplot(cumu, aes(x = yday(Date), y = cumRain, color =
On R 2.15.2 and ArcGIS 9.3.1, it works for me in ArcCatalog but you have to
follow the particulars here:
http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Accessing_delimited_text_file_data
For example:
write.table(test, '***.tab', sep = '\t', row.names = F)
The extension .tab and
Something like:
if (!require(pkg)){
install.packages(pkg)
}
Jason
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Ralf B
Sent: Thursday, June 24, 2010 12:26 PM
To: r-help@r-project.org
Subject: [R] Install package
This should do the trick:
data$date - as.Date(data$date, '%m/%d/%Y')
data$month - format(data$date, '%Y-%m')
by(data$rammday, data$month, sum)
Hope that helps,
Jason
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Stephan
See ?toString
x - 0:10
toString(x)
See ?sQuote for cases where the vector is a character and needs to be quoted.
Jason Law
Statistician
City of Portland
Bureau of Environmental Services
Water Pollution Control Laboratory
6543 N Burlington Avenue
Portland, OR 97203-5452
I noticed a problem using R 2.7.1 on Windows XP SP2 with the precompiled
Atlas Rblas.dll. Running the code below causes R to crash. I started R
using Rgui --vanilla and am using the precompiled Atlas Rblas.dll from
cran.fhcrc.org dated 17-Jul-2007 05:04 for Core2 Duo.
The code that causes the
Does Hadley's response to the following post still hold for the most recent
version of ggplot2?
http://tolstoy.newcastle.edu.au/R/e2/help/07/07/21347.html#21379qlink2
I'm trying to accomplish in ggplot2 what the relation component of
scales does in lattice, e.g.,
stripplot(yield ~ variety |
This will give you the percents in the same order as your original data (as
this is what your original code did)
apply(tdat, 2,
function(x) {
o - order(x)
oldo - order(o)
prc - cumsum(x[o]) / sum(x)
prc[oldo]
})
Jason Law
Statistician
City of Portland, Bureau of
25 matches
Mail list logo