Re: [R] function pointers?

2017-11-23 Thread jim holtman
{ + closureList[[i]] <- list(func = rnorm, n = nsize[i]) + } > format(object.size(closureList), units = "Mb") [1] "22.4 Mb" > pryr::compare_size(closureList) base pryr 23520040 2241776 You will notice that you get back a size that is 10X smaller because it is

Re: [R] dplyr - add/expand rows

2017-11-26 Thread jim holtman
ot;QMM", "07EA001" ,1972 , 1976 , "QMC", "07EA001" ,1977 , 1983 , "QRC" ) result <- input %>% rowwise() %>% do(tibble(station = .$station, year = seq(.$from, .$to), record = .$record) ) ###

Re: [R] request for code

2018-01-18 Thread jim holtman
a simple Google search turns up several possible choices. There is a package 'matconv' that might serve your purposes. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Jan 18, 2018 at 7:49

Re: [R] how to write a loop to repetitive jobs

2018-04-18 Thread jim holtman
ot;) , head=TRUE ) input$id <- paste0("sn", x) input # return the input }) result <- do.call(rbind, result) # combine dataframes together ​ Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how

Re: [R] Split a data.frame

2018-05-19 Thread jim holtman
ork. offsets <- match(split_str, DF$name) # Since you only want the rows in between DF[diff(offsets), ] ## name val ## 2v 0 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sat, May 19, 2018

Re: [R] Split a data.frame

2018-05-19 Thread jim holtman
;- NULL for (i in seq_len(length(offsets) - 1)){ if (offsets[i + 1] - offsets[i] > 1){ # something inbetween ret_indx <- c(ret_indx, (offsets[i] + 1):(offsets[i+1] - 1)) } } DF[ret_indx, ] ## name val ## 3v 0 ## 4z 0 Jim Holtman Data Munger Guru What is the problem that y

Re: [R] Convert daily data to weekly data

2018-05-29 Thread jim holtman
) %>% + summarise(avg = mean(value)) > avg # A tibble: 6 x 3 # Groups: ID [?] ID week avg 1 11. 16.0 2 21. 16.0 3 3 1. 17.9 4 41. 16.0 5 51. 17.9 6 61. 16.0 > Jim Holtman Data Munger Guru What is the problem that you

Re: [R] Convert daily data to weekly data

2018-05-29 Thread jim holtman
ng$date) > # average by ID/week > avg <- x_long %>% + group_by(ID, year, week) %>% + summarise(avg = mean(value)) > avg # A tibble: 6 x 4 # Groups: ID, year [?] ID year week avg 1 1 1986.1. 16.0 2 2 1986.1. 16.0 3 3 1986.1. 17.9 4

Re: [R] values of list of variable names

2018-06-01 Thread jim holtman
You probably want to use 'get': > r1 <- 5 > r2 <- 3 > r3 <- 45 > x <- ls(pattern = '^r.$') > x [1] "r1" "r2" "r3" > lapply(x, get) [[1]] [1] 5 [[2]] [1] 3 [[3]] [1] 45 > Jim Holtman Data Munger Guru What is

Re: [R] taking a small piece of large tiff

2017-04-04 Thread jim holtman
How big is 'large'? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Apr 4, 2017 at 7:47 AM, Louisa Reynolds via R-help wrote: > Dear Forum > I am trying to cut out a small section o

Re: [R] taking a small piece of large tiff

2017-04-05 Thread jim holtman
if you have 8GB of memory it should be easy to handle. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Apr 5, 2017 at 3:23 AM, Louisa Reynolds wrote: > Ok. I have a tiff of size over 2GB. It cov

Re: [R] help on readBin in R

2017-04-16 Thread jim holtman
75005b43 040 o n t e n t _ T y p e s ] . x m 6f6e74656e745f54797065735d2e786d Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Apr 16

Re: [R] Return value from function with For loop

2017-04-16 Thread jim holtman
> xx <- function(n) n+1 > print(xx(3)) [1] 4 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Apr 16, 2017 at 10:26 PM, Ramnik Bansal wrote: > In the code below > > >

Re: [R] Joining tables with different order and matched values

