Re: [R] Calculating distance matrix for large dataset

2013-05-03 Thread steven mosher
I have a version that uses bigmemory on my blog, but looks at distance on a sphere for a 36k * 36K matrix not hundreds of Gb so I dont know if the approach will work for you http://stevemosher.wordpress.com/2012/04/12/nick-stokes-distance-code-now-with-big-memory/ Steve However, I never

Re: [R] How can I map numbers to colours with raster?

2012-10-29 Thread steven mosher
see the function level() in raster. also levelplot in rastervis package. you basically create a raster attribute table coerce the raster to factor class and plot. check geo sig i have posted the same question there On Oct 29, 2012 2:15 AM, "Jonsson" wrote: > This code will read binary file and di

Re: [R] bigmemory for dataframes?

2012-10-18 Thread steven mosher
i believe ff has a dataframe class. as for your object data im less clear. how big is it On Oct 18, 2012 12:45 PM, "Alexander Shenkin" wrote: > Hi Folks, > > I've been bumping my head against the 4GB limit for 32-bit R. I can't > go to 64-bit R due to package compatibility issues (ROBDC - possib

Re: [R] R process must die - can I save history?

2012-10-02 Thread steven mosher
thanks Dr. R. this will come in handy in the future as I have a knack for hanging R. On Oct 2, 2012 12:01 PM, "Prof Brian Ripley" wrote: > On 02/10/2012 18:29, Bert Gunter wrote: > >> ?history >> >> in a fresh R session, to see what might be possible. I'll bet the >> answer is, "No, you're screwe

Re: [R] How to arrange the GUI's in window in tcltk package???

2012-08-25 Thread steven mosher
1. get programming grapgical user interfaces in R. lawrence and verzani. 2. if you used gwidgets on gtk i could tell you exactly what to do. 3. with the toolkit youve selected i think tlpack controls the way children are placed in a container. default is top to bottom On Aug 24, 2012 11:27 PM, "p

Re: [R] building binary tree

2012-06-27 Thread steven mosher
I believe chambers book has an example using S4 classes. which isnt much help for a beginner. you can do it the old school way. build it by hand with one vector of pointers and another data structure of leaf nodes. there is nothing magical about a tree. you can build one in basic or fortran. painf

Re: [R] A basic design question for R

2012-06-16 Thread steven mosher
use a list. or create new class which is a list On Jun 16, 2012 8:52 AM, "Onur Uncu" wrote: > Hello R Community, > > I have the following design question. I have a data set that looks > like this (shortened for the sake of example). > > Gender Age > M 70 > F 65 > M

Re: [R] Converting to XTS loses data.frame structure

2012-05-29 Thread steven mosher
is there a statement of work for the summer of code work. On May 29, 2012 12:19 PM, "Joshua Ulrich" wrote: > On Tue, May 29, 2012 at 2:11 PM, Noah Silverman > wrote: > > Hello, > > > > I noticed something odd when working with data frames and xts objects. > > > > If I read in a CSV file, R creat

Re: [R] Failure building any package

2012-05-17 Thread steven mosher
Did you edit the description file and the namespace file and the Rd files? Although my tutorial is for windows if you follow steps 8 thru 10 on mac it should work http://stevemosher.wordpress.com/step-8-the-sample-package/ On Thu, May 17, 2012 at 7:44 PM, Noah Silverman wrote: > Hello, > > I

Re: [R] Help - Importing data from txt and xlsx files

2012-04-13 Thread steven mosher
read your file with readLines(). copy the first few lines for me to read here test <- readLines(yur filename) test[1:5] post the result. we can figure it out from there On Apr 13, 2012 11:46 AM, "AMFTom" wrote: > Dear Thierry, > > Thanks for your help. Now though, I try to import data from a tx

Re: [R] using wildcards in download.file?

2012-04-13 Thread steven mosher
one way to solve your problem is to fetch the directory using rcurl. then mapply using the dirlist as a parameter passed to download file On Apr 13, 2012 9:24 AM, "MacQueen, Don" wrote: > If you take a thorough look at the help page for download.file, and follow > its advice, you may find a solut

Re: [R] Applying a function to categorized data?

2012-04-12 Thread steven mosher
Welcome to R and the list. Others may suggest books ( Nutshell was my first ) but first there are some things that will help you both in programming and getting help on the list. You should post executable code in your question. So, build a toy example of the data.frame you have and show what

Re: [R] Listing the contents of an FTP directory via R?

2012-04-09 Thread steven mosher
esponse reading failed > > Does not seem to work... Thoughts? > > --j > > On Mon, Apr 9, 2012 at 1:32 PM, steven mosher > wrote: > > A couple of ways. > > > > using Rcurl you can use the curlOption of dirlistonly. > > > > otherwise you can read

Re: [R] Listing the contents of an FTP directory via R?

2012-04-09 Thread steven mosher
cr.usgs.gov/MOTA/MCD15A3.005/",verbose=TRUE,ftp.use.epsv=TRUE, > dirlistonly = TRUE) > Error in function (type, msg, asError = TRUE) : > FTP response reading failed > > Does not seem to work... Thoughts? > > --j > > On Mon, Apr 9, 2012 at 1:32 PM, steven mosher &g

Re: [R] Listing the contents of an FTP directory via R?

2012-04-09 Thread steven mosher
A couple of ways. using Rcurl you can use the curlOption of dirlistonly. otherwise you can read the page and parse. I've got some code around here to do that. Steve On Mon, Apr 9, 2012 at 11:27 AM, Jonathan Greenberg wrote: > R-helpers: > > I'd like to be able to store all the file informa

Re: [R] Handling 8GB .txt file in R?

2012-03-25 Thread steven mosher
As the other poster noted, you can just skip lines. Big matrix should work just fine, except I am not sure how the dates will be handled Here is some sample code from my stuff txtName is the file name of the file you are reading Directory is the path where you want to write the file.backed ma

Re: [R] video recorded simulations in R?

2012-03-24 Thread steven mosher
see the package animate On Mar 24, 2012 7:37 AM, "Sarah Goslee" wrote: > The easiest approach is to save your plot as a bitmap every x-th > iteration, and then use other tools to animate them. I use ImageMagick for > this, but I'm sure there are other options. > > Sarah > > On Mar 23, 2012, at 11

Re: [R] Memory issue. XXXX

2012-03-02 Thread steven mosher
1. How much RAM do you have (looks like 2GB ) . If you have more than 2GB then you can allocate more memory with memory.size() 2. If you have 2GB or less then you have a couple options a) make sure your session is clean of unnecessary objects. b) Dont read in all the data if you dont

