[R] Error: missing value where TRUE/FALSE needed

2016-06-08 Thread SHASHI SETH
Hi, I am getting the following error: Error in if ((sum > 0 && sums1 > 0 && sums2 > 0) != NA) { : missing value where TRUE/FALSE needed I have including my code below for your review: fitness_1_data [[alternative HTML version deleted]] __

Re: [R] Tree plot with percentages and hierarchies

2016-06-08 Thread Joonas Isoketo
Hi, super, that was exactly what I needed! Thanks! Best regards, Joonas Isoketo -Alkuperäinen viesti- Lähettäjä: Jim Lemon [mailto:drjimle...@gmail.com] Lähetetty: 9. kesäkuutata 2016 1:40 Kopio: Joonas Isoketo ; r-help@r-project.org Aihe: Re: [R] Tree plot with percentages and hie

Re: [R] Importing data from a text file with no separator

2016-06-08 Thread Adrian Dușa
See: ?read.fwf Example: > ff <- tempfile() > cat(file = ff, "10030614911608", "10030614911608", sep = "\n") > read.fwf(ff, widths = c(2,8,10), colClasses = "character") V1 V2 V3 1 10 03061490 000116 2 10 03061490 000116 > unlink(ff) Hth, Adrian On Thu,

[R] Importing data from a text file with no separator

2016-06-08 Thread Paolo Letizia
I have row data in a text file, where each row consists of 22 numerical characters. Each row consists of three different column but there is no separator. Specifically, the first two characters of the raw represent the first column of data, the subsequent 8 characters represent the second column o

Re: [R] R-help Digest, Vol 160, Issue 8

2016-06-08 Thread David Howell
I am having trouble running aplpack on my Mac. It will run on my PC, but the Mac gives an error message. Below is the result that I obtained. It seems to install fine--see below--but I can't load the library. > install.packages("aplpack") trying URL 'http://cran.rstudio.com/bin/macosx/contri

Re: [R] Tree plot with percentages and hierarchies

2016-06-08 Thread Don McKenzie
> On Jun 8, 2016, at 1:03 PM, Bert Gunter wrote: > > I am not really sure what you want, but it sounds like you want the > "rpart" package (which is part of the standard R distribution). I’m not sure either, but do you want to fit a model (in which case Bert’s suggestion of “rpart” is on targe

[R] Problem loading aplpack library

2016-06-08 Thread David Howell
I am having trouble running aplpack on my Mac. It will run on my PC, but the Mac gives an error message. Below is the result that I obtained. It seems to install fine--see below--but I can't load the library. > install.packages("aplpack") trying URL 'http://cran.rstudio.com/bin/macosx/contr

Re: [R] apply and cousins

2016-06-08 Thread Jim Lemon
Hi John, With due respect to the other respondents, here is something that might help: # get a vector of values foo<-rnorm(100) # get a vector of increasing indices (aka your "recent" values) bar<-sort(sample(1:100,40)) # write a function to "clump" the adjacent index values clump_adj_int<-functio

Re: [R] R integration with Hive with Kerberos enabled

2016-06-08 Thread Arti Wadhwani
Does anyone have any insight on this? Regards, Arti Wadhwani From: default mailto:awadhw...@hortonworks.com>> Date: Thursday, June 2, 2016 at 1:40 PM To: "r-help@r-project.org" mailto:r-help@r-project.org>> Subject: R integration with Hive with Kerberos enabled Hi,

Re: [R] Tree plot with percentages and hierarchies

2016-06-08 Thread Jim Lemon
Hi Joonas, It is easy to display hierarchic classification using either the plot.dendrite or sizetree functions (plotrix). At the moment, they will only display counts, not percentages. It would not be too difficult to reprogram either one to display percentages. Here are examples with shortened ca

Re: [R] R getting "Killed" while running VAR model

2016-06-08 Thread Jeff Newmiller
1. Don't allocate it. 2. If it was, would it make a difference? Seriously, some algorithms need more memory than others, and some packages are more wasteful than others. R is not monolithic... sometimes you just have to roll up your sleeves or buy more memory. -- Sent from my phone. Please

Re: [R] Tree plot with percentages and hierarchies

2016-06-08 Thread Bert Gunter
I am not really sure what you want, but it sounds like you want the "rpart" package (which is part of the standard R distribution). If that won't do, check the machine learning task view here: https://cran.r-project.org/web/views/MachineLearning.html Cheers, Bert Bert Gunter "The trouble with

Re: [R] R getting "Killed" while running VAR model

2016-06-08 Thread Vivek Singh
I checked the issue on different forums like stackoverflow. The issue is related to Out Of Memory (OOM) linux feature which kills processes that consume large memory and swap. I started to monitor the memory and swap consumption while VAR model was running. The R consumed all 32 GB of RAM memory an

Re: [R] R getting "Killed" while running VAR model

2016-06-08 Thread Vivek Singh
I am using *R version 3.0.2* (2013-09-25) on Ubuntu desktop (*Ubuntu 14.04.4 LTS*). I am running *var model *on a matrix with 199 columns and 604800 rows. The server has 12 core and 32GB of memory. When the model is running, i checked CPU and Memory consumption using 'htop' linux command. I observe

[R] Tree plot with percentages and hierarchies

2016-06-08 Thread Joonas Isoketo
Hi, I have the following problem: I want to visualize distributions of a few varibles in a specific order with a help of tree figure. Above of all is "Action x" and that happens for two (or n) reasons: "Reason 1" 50 % and "Reason 2" 50 %. Further, "Reason 1" happens for two (or n) subreasons: "

Re: [R] Reading and converting time data via read.table

2016-06-08 Thread Jeff Newmiller
The canonical way to store times is as difftime vectors. However, there is no simple way to import e.g. HH:MM data directly into such vectors, so you need to embed such times into a longer string that includes a fixed date. After conversion to POSIXct you can subtract the fixed date to get the

Re: [R] apply and cousins

2016-06-08 Thread MacQueen, Don
Hopefully Bert and William won't be offended if I more or less summarize: Are you assuming a loop will take ages, or have you actually tested it? I wouldn't assume a loop will take ages, or that it will take much longer than apply(). What's wrong with apply( X[ {logical expression } , ] , 1, f

Re: [R] Reading and converting time data via read.table

2016-06-08 Thread MacQueen, Don
As far as I know, base R does not have a class for storing times that are not associated with a date, and recognizing that they are times. That being the case, I don't think there is a way to convert them to some sort of time class while reading them into R using read.table(). I would read them int

Re: [R] apply and cousins

2016-06-08 Thread Bert Gunter
John: 1. Please read and follow the posting guide. In particular, provide a small reproducible example so that we know what your data and looping code look like. 2. apply-type commands are *not* vectorized; they are disguised loops that may or may not offer any speedup over explicit loops. 3. A

Re: [R] Knitr R - how to draw plot exactly at place of plot function call in output document?

2016-06-08 Thread Jeff Newmiller
I would echo the suggestion that the knitr Google group or stackexchange.com would be better than this list for this question. I also suggest that you look at http://yihui.name/knitr/demo/child/ and make a reproducible example if you decide to ask for more help in one of those forums. -- Sent

Re: [R] apply and cousins

2016-06-08 Thread William Dunlap via R-help
>It is easy in a loop but that will take ages. Is there any vectorised >apply-like solution to this? If you showed the loop that takes ages, along with small inputs for it (and an indication of how to expand those small inputs to big ones), someone might be able to show you some code that does the

[R] apply and cousins

2016-06-08 Thread John Logsdon
Folks Is there any way to get the row index into apply as a variable? I want a function to do some sums on a small subset of some very long vectors, rolling through the whole vectors. apply(X,1,function {do something}, other arguments) seems to be the way to do it. The subset I want is the mos

Re: [R] Antwort: RE: Antwort: Re: Merging variables

2016-06-08 Thread Marc Schwartz
Hi, Sorry for jumping in late here, but the issue is that you are only specifying "CustId" as the key column to merge (join) on. Thus, other columns in the two data frames that may have the same name, as is the case with "CustName", have the default suffix as defined by the argument 'suffixes

Re: [R] UUIDgenerate() withn a s4 class produces the same uuid at each instance

2016-06-08 Thread Ben Tupper
Hi, I think your issue is that in the absence of an explicit 'initialize' method the value of id is assigned when you define the class prototype. All subsequent new instances will use that very same prototype value defined when you first defined the class. That's in the help for ?new, "The fu

[R] Antwort: RE: Antwort: Re: Merging variables

2016-06-08 Thread G . Maubach
Hi Petr, thanks for your reply. I prepared little example for you: -- cut -- ds_temp_1 <- structure(list( CustId = c(1001, 1002, 1003, 1004, 1005, 1006), CustName = c("Miller", "Smith", "Doe", "White", "Black", "Nobody"), sales = c(100, 500, 300, 50, 700, 10) ),

[R] UUIDgenerate() withn a s4 class produces the same uuid at each instance

2016-06-08 Thread Servet Ahmet Çizmeli
Hello When I create a new instance of an S4 class in R, I would like the newly created object to have a unique id field. I try to achieve it through UUIDgenerate() from the uuid package. The problem is that I obtain the same UUID at every new object instance : library(uuid) setClass("C", re

[R] Regulized Matrix Factorization

2016-06-08 Thread Christian Eberhardt
__ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible cod

Re: [R] Reading and converting time data via read.table

2016-06-08 Thread PIKAL Petr
Hi I am rather confused. If you have data in some external file, (csv, txt, tab delimited), you can read it by corresponding read.* command to data.frame object. I did not know about conversion to POSIX directly by reading an object (it does not mean there is none). After you read your data yo

Re: [R] Cut Dates into bins

2016-06-08 Thread Jim Lemon
Hi Tjun Kiat, The following examples work for me. One uses the dates you have specified, adding one weekly date to cover the range of your daily dates, otherwise you will generate NAs. The second defines weekly breaks for a year and then simulates daily dates throughout that year. Remember that you