2017-05-14 Thread jim holtman
(input, 1, function(x){ + toString(intersect(str_extract_all(x[1], "[^,]")[[1]], + str_extract_all(x[2], "[^,]")[[1]] + )) + }) > > input A B shared values 1 1,2,5 3,8,7 2 2,4,6 7,6,3 6 Jim Holtman Data Munger Guru Wha

Re: [R] reading data

2017-06-13 Thread jim holtman
You need to provide reproducible data. What does the file contain? Why are you using 'sep=' when reading fixed format. You might be able to attach the '.txt' to your email to help with the problem. Also you did not state what the differences that you are seeing. So hel

Re: [R] Extraneous full stop in csv read

2017-06-28 Thread jim holtman
895 1895 1895 1895 1895 1895 1895 ... $ mo : int 1 2 3 4 5 6 7 8 9 10 ... $ Data: int 8243 2265 2340 1014 1281 58 156 140 1087 322 ... $ in : num 8.24 2.27 2.34 1.01 1.28 ... Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how y

Re: [R] Extraneous full stop in csv read

2017-06-28 Thread jim holtman
$ mo : int 1 2 3 4 5 6 7 8 9 10 ... $ Data: int 8243 2265 2340 1014 1281 58 156 140 1087 322 ... $ in : num 8.24 2.27 2.34 1.01 1.28 ... Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Jun 28,

Re: [R] Importing Big data to R

2017-07-12 Thread jim holtman
columns did the data have. How big was the file on disk. What other objects were in memory at the same time. The list can go on and on, so more information would be useful to understand the problem. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what

Re: [R] Has For bucle be impooved in R

2017-08-07 Thread jim holtman
x27; loop that account for the differences. I have attached the output of the profiler. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Aug 7, 2017 at 10:57 AM, Thierry Onkelinx wrote: > Dear Jesus, &g

Re: [R] Merge by Range in R

2017-09-04 Thread jim holtman
Have you tried 'foverlaps' in the data.table package? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Sep 4, 2017 at 8:31 AM, Mohammad Tanvir Ahamed via R-help < r-help@r-project.org&

Re: [R] Calculating Weeks Since Last Event

2017-09-15 Thread jim holtman
flag[indx] <- NA x$flag <- zoo::na.locf(x$flag) # determine weeks since x$weeks_since <- ifelse(x$count != 0, x$count - x$flag + 1, 0 ) x # print out the result ## Jim Holtman Data Munger Guru What is the problem that you are trying to

Re: [R] dealing with a messy dataset

2017-10-05 Thread jim holtman
0 -5.8 27.1 5.26 5.70 NA -182 2.4 # ... with 3 more variables: X15 , X16 , X17 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Oct 5, 2017 at 10:12 AM, jean-philippe wrote: > dear R-

Re: [R] dealing with a messy dataset

2017-10-05 Thread jim holtman
You should be able to use that header information to create the correct parameters to the read_fwf function to read in the data. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Oct 5, 2017 at 11:02

Re: [R] Merging 2 files with different timestamp

2016-05-22 Thread jim holtman
s.POSIXct('2012-12-27 2330', format = "%Y-%m-%d %H%M") > > # now convert to a common character format for merging > date1_new <- format(date1, "%Y%m%d%H%M%S") > date2_new <- format(date2, "%Y%m%d%H%M%S") > date1_new [1] "2012122723300

Re: [R] if else condition - help

2016-05-22 Thread jim holtman
f 2 ..$ : chr [1:4] "A" "B" "C" "D" ..$ : chr [1:4] "C1" "C2" "C3" "C4" > x C1 C2 C3 C4 A 0 0 0 0 B 1 0 0 0 C 0 -1 0 0 D -1 1 -1 -1 > Jim Holtman Data Munger Guru What is the problem that

Re: [R] read multiple sheets of excel data into R

2016-05-28 Thread jim holtman
Try the 'openxlsx' package. I gave up using XLConnect because of the Java requirement, and speed on larger tables. "openxlsx" has the access routines written in C so you don't need any other outside dependencies. Jim Holtman Data Munger Guru What is the problem tha

Re: [R] merging dataframes in a list

2016-06-04 Thread jim holtman
es tidyr 'spread' Source: local data frame [2 x 3] name green red (chr) (dbl) (dbl) 1 sample11520 2 sample23010 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, J

Re: [R] String match

2016-06-04 Thread jim holtman
uot;volume", "close") > > # create pattern match > pat <- paste(WhatToLook, collapse = "|") > grep(pat, WhereToLook) [1] 4 5 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On