[R] Question about tables in bigtabulate

2012-02-29 Thread steven mosher
I have a large file backed big. matrix, with millions of rows and 20 columns. The columns contain data that I simply need to tabulate. There are a few dozen unique values. and I just want a frequency count Test code with a small "big" matrix. library(bigmemory) library(bigtabulate) test <- bi

Re: [R] best option for big 3D arrays?

2012-02-27 Thread steven mosher
u set 'delete' to be the 'finalizer' of the > object; in this way you avoid ff to save it in some tmp dir and occupy disk > space forever. Then, you can access your object in the next R session: > > > ffload("mydir/myfile")# also without extension >

Re: [R] best option for big 3D arrays?

2012-02-23 Thread steven mosher
Did you have to use a particular filename? or extension. I created a similar file but then could not read it back in Steve On Mon, Feb 13, 2012 at 6:45 AM, Djordje Bajic wrote: > I've been investigating and I partially respond myself. I tried the > packages 'bigmemory' and 'ff' and for me the

Re: [R] package.skeleton()

2011-12-19 Thread steven mosher
Here ben I have a tutorial on how to do it http://stevemosher.wordpress.com/step-8-the-sample-package/ On Sun, Dec 18, 2011 at 11:49 PM, Petr PIKAL wrote: > Hi > > If I remember correctly I do > > start clear R -vanilla session > copy my functions to it. > run package.skeleton("some.name")

Re: [R] Levenshtein-Distance

2011-10-20 Thread steven mosher
check the help archives. hclust with method=ward might be what you are looking for On Wed, Oct 19, 2011 at 2:43 PM, Jörg Reuter wrote: > I am very new to R, so sorry that I ask stupid things. > I want compare a Matrix row by row and at the end I want to a Matrix with > the Levenshtein-Dista

Re: [R] Problem with twitteR package

2011-10-11 Thread steven mosher
check the version of libcurl you have installed. If you have an older version some of the options may not be present. On Sun, Oct 9, 2011 at 10:39 AM, Steven Oliver wrote: > Hey Guys, > > I just started fooling around with the twitteR package in order to get a > record of all tweets from a s

Re: [R] Best Package to Extract Numbers from this Image?

2011-10-06 Thread steven mosher
You can probably use the package jpg , It will be a pain. You will have to read it in as a jpg then isolate the numbers ( by row and column ) then figure out some way ( probably not that hard) to identify the numbers from the bit pattern. I tried something similar with the png package. it wa

Re: [R] Hourly data with zoo

