Re: [R] How to connect .mdb file

2012-07-11 Thread Mikhail Titov
imnew jubil...@live.com.sg writes: Hi, I'm currently having some problem connect .mdb file into R. I've installed the RODBC packages and I do the code this way: channel - odbcConnectAccess(C:/Users/Documents/XYZ) I have a total of 5 tables in the .mdb database. any one can help me with

Re: [R] do I need plyr, apply or something else?

2012-07-11 Thread Mikhail Titov
R. Michael Weylandt michael.weyla...@gmail.com writes: On Wed, Jul 11, 2012 at 10:05 AM, Russell Bowdrey russell.bowd...@justretirement.com wrote: Dear all, This is what I'd like to do (I have an implementation using for loops, which I designed before I realised just how slow R is at

Re: [R] is it possible to insert a figure into into another new figure by r script

2012-07-09 Thread Mikhail Titov
Jie Tang totang...@gmail.com writes: hi R-users Now I have a figure in emf or png or tiff format that have been drawn by other tool and I want to insert this figure into my new figure by R script. I wonder if is possible ? This [1] might be relevant. [1]

[R] How to make nice tiny sized figures on graphic devices producing scalable vector output?

2012-04-20 Thread Mikhail Titov
Hello! Usually whenever I want a tiny plot, I just create it as is (or even large) and then downscale it in the end application like LaTeX of MS Word. However, all these graphic devices like postscript, pdf, win.metafile retain physical sizes, so it would be natural if I can just insert

Re: [R] How to make nice tiny sized figures on graphic devices producing scalable vector output?

2012-04-20 Thread Mikhail Titov
Hello! I apologize for the previous e-mail that was unintentionally sent not as a plain text and was unreadable. Usually whenever I want a tiny plot, I just create it as is (or even large) and then downscale it in the end application like LaTeX of MS Word. However, all these graphic devices like

Re: [R] Needing a better solution to a lookup problem.

2012-03-14 Thread Mikhail Titov
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Davis, Brian Sent: Wednesday, March 14, 2012 2:28 PM To: r-help@R-project.org Subject: [R] Needing a better solution to a lookup problem. I have a solution (actually a few) to

Re: [R] Automating R script with Windows 7

2012-03-05 Thread Mikhail Titov
vincent.deluard vincentdelua...@gmail.com writes: I am trying to automate the daily running of a simple R script from Windows 7. From previous posts, I understand that this needs to be done with the task scheduler. That is correct. I can schedule my laptop to automatically open R at a

Re: [R] Running Total