Re: [R] better loop for simulation

2016-06-18 Thread jim holtman
0000 9 | 10 | 0 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sat, Jun 18, 2016 at 6:12 PM, Naresh Gurbuxani < naresh_gurbux...@hotmail.com> wrote: &

Re: [R] Merging Issue

2016-06-18 Thread jim holtman
df2<-data.frame(loc, grp, deps ) > dat<-merge(df, df2, by="deps") > > dat deps Subject dates loc grp 1 A 2 2011-01-01 CA DE 2 A 2 2011-01-01 yy xx 3 A 3 2011-01-06 CA DE 4 A 3 2011-01-06 yy xx 5 A 5 2011-01-11

Re: [R] How to do it in R

2016-06-24 Thread jim holtman
pretty simple: > t_m <- 28e3 > t_b <- 710e3 > ratio <- t_m / (t_m + t_b) * 100 > ratio [1] 3.794038 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Jun 24, 2016 at 12:05 PM, An

Re: [R] Difficulty subsetting data frames using logical operators

2016-07-01 Thread jim holtman
You may need to re-read the Intro to R. data[data$Ozone > 31,] or subset(data, Ozone > 31) Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Jul 1, 2016 at 5:11 AM, Giles Bischoff wrote: &

Re: [R] means by year, month and day

2016-07-17 Thread jim holtman
1 4.5 269.7 6.45 7.21 1026.81 3.86 -3.6 3 2015 3 1 4.5 269.7 6.45 7.21 1026.81 3.86 -3.6 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Jul 17, 2016 at 5:42 PM, Jianlin

Re: [R] about file name

2016-07-28 Thread jim holtman
just strip off the first character: > a [1] "X35.84375_.100.71875" > a.new <- sub("^.", '', a) > a.new [1] "35.84375_.100.71875" > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do

Re: [R] about file name

2016-07-28 Thread jim holtman
add another step: (need to learn about regular expressions) > a [1] "X35.84375_.100.71875" > a.new <- sub("^.", '', a) > a.new [1] "35.84375_.100.71875" > sub("_.", "_-", a.new) [1] "35.84375_-100.71875" >

Re: [R] Subtraction with aggregate

2016-07-28 Thread jim holtman
> > agg # A tibble: 3 x 3 subject QM yi 1 s1 46.1558 -90.04829 2 s2 -50.2313 -180.33473 3 s3 -50.9669 -136.08716 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to

Re: [R] Subtraction with aggregate

2016-07-28 Thread jim holtman
) > > > agg # A tibble: 3 x 3 subject QMyi 1 s1 57.8918 28.240036 2 s2 5.7602 4.077484 3 s3 -35.8694 2.666504 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to

Re: [R] Strange message after reading multiple scripts from one folder

2016-07-29 Thread jim holtman
s to see if anything refers to either "value" or "visible", and then you might find the cause of your problem. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Jul 29, 2016 at 6:52

Re: [R] Conditionally remove rows with logic

2016-08-10 Thread jim holtman
L == 1) + if (length(indx) == 1) .id <- .id[1:indx, ] # keep upto the '1' + .id + }) + ) > > > result ID TIME LABEL 1.1 10 0 1.2 13 0 1.3 16 0 1.4 19 0 1.5 1 12 1 2.8 20 0 2.9 23 0 2

Re: [R] read.xlsx function crashing R Studio

2016-08-22 Thread jim holtman
try the openxlsx package Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Aug 21, 2016 at 1:30 PM, Kevin Kowitski wrote: > Hey everyone, > >I have used read.xlsx in the past ra

Re: [R] parsing a complex file

2016-08-27 Thread jim holtman
It is not clear as to how you want to parse the file. You need to at least provide an example of what you expect from the output. You mention " the detail which begins with 2 at byte location 1 to another file"; I don't see the '2' at byte location 1. Jim Holtman Data

Re: [R] parsing the file

2016-08-28 Thread jim holtman
Here is an attempt at parsing the data. It is fixed field so the regular expression will extract the data. Some does not seem to make sense since it has curly brackets in the data. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not

Re: [R] gsub: replacing slashes in a string

2016-09-14 Thread jim holtman
try this: > gsub("", "/", test) [1] "8/24/2016" "8/24/2016" "6/16/2016" "6/16/2016" Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. O