2011-09-12 Thread steven mosher
worked beautifully. Thanks. On Mon, Sep 12, 2011 at 9:45 AM, Gabor Grothendieck wrote: > On Mon, Sep 12, 2011 at 11:57 AM, steven mosher > wrote: >> Gabor.. thanks. >> >> zr <- zooreg(rnorm(24), as.chron("2011-01-01"), frequency = 24) >> >> a c

Re: [R] Hourly data with zoo

2011-09-12 Thread steven mosher
,200 The end goal is to create a data structure for around 200 series aligned by time On Mon, Sep 12, 2011 at 3:48 AM, Gabor Grothendieck wrote: > On Mon, Sep 12, 2011 at 1:58 AM, steven mosher wrote: >> I have date data as a numeric and hourly data in 0 to 2300 hours in a >>

[R] Hourly data with zoo

2011-09-11 Thread steven mosher
I have date data as a numeric and hourly data in 0 to 2300 hours in a dataframe. d <- rep(20110101,24) h <- seq(from = 0, to = 2300, by = 100) df <- data.frame(LST_DATE = d, LST_TIME = h, data = rnorm(24, 0, 1)) S <- chron(dates. = as.character(df$LST_DATE), times. = paste(as

Re: [R] Elegant way to subtract matrix from array

2011-07-27 Thread steven mosher
Thanks Gabor! On Wed, Jul 27, 2011 at 3:08 AM, Gabor Grothendieck wrote: > On Wed, Jul 27, 2011 at 4:06 AM, steven mosher > wrote: > > there are really two related problems here > > > > I have a 2D matrix > > > > > > A <- matrix(1:100,nrow=20,ncol

Re: [R] Elegant way to subtract matrix from array

2011-07-27 Thread steven mosher
ad one guy using the package who has hit the memory limits.. I have one more thing to try Thanks! Steve On Wed, Jul 27, 2011 at 1:42 AM, Gavin Simpson wrote: > On Wed, 2011-07-27 at 01:06 -0700, steven mosher wrote: > > there are really two related problems here > > > > I

[R] Elegant way to subtract matrix from array

2011-07-27 Thread steven mosher
there are really two related problems here I have a 2D matrix A <- matrix(1:100,nrow=20,ncol =5) S <- matrix(1:10,nrow=2,ncol =5) #I want to subtract S from A. so that S would be subtracted from the first 2 rows of #A, then the next two rows and so on. #I have a the same problem with a 3D

Re: [R] How to convert number (matlab) to date

2011-07-18 Thread steven mosher
Thanks, I just upgraded to 1.7.1 Also thanks for adding the t() function. On Mon, Jul 18, 2011 at 12:38 PM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > On Mon, Jul 18, 2011 at 2:57 PM, peter dalgaard wrote: > > > > On Jul 18, 2011, at 20:19 , Gabor Grothendieck wrote: > > > >> On

Re: [R] Storing and managing custom R functions for re-use

2011-07-10 Thread steven mosher
Same here. Just made my first package and regret not having learned how to do it from the very beginning. Steve On Sun, Jul 10, 2011 at 3:27 AM, Michael Dewey wrote: > At 12:30 09/07/2011, Simon Chamaillé-Jammes wrote: > >> Dear all, >> >> sorry if this is a bit on the sidetrack for R-help. >>

Re: [R] Package warnings

2011-06-22 Thread steven mosher
code/documentation mismatches ... WARNING Data sets with usage in documentation object 'FILE.PARAMETERS' but not in code:" changing \usage cleared the warning \usage{FILE.PARAMETERS} clears check! crantastic, no warnings, no errors! On Wed, Jun 22, 2011 at 8:29 AM, steven mos

Re: [R] Package warnings

2011-06-22 Thread steven mosher
Thanks Duncan, I'll join Dev and ask the questions over there. Steve On Wed, Jun 22, 2011 at 7:19 AM, Duncan Murdoch wrote: > On 11-06-21 11:58 PM, steven mosher wrote: > >> Thanks to all your help I've just finished my first package and I have a >> couple of quest

[R] Package warnings

2011-06-21 Thread steven mosher
Thanks to all your help I've just finished my first package and I have a couple of questions I want to submit to CRAN but I have 1 warning " checking for code/documentation mismatches ... WARNING Data sets with usage in documentation object 'FILE.PARAMETERS' but not in code: FILE.PARAMETE

Re: [R] Permission denied in Windows 7

2011-06-09 Thread steven mosher
at contained all the source Files and that all the files in that directory ending in .R would be used. Thanks On Wed, Jun 8, 2011 at 11:44 PM, Prof Brian Ripley wrote: > On Wed, 8 Jun 2011, steven mosher wrote: > > I'm using package.skeleton() windows 7, 64 bit. >>

Re: [R] Questions about building R packages

2011-06-08 Thread steven mosher
here i wrote a step by step tutorial. http://stevemosher.wordpress.com/2011/06/09/making-simple-packages-in-r-on-windows/ On Wed, Jun 8, 2011 at 1:17 PM, Xia.Li wrote: > Hello R users, > > I have difficulties when trying to make R packages. I tried to read many > tutorials but still could not

[R] Permission denied in Windows 7

2011-06-08 Thread steven mosher
I'm using package.skeleton() windows 7, 64 bit. When I try to specify the code_files package_skeleton(code_files = " some directory") I get a warning that that the connection cannot be opened and I get a Permissions denied error. I'm running R as admin and I've given everybody full permis

Re: [R] Problem with package development

2011-06-02 Thread steven mosher
I hope you're successful because I'm having issues as well building a simple package on windows. maybe when you're finished you can share back a step by step guide. On Thu, Jun 2, 2011 at 12:21 PM, Nipesh Bajaj wrote: > I have run R CMD check trial1 and saw an error. This says that: > > * chec

Re: [R] help with barplot

2011-05-28 Thread steven mosher
Thanks Thomas. On Sat, May 28, 2011 at 11:29 AM, Thomas Levine wrote: > You can do pretty well without ggplot actually. > > boxplot(Time~paste(Incidents,Months),data=DF,border=c('grey20','red')) > > On Sat, May 28, 2011 at 2:55 AM, steven mosher > wrote

Re: [R] help with barplot

2011-05-27 Thread steven mosher
= Time, fill = Months)) + > geom_ribbon(aes(ymax = ..density.., ymin = -..density..), >alpha = .2, stat = "density") + > facet_grid( ~ Incidents) + > coord_flip() > > ## Option C altered > ggplot(DF, aes(x = Time, fill = Months)) + > geom_ribbon(aes(ymax = ..density.., y

[R] help with barplot

2011-05-27 Thread steven mosher
Hi, I'm really struggling with barplot I have a data.frame with 3 columns. The first column represents an "incident" type The second column represents a "month" The third column represents a "time" Code for a sample data.frame incidents <- rep(c('a','b','d','e'), each =25) months<- rep(c(1

Re: [R] Understanding tryCatch

2011-03-18 Thread steven mosher
2011 at 12:17 PM, Henrique Dallazuanna wrote: > Try this: > > tryCatch(log(rnorm(10)), warning = function(m)deparse(m$call[[2]])) > > Where log(rnorm(10)) is your expr to evaluate. > > On Fri, Mar 18, 2011 at 4:04 PM, steven mosher > wrote: > > I've read t

[R] Understanding tryCatch

2011-03-18 Thread steven mosher
I've read the help and the archives on tryCatch but I'm still stuggling trying to understand how it works exactly and how I can use it to get the result I need. I have a data.frame of urls which point to 11 .zip files. Basically I use RCurl to get the list of files from a ftp and then reduce that

Re: [R] s3 methods on S4 objects

2011-01-13 Thread steven mosher
eric("as.data.frame")) { setGeneric("as.data.frame", function(dirlist ) standardGeneric("as.data.frame")) } setMethod("as.data.frame", signature(dirlist = "ftpdir" ), function (dirlist ) { return( dirlist@dirframe) } ) On Thu, J

