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

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

[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] 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

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] 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

[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] 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

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. >>

[R] extracting a matched string using regexpr

2010-05-05 Thread steven mosher
Given a text like I want to be able to extract a matched regular expression from a piece of text. this apparently works, but is pretty ugly # some html test<-"88958Abcdsef67.8S68.9\nW26m" # a pattern to extract 5 digits > pattern<-"[0-9]{5}" # regexpr returns a start point[1] and an attribute "ma

Re: [R] extracting a matched string using regexpr

2010-05-05 Thread steven mosher
ng so we get a list one long and we ask for > the contents of the first component using [[1]]. > > # 1 - sub > sub(".*(\\d{5}).*", "\\1", test) > > # 2 - strapply - see http://gsubfn.googlecode.com > library(gsubfn) > strapply(test, "\\d{5}",

Re: [R] extracting a matched string using regexpr

2010-05-05 Thread steven mosher
per string but here > test is just a single string so we get a list one long and we ask for > the contents of the first component using [[1]]. > > # 1 - sub > sub(".*(\\d{5}).*", "\\1", test) > > # 2 - strapply - see http://gsubfn.googlecode.com > library(g

Re: [R] extracting a matched string using regexpr

2010-05-05 Thread steven mosher
<-"88958Abcdsef67.8S68.9\nW26m" > > sub(".*(\\d{5}).*", "\\1", test) > [1] "88958" > > R.version.string > [1] "R version 2.10.1 (2009-12-14)" > > I also got the above in R 2.11.0 patched as well. > > > On Wed, May

Re: [R] extracting a matched string using regexpr

2010-05-05 Thread steven mosher
ults than I expected given that "\\d" should be > synonymous with "[0-9]": > > > > sub(".*([0-9]{5}).*", "\\1", test) > [1] "88958" > > > sub(".*(\\d{5}).*", "\\1", test) > [1] "" >

Re: [R] extracting a matched string using regexpr

2010-05-05 Thread steven mosher
string so we get a list one long and we ask for >> the contents of the first component using [[1]]. >> >> # 1 - sub >> sub(".*(\\d{5}).*", "\\1", test) >> > > test > [1] > "88958Abcdsef67.8S68.9\nW26m" > > I get diff

Re: [R] extracting a matched string using regexpr

2010-05-05 Thread steven mosher
] > "88958Abcdsef67.8S68.9\nW26m" > > R.version.string > [1] "R version 2.9.2 Patched (2009-09-08 r49647)" > > win.version() > [1] "Windows Vista (build 6002) Service Pack 2" > > > On Wed, May 5, 2010 at 6:20 PM, steven mosher > wrote

[R] quick question on getting a listing of files on ftp site

2010-05-22 Thread steven mosher
Given a valid ftp address, is there a package that will allow me to get a listing of the files/directory structure on that site? RCurl looks to have this ability are there others? [[alternative HTML version deleted]] __ R-help@r-project.org mail

[R] quick question on ftp access

2010-05-22 Thread steven mosher
I'm looking for a function or package that will allow me to get a list of the files at an ftp site. RCurl looks promising. Are there other packages that have similar functionality [[alternative HTML version deleted]] __ R-help@r-project.org mail

[R] Matrix to Vector

2010-06-05 Thread steven mosher
Given a matrix of m*n, I want to reorder it as a vector, using a row major transpose. so: > m<-matrix(seq(1,48),nrow=6,byrow=T) > m [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,]12345678 [2,]9 10 11 12 13 14 15 16 [3,] 17 18 19 20 21

Re: [R] Matrix to Vector

2010-06-05 Thread steven mosher
32 33 34 35 36 37 38 39 40 41 42 43 44 45 [46] 46 47 48 On Sat, Jun 5, 2010 at 11:17 AM, Henrique Dallazuanna wrote: > Try this: > > as.vector(t(m)) > > On Sat, Jun 5, 2010 at 3:12 PM, steven mosher wrote: > >> Given a matrix of m*n, I want to reorder it as a v

Re: [R] Matrix to Vector

2010-06-05 Thread steven mosher
I bet that is what I did. On Sat, Jun 5, 2010 at 11:54 AM, John Kane wrote: > m<-matrix(seq(1,48),nrow=6,byrow=T) > as.vector(t(m)) > > gives me the correct result. > > Any chance you may have already transformed m ? > > --- On Sat, 6/5/10, steven mosher wrote

[R] counting Na/not NA by groups by column

2010-06-09 Thread steven mosher
# create a matrix with some random NAs in it > m<-matrix(NA,nrow=15,ncol=14) > m[,3:14]<-52 > m[13,9]<-NA > m[4:7,8]<-NA > m[1:2,5]<-NA > m[,2]<-rep(1800:1804, by=3) > y<-order(m[,2]) > m<-m[y,] > m[,1]<-rep(1:3,by=5) > m [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,

Re: [R] counting Na/not NA by groups by column

2010-06-09 Thread steven mosher
On Wed, Jun 9, 2010 at 6:16 PM, Erik Iverson wrote: > Hello, > > > steven mosher wrote: > >> # create a matrix with some random NAs in it >> >>> m<-matrix(NA,nrow=15,ncol=14) >>> m[,3:14]<-52 >>> m[13,9]<-NA >>> m[4:7,8

[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] 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] 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] 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 >>

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] 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] 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

[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] 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

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] 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] 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

[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] 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

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] 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] 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] 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] 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] 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] 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

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] 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] 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] 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
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] 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] 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] 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] 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] 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 >

[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] 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] 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

<    1   2