Re: [R] Accelerating binRead

2016-09-17 Thread jim holtman
Your example was not reproducible. Also how do you "break" out of the "while" loop? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sat, Sep 17, 2016 at 8:05 AM, Philippe de Rochamb

Re: [R] Accelerating binRead

2016-09-17 Thread jim holtman
I would also suggest that you take a look at the 'pack' package which can convert the binary input to the value you want. Part of your performance problems might be all the short reads that you are doing. Jim Holtman Data Munger Guru What is the problem that you are trying to solv

Re: [R] Accelerating binRead

2016-09-17 Thread jim holtman
rite reals close(output) library(pack) library(readr) # read all the data at once allbin <- read_file_raw('integer.bin') # decode the data into a list (result <- unpack("V V V V V V V V V V d d d d d d d d d d", allbin)) Jim Holtman Data Munger Guru What is the probl

Re: [R] how to remove all messages when loading a library ?

2016-09-25 Thread jim holtman
quot;,quietly=TRUE)) suppressMessages(install.packages("xlsx",quietly=TRUE)) if (!require("ROracle",quietly=TRUE)) suppressMessages(install.packages("T:/CH/R/ROracle_1.2-2.zip", repos = NULL, type = "source",quietly=TRUE)) }) Jim Holtman Data Munger Guru What

Re: [R] Writing data onto xlsx file without cell formatting

2016-09-26 Thread jim holtman
I use the "openxlsx" package to handle spreadsheets. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Sep 26, 2016 at 5:56 PM, Christofer Bogaso < bogaso.christo...@gmail.com> wr

Re: [R] select portion of text file using R

2015-04-27 Thread jim holtman
7;) Well Cycle Target Name Rn 1 NA 1 1 Adeno 1 0.82 2 NA 1 2 Adeno 1 0.93 3 NA 2 1 Adeno 2 0.78 > > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon,

Re: [R] more complex by with data.table???

2015-06-09 Thread jim holtman
28 48 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Jun 9, 2015 at 4:22 PM, Ramiro Barrantes < ram...@precisionbioassay.com> wrote: > Hello, > > I am trying to do something that I

Re: [R] Symbols to data set

2015-06-10 Thread jim holtman
Dollars) > x place Rupees Percentage Dollars 1 India 120,00052% $48 2 USA 78,00056% $40 3UK 60,00050% $56 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do

Re: [R] matrix/df help populate NA

2015-06-14 Thread jim holtman
row.names = c(NA, + -2L)) > > # determine what the missing columns are and then add them to x2 > missing <- setdiff(colnames(x1), colnames(x2)) > > new_x2 <- x2 > > for (i in missing) new_x2[[i]] <- NA > > new_x2 Subject AD FH B C 1 x1 4.3 -2

Re: [R] Scatterplot : smoothing colors according to density of points

2015-06-14 Thread jim holtman
check out the 'hexbin' package for making scatter plots that have a lot of points overlapping in a small area. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Jun 2, 2015 at 9:51 AM, A

Re: [R] reading daily snow depth data

2015-06-16 Thread jim holtman
V5) # tally up the states AK AL AR AZ CA CO CT DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT 72 18 65 55 99 128 10 1 30 33 6 112 57 103 85 90 49 29 35 14 40 86 90 124 27 113 NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX

Re: [R] Extracting data from a file containing data

2015-06-25 Thread jim holtman
What happened to September? Just disregard? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Jun 25, 2015 at 11:40 AM, Peter Tuju wrote: > I have the data as attached. For each nino region, I w

Re: [R] Extracting data from a file containing data

2015-06-25 Thread jim holtman
F 1984 24.68000 -0.585 25.52000 -0.480 27.44500 -0.755 26.01500 -0.630 10MAM 1984 24.79667 -0.600 26.97333 -0.267 27.62000 -0.873 27.21333 -0.403 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not

Re: [R] Extracting data from a file containing data

2015-07-01 Thread jim holtman
MEME ML Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Jun 26, 2015 at 5:27 AM, Peter Tuju wrote: > Dear Jim Holtman, > > Thank you very much for your help. > &g

Re: [R] question