Re: [R] s3 methods on S4 objects

2011-01-13 Thread steven mosher
On Thu, Jan 13, 2011 at 6:46 AM, Martin Morgan wrote: > On 01/12/2011 10:54 PM, steven mosher wrote: > > I have J Chambers wonderful text ( Software for data Analysis) and I've > been > > trying > > my hand at some very routine S4 OOP development. > > > >

[R] s3 methods on S4 objects

2011-01-12 Thread steven mosher
I have J Chambers wonderful text ( Software for data Analysis) and I've been trying my hand at some very routine S4 OOP development. One of the things I was trying to do was to create some very basic S4 classes. The first was simply a class that had a data.frame as part of its representation. set

Re: [R] Accessing data via url

2011-01-06 Thread steven mosher
Here John, from the manual URLs A note on file:// URLs. The most general form (from RFC1738) is file://host/path/to/file, but R only accepts the form with an empty host field referring to the local machine. This is then file:///path/to/file, where path/to/file is relative to ‘/’. So although the

Re: [R] Accessing data via url

2011-01-06 Thread steven mosher
https your second link is an https that's not supported as I recall. ?url On Thu, Jan 6, 2011 at 11:53 AM, John Kane wrote: > # Can anyone suggest why this works > > datafilename <- " > http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data"; > person.data <- read.table(datafilen