2012-03-05 Thread Mikhail Titov
Edward Patzelt patze...@umn.edu writes: I'm am trying to create a vector that has a running total that adds each time a 1 occurs. here's the code and data c(1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 0L, 1L,

Re: [R] Running Total

2012-03-05 Thread Mikhail Titov
Edward Patzelt patze...@umn.edu writes: Actually in looking at this I need it to only add if a 0 occurs instead of a 1. cumsum(1-x) On Mon, Mar 5, 2012 at 12:57 PM, jim holtman jholt...@gmail.com wrote: cumsum is probably what you want: x - c(1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 1L,

[R] How can I map by results to original list of indices or first difference of column of data.frame with two factors?

2012-03-03 Thread Mikhail Titov
Hello! I’m having stacked data in a data.frame with 2 factors, ordered POSIXct, and actual value as numeric (as if for lattice::xyplot). I would like to calculate first difference using “diff” function within corresponding subsets/partitions. Since data.frame is organized by factors and has

Re: [R] How can I map by results to original list of indices or first difference of column of data.frame with two factors?

2012-03-03 Thread Mikhail Titov
, Mar 3, 2012 at 7:50 PM, Mikhail Titov m...@gmx.us wrote: Hello! I’m having stacked data in a data.frame with 2 factors, ordered POSIXct, and actual value as numeric (as if for lattice::xyplot). I would like to calculate first difference using “diff” function within corresponding subsets

Re: [R] Removing special chars in strings?

2011-08-31 Thread Mikhail Titov
I usually use something like [\\] Mikhail On 08/31/2011 08:32 PM, . . wrote: Hi all, How can I replace those \ in the str? Thanks in advance. func - function(str) { print(gsub(\\,,str)) } func(bla\ble\bli) __ R-help@r-project.org mailing

Re: [R] Legent to the Periodogram

2011-08-27 Thread Mikhail Titov
plot.spec uses matplot. see ?matplot for default col lty and use legend as usual. P.S. You can add plot=FALSE to spec.pgram to prevent it from plotting On 08/27/2011 05:39 PM, Peter Maclean wrote: How Can I add a legent (showing x1, x2, x3, x4) to the last plot? require(TSA)

[R] lattice: How to get log base for each axis inside panel function?

2011-08-15 Thread Mikhail Titov
Hello! I'd like to have a function to draw correct grid while using log axis with xyplot from lattice package. Right now I have the following code inside of my panel function: lim - current.panel.limits() v - latticeExtra:::logTicks(2^lim$xlim, loc=1) h - latticeExtra:::logTicks(2^lim$ylim,

Re: [R] how can I read a xlsx file

2011-08-15 Thread Mikhail Titov
I prefer RODBC and odbcConnectExcel this way I can query subsets with SQL. Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ivan Calandra Sent: Monday, August 15, 2011 10:28 AM To: r-help@r-project.org Subject: Re:

Re: [R] Alternative and more efficient data manipulation

2011-08-15 Thread Mikhail Titov
?reshape You have your data in a wide format, but you want it in a long format. reshape can convert it both ways. Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sam Albers Sent: Monday, August 15, 2011 6:58 PM To:

Re: [R] How do I subset a dataframe

2011-08-14 Thread Mikhail Titov
Eric: Create another column using grep and regular expression of your choice, then subset based on that column. Jorge: OP wants inexact match. P.S. I'd use RDBMS and SQL to pull data of interest Mikhail On 08/14/2011 02:20 AM, Jorge Ivan Velez wrote: Hi eric, See R ?%in% and try the

Re: [R] Not sure how to use aggregate, colSums, by

2011-08-14 Thread Mikhail Titov
I hope this will help you get going b - sapply(unique(test$e2), function(x) { out - aggregate(cbind(y,f)~e1, subset(test, e2==x),sum) out - rbind(out, data.frame(e1=total, y=sum(out$y), f=sum(out$f))) out - list(out) names(out) - x out }) b $std e1 y f 1 can 21

Re: [R] Any alternatives to draw.colorkey from lattice package?

2011-08-13 Thread Mikhail Titov
August 2011 19:59, Jim Lemon j...@bitwrit.com.au wrote: On 08/13/2011 04:34 AM, Mikhail Titov wrote: Hello! I’d like to have a continuous color bar on my lattice xyplot with colors lets say from topo.colors such that it has ticks labels at few specific points only. Right now I use

Re: [R] linear regression

2011-08-13 Thread Mikhail Titov
Don't forget to load `lattice` package. `latticeExtra` with `panel.ablineeq` can be also helpful. This was however for plotting. For subset regression by each WR without plotting you'd use something like `lapply` or `sapply`. ans - sapply(unique(data$WR), function(dir) { out -

Re: [R] lattice panel.abline use

2011-08-12 Thread Mikhail Titov
I hope this helps: xyplot(val ~ x | type, panel=function(...) { panel.xyplot(...) panel.abline(h=.6) }) Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jjap Sent: Friday, August 12,

Re: [R] recode Variable in dependence of values of two other variables

2011-08-12 Thread Mikhail Titov
?aggregate aggregate(X~ID, your.data.frame.goes.here, mean) Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Julia Moeller Sent: Friday, August 12, 2011 10:10 AM To: r-help@r-project.org Subject: [R] recode Variable

Re: [R] Standard error bars on bar plots

2011-08-12 Thread Mikhail Titov
Or ?barplot2 barplot2(means,main=Proportion of time spent in AMU sector,xlab=Treatments,ylab=Proportion of time,names.arg=c(Solitary,Size-matched conspecific,Sub-adult conspecific),cex.names=0.85,axis.lty=1,ylim=c(0,0.4), plot.ci=TRUE,ci.l=means,ci.u=means+halfSE) Mikhail

[R] Any alternatives to draw.colorkey from lattice package?

2011-08-12 Thread Mikhail Titov
Hello! I’d like to have a continuous color bar on my lattice xyplot with colors lets say from topo.colors such that it has ticks labels at few specific points only. Right now I use do.breaks level.colors with somewhat large number of steps. The problem is that color change point doesn’t

[R] RODBC: sqlUpdate doesn't handle properly POSIXct field?

2011-08-07 Thread Mikhail Titov
Hello all! Can someone confirm whether there is a bug or not? I was trying to use sqlUpdate in place of sqlSave as data set I import has duplications. However I get errors while using fast=FALSE argument to safely update/ignore duplicates: Error while executing the query[RODBC]

Re: [R] RODBC: sqlUpdate doesn't handle properly POSIXct field?

2011-08-07 Thread Mikhail Titov
frame I’m pushing to DB: class(dat$time) [1] POSIXct POSIXt Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Mikhail Titov Sent: Sunday, August 07, 2011 7:22 PM To: r-help@r-project.org Subject: [R] RODBC: sqlUpdate

Re: [R] RODBC: sqlUpdate doesn't handle properly POSIXct field?

2011-08-07 Thread Mikhail Titov
[mailto:r-help-boun...@r-project.org] On Behalf Of Mikhail Titov Sent: Sunday, August 07, 2011 7:27 PM To: r-help@r-project.org Subject: Re: [R] RODBC: sqlUpdate doesn't handle properly POSIXct field? I apologize for the first e-mail as I didn't use plain text. Here is the full message. --8

Re: [R] How to convert a single column into many rows

2011-03-23 Thread Mikhail Titov
I guess matrix(x, ncol=73, byrow=TRUE) should work Mikhail -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Zablone Owiti Sent: Wednesday, March 23, 2011 6:14 AM To: r-help@r-project.org Subject: [R] How to convert a single

Re: [R] Any existing functions for reading and extracting data from path names?

2011-03-11 Thread Mikhail Titov
I'm not sure what you are trying to achieve, but I think this can be a good starting point: files - list.files(deleteme, full.names=TRUE, recursive=TRUE) names - sapply(strsplit(files, /, TRUE), [, 2) x - lapply(files, function(f) { out - read.csv(f) out$city - strsplit(f, /,

Re: [R] How to group data by day

2011-02-14 Thread Mikhail Titov
It depends what would you like to get at the end. Perhaps you don't necessary need this type of numbering. For instance, if you'd like to calculate daily average. london$id - as.Date(london$id) For sum by day you could use, let's say, this aggregate(words~id,london,FUN=sum) If you really want

[R] lattice: dots from xyplot to xscale.components

2010-10-12 Thread Mikhail Titov
Hello! I posted a feature request at lattice page on r-forge at https://r-forge.r-project.org/tracker/index.php?func=detailaid=1127group_id=638atid=2570 , but I decided to duplicate it here to make sure that I understand everything correctly. I would like to slightly change the way my plot

[R] typo in ts detrending implementation in spec.pgram?

2009-07-08 Thread Mikhail Titov
Hello! I wonder if there is a typo in detrending code of spec.pgram in spectrum.R from stats package. One can see in the code https://svn.r-project.org/R/trunk/src/library/stats/R/spectrum.R . I am afraid there is a typo and the code should look like if (detrend) { t - 1L:N - (N +

[R] typo in Lomb-Scargle periodogram implementation in spec.ls() from cts package?

2009-06-19 Thread Mikhail Titov
Hello! I tried to contact author of the package, but I got no reply. That is why I write it here. This might be useful for those who were using cts for spectral analysis of non-uniformly spaced data. In file spec.ls.R from cts_1.0-1.tar.gz lines 59-60 are written as pgram[k, i, j] - 0.5 *