2015-07-01 Thread jim holtman
You never said how you wanted to save the data, so I will choose to use 'saveRDS' which should handle most anything. for (i in name_file$names){ saveRDS(prep(z, i), file = paste0(i, '.RDS')) } Jim Holtman Data Munger Guru What is the problem that you are trying to sol

Re: [R] question

2015-07-01 Thread jim holtman
= paste0(.file, '.RDS')) result # return value that goes in the list }) Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Jul 1, 2015 at 9:00 PM, jim holtman wrote: > You never said h

Re: [R] : Ramanujan and the accuracy of floating point computations - using Rmpfr in R

2015-07-02 Thread jim holtman
This is the standard FAQ 7.31 and then read in detail the referenced paper. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Jul 2, 2015 at 2:02 PM, Aditya Singh via R-help < r-help@r-project.

Re: [R] igraph plot slowness

2015-07-03 Thread jim holtman
0.000.16 The PDF file is attached. So maybe it is something with your remote connection. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Jul 3, 2015 at 3:21 AM, Loris Bennett wrote: > Hi

Re: [R] Parsing large amounts of csv data with limited RAM

2015-07-14 Thread jim holtman
take a look at the sqldf package because it has the ability to load a csv file to a database from which you can then process the data in pieces Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Jul 14

Re: [R] convert character vector to decimal for numeric testing

2015-07-15 Thread jim holtman
; > BTW you are converting your numeric vector back to character with statements like: if(vec.num[i] < 0) { vec.num[i] <- "LO" What is the problem you are trying to solve? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you

Re: [R] Speeding up code?

2015-07-16 Thread jim holtman
stringsAsFactors = FALSE) > print(proc.time() + + ) user system elapsed 20.905.36 596.57 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Jul 16, 2015 at 7:56 AM, Ignacio Martinez wrote

Re: [R] Speeding up code?

2015-07-16 Thread jim holtman
t;- as.data.frame((xm), stringsAsFactors = FALSE) Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Jul 16, 2015 at 1:37 PM, jim holtman wrote: > Here is one improvement. Avoid dataframes in some of these

Re: [R] Read ".xlsx" and convert date-column value into Dataframe

2015-07-22 Thread jim holtman
forgot the reply to all: These are serial dates within EXCEL. Here is a way of converting them: > as.Date(c(42460, 42426), origin = '1899-12-30') [1] "2016-03-31" "2016-02-26" Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tel

Re: [R] setwd() command on windows vs. linux/unix

2015-07-27 Thread jim holtman
Try 'choose.dir()' to see if you can navigate to the given directory, or take baby steps by doing one directory at a time. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Jul 27, 2015

Re: [R] R parallel - slow speed

2015-07-30 Thread jim holtman
time being spent. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Thu, Jul 30, 2015 at 8:56 AM, Jeff Newmiller wrote: > Parallelizing comes at a price... and there is no guarantee that you ca

Re: [R] R parallel / foreach - aggregation of results

2015-07-31 Thread jim holtman
y(np) datj <- data[j] for(k in j:n1) { L2distance[j,k] <- k*datj } L2distance # return the value } stopCluster(cl) return(x) } Res <- Simpar3(100) Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, n

Re: [R] R parallel / foreach - aggregation of results

2015-08-01 Thread jim holtman
which one you want to process. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sat, Aug 1, 2015 at 3:19 PM, Martin Spindler wrote: > Dear Jim, > > Thank you very much for your response. It see

Re: [R] date time problem

2014-12-07 Thread jim holtman
I would use the 'lubridate' package for this: > z <- Sys.time() > z [1] "2014-12-07 15:43:50 EST" > require(lubridate) > with_tz(z, "UTC") [1] "2014-12-07 20:43:50 UTC" Jim Holtman Data Munger Guru What is the

Re: [R] Working with data frames

2014-12-11 Thread jim holtman
If you are using 'read.csv' (or 'read.table') to input, then use the 'as.is = TRUE' parameter to prevent the conversion to factors of the data. You can also do "as.character(df$col_with_factors)" to get the character values back. Jim Holtman Data Munge

Re: [R] Create previous dates from date with consideration of leap year

2014-12-11 Thread jim holtman
EST" "2005-02-11 EST" "2005-02-10 EST" "2005-02-09 EST" [[3]] [1] "2002-05-29 EDT" "2002-05-28 EDT" "2002-05-27 EDT" "2002-05-26 EDT" "2002-05-25 EDT" [[4]] [1] "2005-09-22 EDT" "2005-09-21 EDT" &q