Re: [R] Navigating web pages using R

2011-01-05 Thread steven mosher
Hmm, Rcurl may be able to help you. Not sure I have not played with the "query" abilities. On Tue, Jan 4, 2011 at 10:54 AM, Erik Gregory wrote: > R-Help, > > I'm trying to obtain some data from a webpage which masks the URL from the > user, > so an explicit URL will not work. For example, when

Re: [R] lm() on a matrix of zoo series

2010-12-21 Thread steven mosher
Thanks, I was trying apply(TestZoo,2,lm,TestZoo~time(TestZoo)) which was throwing a formula error. On Tue, Dec 21, 2010 at 12:21 PM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > On Tue, Dec 21, 2010 at 3:02 PM, steven mosher > wrote: > > I have a matrix of zoo s

[R] lm() on a matrix of zoo series

2010-12-21 Thread steven mosher
I have a matrix of zoo series. each series is in a column. x <- as.yearmon(2000 + seq(0, 23)/12) # 24 months of data, lets make 20 sets of random data testData <- matrix(rnorm(480),ncol=20) # make a zoo object and columns will hold the 20 series TestZoo <- zoo(testData,order.by=x) # now run lm f

Re: [R] selecting certain rows from data frame

2010-12-14 Thread steven mosher
Hi, Next time give folks code to produce a toy sample of your problem DF <-data.frame(ID=rep(1:5,each=3),Data=rnorm(15),Stuff=seq(1:15)) DF ID Data Stuff 1 1 2.0628225 1 2 1 0.6599165 2 3 1 0.5672595 3 4 2 -0.5308823 4 5 2 -0.5358471 5 6 2 -0.1414992

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread steven mosher
org Ruß: > v = download.file(url,destf,method="wget") > if(v!=0) { > #download.file failed > } > #no error message though > > 2) > > Henrique Dallazuanna and Steven Mosher both suggested using RCurl, > here is an example code from Henrique for checking if a file exists o

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread steven mosher
Month=dir[ ,1],Time=dir[ ,2],stringsAsFactors=FALSE) closeAllConnections() return(out) } On Tue, Nov 30, 2010 at 9:56 AM, Baoqiang Cao wrote: > Thanks Steven! > It is excellent code indeed! > > On Tue, Nov 30, 2010 at 11:26 AM, steven mosher > wrote: > > I w

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread steven mosher
length(contents)] On Tue, Nov 30, 2010 at 9:56 AM, Baoqiang Cao wrote: > Thanks Steven! > It is excellent code indeed! > > On Tue, Nov 30, 2010 at 11:26 AM, steven mosher > wrote: > > I would use RCurl. > > > > if you have, for example, the url of an ftp s

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread steven mosher
using RCurl getFtpList <- function(ftp){ # the structure returned is dependent on the ftp site as there are # various formats for directory listings dependent upon the server # and the OS. you will need to play with this. # have a look at the ftp with your browser first and adjus

Re: [R] how to know if a file exists on a remote server?

2010-11-30 Thread steven mosher
I would use RCurl. if you have, for example, the url of an ftp site you can merely do a getURL() and the contents will be returned. That call will return data that can be coerced into a data.frame that will look like a directory structure listing the file names. If you need code just ask, but t

[R] Reverting to previous version

2010-11-12 Thread steven mosher
R 2.12 is not functioning for me On the MAC what the most painless way of reverting [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://ww

Re: [R] spliting first 10 words in a string

2010-11-02 Thread steven mosher
just merge the data.frames back together. use merge or cbind() cbind will be easier DF1 <- data.frame(x,y,z) DF2 <-data.frame(DF1$x) # copy a column then you added columns to DF2 just put them back together DF3 <-cbind(DF2,DF1$y,DF$z) if you spend more time with R you will be able to do thing

Re: [R] splitting First 10 words in a string

2010-11-02 Thread steven mosher
Line should be: first=second=third=fourth=fifth=sixth=seventh=eighth=ninth=tenth<-vector(length=nrow( sent)) sorry cut and past error On Tue, Nov 2, 2010 at 3:32 PM, steven mosher wrote: > That's easy you are confusing the dummy code I sent. > > Do this: > > lit<

Re: [R] splitting First 10 words in a string

2010-11-02 Thread steven mosher
gt; <-data.frame(Sentence=sent,first,second,third,fourth,fifth,sixth,seventh,eighth,ninth,tenth,stringsAsFactors=FALSE) > > > > »Error in data.frame(Sentence = sent, first, second, third, fourth, fifth, > : > > arguments imply differing number of rows: 22928, 10« > >

Re: [R] spliting first 10 words in a string

2010-11-02 Thread steven mosher
Thanks david. Matevz, maybe I can help explain by doing a very simple and brute force approach as opposed to the way david did it. But you should learn his methods. I will just do a subset of your problem and if you understand how it works then you should be able to get something done and the

[R] Strings from different locale

2010-11-01 Thread steven mosher
I'm doing some test processing of a cvs file that appears to use a different locale from my machine. I get the following warning: input string 1 is invalid in this locale My locale is US. Is this simply a matter of changing my locale to 'all; locales? I don't know what locale the string is in,

Re: [R] doubt in climate variability analysis in R! - code

2010-10-31 Thread steven mosher
Ok I downloaded it and showed you how to get your data out. How to read it into a raster brick, how to plot the data, how to get the mean rainfall of every day.lots more you can do. there is a bad bit of data in the last time step. check my blog. In the future what you should do is write code t

Re: [R] Best IDE for R

2010-10-27 Thread steven mosher
Thanks for the pointer, After looking at the many folders of R code I have I decided it was time to start working in an IDE and also getting my stuff under version control ( for my own sanity) I'll have a look at Geany.. for version control.. not so sure. On Wed, Oct 27, 2010 at 12:14 PM, Liviu

Re: [R] Reading in a tab delimitated file

2010-10-27 Thread steven mosher
if your data for the rest of the file looks like this then read.fwf will work. depending which vars you want to pull) widths= c(18,32,41) E-CBIL-28-raw-cel-1435145228.cel1 would pull 3 vars, E-CBIL-28-raw-cel-; 1435145228.cel;1 widths <-c(32,41) E-CBIL-28-raw-cel-1435145228.cel;1 you

[R] Beginner question on bar plot

2010-10-15 Thread steven mosher
I've read a number of examples on doing a multiple bar plot, but cant seem to grasp how they work or how to get my data into the proper form. I have two variable holding the same factor The variables were created using a cut command, The following simulates that A <- 1:100 B <- 1:100 A[30:60]

[R] Overlaying two png?

2010-10-15 Thread steven mosher
I have a program that creates a Png file using Rgooglemap with an extent (lonmin,lonmax,latmin,latmax) I also have a contour plot of the same location, same extent, same sized (height/width) png file. I'm looking for a way to make the contour semi transparent and overlay it on the google map ( hyb

Re: [R] Read from a website

2010-10-12 Thread steven mosher
Hmm, RCurl might have something on this. otherwise pull you can figure out their scheme and just construct the url from scratch. when you finish filling in the form, look at the url they construct. do it a few times and you can just emulate that. I've done that in the past without problems. depe

Re: [R] Loss of precision in read.csv.

2010-10-09 Thread steven mosher
tual storage. > > Cheers, > > Josh > > On Sat, Oct 9, 2010 at 1:33 PM, steven mosher > wrote: > > Given a csv file from this location > > > > Airports<-"http://www.ourairports.com/data/airports.csv"; > > > > download.file(Airports,base

[R] Loss of precision in read.csv.

2010-10-09 Thread steven mosher
Given a csv file from this location Airports<-"http://www.ourairports.com/data/airports.csv"; download.file(Airports,basename(Airports)) airports <-read.csv("airports.csv",encoding="UTF-8") > airports[1,] id ident type name latitude_deg longitude_deg elevation_ft continen

Re: [R] RE : R getting slower until it breaks...

2010-10-06 Thread steven mosher
Thanks, haven't used valgrind in years, this should be fun. Steve On Wed, Oct 6, 2010 at 1:55 PM, Ben Bolker wrote: > steven mosher gmail.com> writes: > > > > > I know its no consolation, but I have a similar issue with R on a MAC, > also > > ploting >

Re: [R] RE : R getting slower until it breaks...

2010-10-06 Thread steven mosher
I know its no consolation, but I have a similar issue with R on a MAC, also ploting out large numbers of raster layers. sometimes the problem lingers even after I clear the workspace, do gc() etc. Almost as if R wont ask for processor resources. weird. On Wed, Oct 6, 2010 at 12:06 PM, Bastien F

Re: [R] Script auto-detecting its own path

2010-10-04 Thread steven mosher
in the package R.utils getAbsolutePath() or you can do a file.list(.. full.names=TRUE, recursive=TRUE,pattern="(.R)") the rest will require grep and pulling the file name and directory path apart If its not evident just ask and I'll write something for you. basically you want a call t

Re: [R] get absolute file path

2010-09-26 Thread steven mosher
The package R.utils has a function to get absolutepath On Sun, Sep 26, 2010 at 1:00 AM, Sebastian Gibb wrote: > Hello, > > I get a value which stores a relative file name. (I get it from another > function, which I don't want to change.) > e.g. > > fileName <- "../data/2010-08.csv"; > > Is it pos

Re: [R] diagnosing download.file() problems

2010-09-21 Thread steven mosher
had taken crazy pills. i did note, however, some odd behavior with tryCatch, where statements after the "finally={} were executed. Not sure if that deserves a bug report. On Tue, Sep 21, 2010 at 2:33 AM, Barry Rowlingson < b.rowling...@lancaster.ac.uk> wrote: > On Tue, Sep 21, 2

[R] diagnosing download.file() problems

2010-09-21 Thread steven mosher
I'm accessing around 95 tar files on an FTP server ranging in size between 10 and 40MB a piece. while certainly can click on them and download them outside of R, I'd like to have my script do it. Retrieving the ftp directory with RCurl works fine (about 90% of the time) but downloading the files

Re: [R] Substitute NAs by zero

2010-09-20 Thread steven mosher
> v<-c(1,2,3,4,5,6,7,8,97,6,5,4,NA,NA) > b<-zoo(v) > b 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 7 8 97 6 5 4 NA NA > b[is.na(b)]<-0 > b 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3 4 5 6 7 8 97 6 5 4 0 0 > is.zoo(b) [1] TRUE On Mon, Sep 20, 2010 at 2:37 AM

Re: [R] How to uncompress a gz file in R

2010-09-16 Thread steven mosher
you are welcome. Henrik's package is an great piece of work. It is worth the time to read through the whole thing and see how you can improve your programs by using other features as well. On Thu, Sep 16, 2010 at 2:16 AM, Wonsang You wrote: > Dear Henrik and Steven, > > Thank you for your kind

Re: [R] Get File Names in Folder, Read Files, Update, and Write

2010-09-15 Thread steven mosher
pany Limited > Tel: +662-305-9179 > Email: supha...@phatrasecurities.com > > *From:* steven mosher [mailto:mosherste...@gmail.com] > *Sent:* Thursday, September 16, 2010 2:29 AM > *To:* Suphajak Ngamlak > *Subject:* Re: [R] Get File Names in Folder, Read Files, Update, and Write >

Re: [R] How to uncompress a gz file in R

2010-09-15 Thread steven mosher
Wongsang, Just to be clear R.utils is different than "utils" As Henrik notes gunzip has been in R.utils ( see http://cran.r-project.org/) for some time. It works like a champ. R.utils is a great package. On Wed, Sep 15, 2010 at 9:30 AM, Wonsang You wrote: > Dear Henrik, > > Thank you so mu

Re: [R] If then else with command for

2010-09-14 Thread steven mosher
not sure how you wanted sampling of x R<-142 color<-rep(0,142) for(i in 1:R){ y<-sample(x,142,replace=FALSE) onebit<- as.numeric(3471 %in% y) twobit<-as.numeric(6720 %in% y)*2 fourbit<-as.numeric(6263 %in% y)*4 colorbit<-onebit+twobit+fourbit+1 color[i]<-colorbit } On Tue, Sep 14, 2010

Re: [R] merging two maxtrices

2010-09-05 Thread steven mosher
A NA NA NA NANA > 8 49 14 19 24 29 34 39 4449 > 9NA NA NA NA NA NA NA NA NANA > 105 10 15 20 25 30 35 40 4550 > > > > > > -----Original Message- > From: r-help-boun...@r-project.o

Re: [R] merging two maxtrices

2010-09-05 Thread steven mosher
34 39 4449 > 9NA NA NA NA NA NA NA NA NANA > 105 10 15 20 25 30 35 40 4550 > > > > > > -----Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of steven mo

[R] merging two maxtrices

2010-09-05 Thread steven mosher
j<-matrix(nrow=10,ncol=10) k<-matrix(seq(1:50), ncol=10) row.names(k) <- seq(2,10,by=2) j [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] NA NA NA NA NA NA NA NA NANA [2,] NA NA NA NA NA NA NA NA NANA [3,] NA NA NA NA NA

[R] differecing a zoo series

2010-08-20 Thread steven mosher
A quick question x <- as.yearmon(2000 + seq(0, 23)/12) x [1] "Jan 2000" "Feb 2000" "Mar 2000" "Apr 2000" "May 2000" "Jun 2000" "Jul 2000" "Aug 2000" "Sep 2000" "Oct 2000" "Nov 2000" "Dec 2000" "Jan 2001" [14] "Feb 2001" "Mar 2001" "Apr 2001" "May 2001" "Jun 2001" "Jul 2001" "Aug 2001" "Sep 2001

Re: [R] Trouble loading "saved" Rdata

2010-08-15 Thread steven mosher
() >>>> >>> R version 2.11.1 (2010-05-31) >>> x86_64-pc-mingw32 >>> >>> locale: >>> [1] LC_COLLATE=English_United States.1252 >>> [2] LC_CTYPE=English_United States.1252 >>> [3] LC_MONETARY=English_United States.1252 &g

Re: [R] Trouble loading "saved" Rdata

2010-08-15 Thread steven mosher
; > Josh > > On Sun, Aug 15, 2010 at 12:06 AM, steven mosher > wrote: > > Did you exit R and then return? > > fname<-"test.Rdata" > > full<-file.path("Example",fname,fsep=.Platform$file.sep) > > full > > [1] "Example/t

Re: [R] Trouble loading "saved" Rdata

2010-08-15 Thread steven mosher
; [5] LC_TIME=English_United States.1252 > > If correcting the quoting does not help you, perhaps you can report > the results of sessionInfo() > > Cheers, > > Josh > > On Sat, Aug 14, 2010 at 5:14 PM, steven mosher > wrote: > > In the particular application I ha

Re: [R] Trouble loading "saved" Rdata

2010-08-14 Thread steven mosher
rt > the results of sessionInfo() > > Cheers, > > Josh > > On Sat, Aug 14, 2010 at 5:14 PM, steven mosher > wrote: > > In the particular application I have I save "test.Rdata" to a sub > directory > > dir<-"Example" > > dir.creat

[R] Trouble loading "saved" Rdata

2010-08-14 Thread steven mosher
In the particular application I have I save "test.Rdata" to a sub directory dir<-"Example" dir.create(dir) test<-data.frame(a=c(1,2,3),b=c(3,4,5) full<-file.path(dir,"test.Rdata,fsep=.Platform$file.sep) save(test,file=full) load(full) returns NULL it works fine when the object is saved to the wor

Re: [R] Creating list from a long vector

2010-08-14 Thread steven mosher
Thx, I see my problem. more sleep required On Sat, Aug 14, 2010 at 9:25 AM, Romain Francois wrote: > > Le 14/08/10 18:22, steven mosher a écrit : > > >> Stupid question, but its been a long night. >> >> If I have a long vector how can I turn it into a list of th

[R] Creating list from a long vector

2010-08-14 Thread steven mosher
Stupid question, but its been a long night. If I have a long vector how can I turn it into a list of the same length x<-rep(seq(1,100,by=1),each=10) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] Sweeping a zoo series

2010-08-11 Thread steven mosher
, 2010 at 11:21 AM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > On Wed, Aug 11, 2010 at 12:22 PM, steven mosher > wrote: > > Given a long zoo matrix, the goal is to "sweep" out a statistic from the > > entire length of the > > sequences. > >

[R] Sweeping a zoo series

2010-08-11 Thread steven mosher
Given a long zoo matrix, the goal is to "sweep" out a statistic from the entire length of the sequences. longzoomatrix<-zoo(matrix(rnorm(720),ncol=6),as.yearmon(outer(1900,seq(0,length=120)/12,"+"))) cnames<-c(12345,23456,34567,45678,56789,67890) colnames(longzoomatrix)<-cnames longzoomatrix[

[R] sweep and zoo objects

2010-08-10 Thread steven mosher
rc<-list(c( 123,321,234,543,654,768,986,987,246,284),c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")) # the matrix has rownames that are used as identifiers and columns # of time. 1 years worth of data. Thats the native format test<-matrix(seq(1,120, by=1), nrow=10,dim

Re: [R] nested 'by'

2010-08-09 Thread steven mosher
That works. Thanks On Mon, Aug 9, 2010 at 7:55 AM, Henrique Dallazuanna wrote: > Try this: > > aggregate(example[c('x', 'y')], example[c('id', 'Year')], 'mean') > > > On Mon, Aug 9, 2010 at 11:46 AM, steven mosher wrote

[R] nested 'by'

2010-08-09 Thread steven mosher
Assuming a data frame or matrix with two columns representing variable that you want to aggregate over. you want to calculate column means, by year, for each Id example<-data.frame(id=c(rep(12345,5),rep(54321,6),rep(45678,7)),Year=rep(seq(1900,1902,by=1),6), x=seq(1,18,by=1),y=seq(18,1,by=-1))

  1   2   >