Re: [R] Moving average

2014-12-28 Thread jim holtman
ncy = 1 [1] 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 10.5 11.5 12.5 13.5 14.5 15.5 16.5 17.5 18.5 19.5 NA > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Dec 28, 2014 at 6:56 AM, Rolf E

Re: [R] Moving average

2014-12-30 Thread jim holtman
Close two_day 4 2014-12-22 158.33 161.91 158.33 161.44 4682500161.44 161.84 3 2014-12-23 162.23 162.90 161.61 162.24 4043300162.24 162.03 2 2014-12-24 162.88 162.99 161.61 161.82 1868100161.82 162.08 1 2014-12-26 162.27 163.09 162.01 162.34 1912200162.34 NA Jim Holtman Da

Re: [R] counting sets of consecutive integers in a vector

2015-01-04 Thread jim holtman
4 225 1 3 30 4 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Jan 4, 2015 at 8:27 PM, Peter Alspach < peter.alsp...@plantandfood.co.nz> wrote: > Tena koe Mike > > An

Re: [R] counting sets of consecutive integers in a vector

2015-01-04 Thread jim holtman
2 2: 5 4 3:25 1 4:30 4 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sun, Jan 4, 2015 at 7:03 PM, Mike Miller wrote: > I have a vector of sorted positive integer values

Re: [R] Reading large data matrix in R

2015-01-09 Thread jim holtman
help to determine how you might want to read it. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Jan 9, 2015 at 9:44 AM, Madhavan BL wrote: > Dear All, > > Greetings. I am a new user of R pr

Re: [R] Reading *.nc4 data

2015-01-26 Thread jim holtman
The message seems to be clear in that either the directory or file is not where you think it is. Use 'choose.files()' to navigate to the file and see what it prints out as the location. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you

Re: [R] Melt and Rbind/Rbindlist

2015-01-31 Thread jim holtman
onth <- as.numeric(substr(tmp2$variable,7,8)) tmp2$day <- as.numeric(substr(tmp2$variable,10,11)) tmp2 # return value }) bigDT <- rbindlist(myDTs) # rbind all the data.tables together # then you should be able to do: mean.temp <- bigDT[, list(temp.mean=lapply(.SD, mean),

Re: [R] Error: OutOfMemoryError (Java): GC overhead limit exceeded

2015-02-02 Thread jim holtman
x27; workbooks take a lot more resources (CPU and memory) to process. A little more information like what your sessionInfo is would help a lot in responding to your problem. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do

Re: [R] Error: OutOfMemoryError (Java): GC overhead limit exceeded

2015-02-02 Thread jim holtman
How big are the worksheets that you are reading in? Do you have multiple ones open at the same time? Have to tried to use 'xlcFreeMemory' to see if this helps? How much RAM to you have on your system? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Te

Re: [R] Still trying to avoid loops

2015-02-04 Thread jim holtman
_along) > dat S D visit 1 a 5 1 2 a 1 2 3 b 3 1 4 c 2 1 5 c 3 2 6 c 4 3 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Feb 4, 2015 at 3:08 PM, Tom Wright wrote: >

Re: [R] How to download and unzip data in a loop

2015-02-05 Thread jim holtman
try taking the quotes off of 'files' Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Feb 4, 2015 at 5:24 PM, Alexandra Catena wrote: > Hi All, > > I need to loop through and d

Re: [R] Error: OutOfMemoryError (Java): GC overhead limit exceeded

2015-02-10 Thread jim holtman
Another to try is the 'openxlsx' package if you have '.xlsx' files; it does not read '.xls' files. It seems to be faster than XLConnect and does not require Java; it uses Rcpp to access the APIs. Jim Holtman Data Munger Guru What is the problem that you are try

Re: [R] list of list

2015-02-16 Thread jim holtman
Is this what you mean: ASL <- list() for (j in 1:5){ RES <- list() for (i in 1:5) RES[[i]] <- i ^ j # create list ASL[[j]] <- RES # store 'list of list' } Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want t

Re: [R] view large tables

2015-02-17 Thread jim holtman
What is 'large'? have you tried 'View'? Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Feb 17, 2015 at 4:52 AM, carol white via R-help < r-help@r-project.org> wrote: >

Re: [R] irregular sequence of events

2015-02-20 Thread jim holtman
A2 14 14 A2 15 15 A2 16 16 A2 17 17 18 18 19 19 20 20 21 21 A3 22 22 A3 23 23 A3 24 24 A3 25 25 A3 26 26 A3 27 27 A3 28 28 29 29 30 30 > > > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell m

Re: [R] How do I access a specific element of a multi-dimensional list

2015-02-20 Thread jim holtman
try this: > a = c(2, 3, 5) > b = c("aa", "bb", "cc") > c = c(TRUE, FALSE, TRUE) > > x = list(a, b, c) > x [[1]] [1] 2 3 5 [[2]] [1] "aa" "bb" "cc" [[3]] [1] TRUE FALSE TRUE > sapply(x, '[[', 1) [1] &q

Re: [R] irregular sequence of events

2015-02-20 Thread jim holtman
21 21 A3 22 22 A3 23 23 A3 24 24 A3 25 25 A3 26 26 A3 27 27 A3 28 28 29 29 30 30 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Feb 20, 2015 at 9:27 AM, PIKAL

Re: [R] help

2015-02-24 Thread jim holtman
e pairings # now the loop for the plots for (col in seq(ncol(pairs))){ dotPlot(Seq1[[pairs[1, col]]], Seq1[[pairs[2, col]]]) } Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Feb 24, 2015 at 10:3

Re: [R] covert entire dataset to numeric while persuing percentage values

2015-02-26 Thread jim holtman
x27;12%', '6%', '3.75%') > # convert to a number > as.numeric(gsub("%", "", x)) / 100 [1] 0.1200 0.0600 0.0375 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do

Re: [R] Save a list of list and search for values

2015-02-26 Thread jim holtman
You store it as a list of lists and can then use the lapply function to navigate for values. result <- lapply(1:1, function(x){ mix(param[x]) # whatever your call to 'mix' is with some data }) Jim Holtman Data Munger Guru What is the problem that you are trying to s

Re: [R] Processing key_column, begin_date, end_date in R

2015-02-26 Thread jim holtman
tringsAsFactors = FALSE + ) > result key_column begin_time end_time 1 123456 2013-01-01 2014-07-01 2 789102 2012-03-01 2014-03-01 3 789102 2015-02-01 2016-02-06 > Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you wan

Re: [R] Using a text file as a removeWord dictionary in tm_map

2015-03-01 Thread jim holtman
ge Levels: package > > # now read with 'scan' > scan_words <- scan(text = testFile, what = '', sep = ',') Read 9 items > scan_words [1] "Although" "this" "query""applies" "specifically"

Re: [R] Using a text file as a removeWord dictionary in tm_map

2015-03-03 Thread Jim Holtman
Send me a copy of your file so I can see what it looks like and what the output should be. Sent from my Verizon Wireless 4G LTE Smartphone Original message From: Sun Shine Date:03/03/2015 09:43 (GMT-05:00) To: jim holtman Cc: r-help Subject: Re: [R] Using a text file

Re: [R] Annoyance with %/%

2015-03-11 Thread jim holtman
shouldn't your last expression be: if (any(tst)) big.vector.1[tst] <- big.vector.2[tst] Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Mar 11, 2015 at 11:14 AM, William Dunla

Re: [R] [datatable-help] R beginner

2015-03-15 Thread jim holtman
mir4159689877AF 9 9545878 9896698 4mir1245 11525478AH 11 11458789 11895251 5 mir96 11689689AH 11 11458789 11895251 6 mir145 5890AB 1 4256 8922 7

Re: [R] r help

2015-03-18 Thread jim holtman
642 -0.869 -0.293 0.332 200 [5,] -200 -1.671 -0.827 0.052 0.756 200 Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Mar 18, 2015 at 1:12 PM, thanoon younis wrote: > Dear all members > >

Re: [R] Timestamp of exported files not updated when the file name is overwritten (ggsave)

2015-03-19 Thread jim holtman
times are. Are you looking at the time 'modified' or 'created'; this will make a difference. So a few more particulars about your problem would be helpful. Try running the example for ggsave as I did and see if the times change. Jim Holtman Data Munger Guru What is the proble

  1   2   3   4   5   6   7   8   9   10   >