Re: [R] Unique Ordering

2016-04-22 Thread Jim Lemon
Hi Edward, I'm not really sure that this is what you want as I can't figure out what the "earn" factor is, but: epdat[order(epdat$Var2,epdat$Freq,decreasing=TRUE),] Jim On Sat, Apr 23, 2016 at 4:08 AM, Patzelt, Edward wrote: > Hi R-Help, > > data at bottom > > I've been struggling with a probl

Re: [R] Creating variables on the fly

2016-04-22 Thread Ulrik Stervbo
Hi Georg, The " around Kunden$* looks unintentional to me. Second: haveyou considered using a long table? Then you would fill a known set of columns. Third if you must have columns based on year I believe df[[a.column.name]] will work. Best Ulrik schrieb am Sa., 23. Apr. 2016 07:33: > Hi a

Re: [R] Creating variables on the fly

2016-04-22 Thread Sarah Goslee
The direct answer to your question is to look at ?get and ? assign. The R-ish answer to your question is to store the data as elements of a list rather than separate files and use lapply() instead. Sarah On Friday, April 22, 2016, wrote: > Hi all, > > I would like to use a loop for tasks that

Re: [R] Problem installing/loading packages from Africa

2016-04-22 Thread Michael Long
Try upgrading R to version 3.2.5 and then try to reinstall swirl. Michael Long On 04/22/2016 03:41 AM, Tim Werwie wrote: I'm very new to R and I live in Mali, west Africa. I'm on *OS X 10.7.5*. I downloaded and installed *R 3.2.1*. I downloaded and installed *RStudio 00.99.893*. I ran through

Re: [R] Number of package in Ubuntu

2016-04-22 Thread Michael Long
I have been using Ubuntu and R Studio for about 5 years and have not had any problems finding and installing packages. I believe there are packages that only work in Windows but I don't what they are. Michael Long On 04/22/2016 11:51 AM, mylistt...@gmail.com wrote: Dear Experts , I am using

[R] Creating variables on the fly

2016-04-22 Thread G . Maubach
Hi all, I would like to use a loop for tasks that occurs repeatedly: # Groups # Umsatz <= 0: 1 (NICHT kaufend) # Umsatz > 0: 2 (kaufend) for (year in c("2011", "2012", "2013", "2014", "2015")) { paste0("Kunden$Kunde_real_", year) <- (paste0("Kunden$Umsatz_", year) <= 0) * 1 +

[R] Unique Ordering

2016-04-22 Thread Patzelt, Edward
Hi R-Help, data at bottom I've been struggling with a problem where I need to order based on 1) the Frequency "Freq" and 2) keeping each group of 3 of the same type together "Var2" but I want across all groups it to go "high to low" based on the earn factor. Thank you! structure(list(Var1 = str

Re: [R] S4 non-virtual class with no slots? [SOLVED]

2016-04-22 Thread Boylan, Ross
Thanks, Martin, that (inherit from a virtual class) worked great. I already had a base class created with setUnion, and so this was an easy switch. I had assumed that since inheriting from a class without slots would produce a class without slots the result would still be virtual. Fortunately

Re: [R] npudens(np) Error missing value where TRUE/FALSE needed

2016-04-22 Thread Jim Lemon
Hi Carolien, There was a recent request involving a change in the functionality of R that may be relevant to your problem. The usual trigger for the "missing value where TRUE/FALSE needed" error is a conditional expression that doesn't evaluate because of an NA value. As some coercion or summary fu

Re: [R] S4 non-virtual class with no slots?

2016-04-22 Thread Martin Morgan
On 04/22/2016 04:38 PM, Boylan, Ross wrote: It seems that if an S4 class has no slots it can't be instantiated because it is assumed to be virtual. Is there a way around this other than adding a do-nothing slot? A singleton would be OK, though is not essential. Problem: EmptyFitResult <- s

Re: [R] S4 non-virtual class with no slots?

2016-04-22 Thread Jeff Newmiller
Isn't this why NULL is different than NA? Alternatively, what about using a data frame with no rows? -- Sent from my phone. Please excuse my brevity. On April 22, 2016 1:38:57 PM PDT, "Boylan, Ross" wrote: >It seems that if an S4 class has no slots it can't be instantiated >because it is assu

Re: [R] installation problem on Ubuntu

2016-04-22 Thread David Winsemius
> On Apr 22, 2016, at 12:47 PM, Paul Tremblay wrote: > > LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH > source ~/.bash_profile On my machine Sys.getenv("LD_LIBRARY_PATH") returns "" in R and echo $LD_LIBRARY_PATH likewise returns only a carriage return from a bash console, but

[R] S4 non-virtual class with no slots?

2016-04-22 Thread Boylan, Ross
It seems that if an S4 class has no slots it can't be instantiated because it is assumed to be virtual. Is there a way around this other than adding a do-nothing slot? A singleton would be OK, though is not essential. Problem: EmptyFitResult <- setClass("EmptyFitResult", representation=represe

Re: [R] installation problem on Ubuntu

2016-04-22 Thread Paul Tremblay
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH source ~/.bash_profile I still get the same error. On Thu, Apr 21, 2016 at 7:45 PM, David Winsemius wrote: > > > On Apr 21, 2016, at 1:23 PM, Paul Tremblay > wrote: > > > > I was able to install the curl library with no problems. Howe

Re: [R] Number of package in Ubuntu

2016-04-22 Thread Jeff Newmiller
There are thousands of R packages. The majority work fine on multiple platforms. Whether your packages are in that group is something only you can determine. I will say that Linux is typically better than Windows when it comes to big data tech, so even if some specific packages don't work the

Re: [R] clock24.plot/radial plot

2016-04-22 Thread Ogbos Okike
Dear All, One hand. Many thanks!! The code run as soon as I loaded lubridate. Please can you guide me on how to relate this code to my actual data. My actual data is looking like: 2005/01/01 00:00 4009 2005/01/01 01:00 3969 2005/01/01 02:00 3946 2005/01/01 03:00 3975 2005/01/01 04:00 396

Re: [R] clock24.plot/radial plot

2016-04-22 Thread David L Carlson
Looks like you forgot to load the lubridate package library(lubridate) You are calling functions days(), hours(), minutes(), seconds(), and hour() which all come from that package. - David L Carlson Department of Anthropology Texas A&M University College Sta

Re: [R] clock24.plot/radial plot

2016-04-22 Thread Ogbos Okike
Kind Experts, Many thanks for your guide. I have tried to figure out something that can help me plot my own data using the examples you referred me to. I copied part of the code as: set.seed(44) N=500 events <- as.POSIXct("2011-01-01", tz="GMT") + days(floor(365*runif(N))) +

[R] Number of package in Ubuntu

2016-04-22 Thread mylisttech
Dear Experts , I am using R with Spark on Windows and now there is a need to move to Ubuntu. I wanted to know if most of the packages that are available on windows , would they be available on Ubuntu/Linux? If not can I compile the source code of those package ? Has any one of you used the pack

Re: [R] simulation in R

2016-04-22 Thread David L Carlson
I don't think we have enough information to help you with this. Do you intent the simulated values for growthrate to be selected from the values in daT$growthrate? Or do these values define a distribution of values (perhaps ranging between 0 and 1) and the simulation should use that empirical

Re: [R] Finding Highest value in groups

2016-04-22 Thread Giorgio Garziano
Since the aggregate S3 method for class formula already has got na.action = na.omit, ## S3 method for class 'formula' aggregate(formula, data, FUN, ..., subset, na.action = na.omit) I think that to deal with NA's, it is enough: aggregate(Value~ID, dta, max) Moreover, passing na.r

Re: [R] Finding Highest value in groups

2016-04-22 Thread David L Carlson
Base R functions can handle this easily. It is preferable to use dput() as a compact way of providing data on the list: > dta <- read.table(text="IDValue + 10.69 + 10.31 + 20.01 + 20.99 + 31.00 + 4NA + 40 + 41 + 50.5 + 5

Re: [R] Finding Highest value in groups

2016-04-22 Thread Giorgio Garziano
idvalues <- data.frame (ID = c(1, 1, 2, 2, 3, 4, 4, 4, 5, 5), Value = c(0.69, 0.31, 0.01, 0.99, 1.00, NA, 0,1, 0.5, 0.5)) aggregate(Value~ID, data=idvalues, max) ID Value 1 1 0.69 2 2 0.99 3 3 1.00 4 4 1.00 5 5 0.50 -- Best, GG [[alternative HTML

Re: [R] Unexpected values obtained when reading in data using ncdf and ncdf4

2016-04-22 Thread Roy Mendelssohn - NOAA Federal
Hi Louise: If Dave can’t figure it out, I can give a look also. A couple of things I would suggest: 1. Don’t use the name “data” in the nc_open command, that is a reserved command in R and you never know what problems that can cause. 2. You are doing calculations to get set the start and cou

Re: [R] Unexpected values obtained when reading in data using ncdf and ncdf4

2016-04-22 Thread David W. Pierce
On Fri, Apr 22, 2016 at 1:32 AM, Louise Mair wrote: > Dear R Users, > > I am encountering a problem when reading nc files into R using the ncdf > and ncdf4 libraries. The nc files are too large to attach an example (but > if someone is interested in helping out I could send a file privately via >

Re: [R] subset by multiple letters condition

2016-04-22 Thread Adams, Jean
You can use the grepl() function to give you logicals for each criterion, then combine them as needed. For example: # example version of Command Command <- paste0("_localize_", c("PD","t2","t1_seq", "abc", "xyz", "PD_t1")) hasPD <- grepl("PD", Command, fixed=TRUE) hast1 <- grepl("t1", Command, f

Re: [R] Problem installing/loading packages from Africa

2016-04-22 Thread Michael Dewey
Dear Tim 1 - if this is a specific RStudio problem best to use their forums 2 - please try not to post in HTML as it mangles your messages 3 - I think you will find that you are getting a _warning_ not an _error_ about the package being built under 3.2.5 when you are running 3.2.1 4 - my guess

Re: [R] subset by multiple letters condition

2016-04-22 Thread Giorgio Garziano
You may investigate a solution based on regular expressions. Some tutorials to help: http://www.regular-expressions.info/rlanguage.html http://www.endmemo.com/program/R/grep.php http://biostat.mc.vanderbilt.edu/wiki/pub/Main/SvetlanaEdenRFiles/regExprTalk.pdf https://rstudio-pubs-static.s3.ama

Re: [R] Error using RPostgreSQL

2016-04-22 Thread Tom Wright
On heroku the database uri is stored in an environment variable. > db_uri = Sys.getenv(''DATABASE_URL') I'm not sure if you can use that directly or if you will need to parse it for username, password etc. On Thu, 2016-04-21 at 16:49 +0100, Izaak Rogan wrote: > Hi, > > I'm having trouble connec

Re: [R] Finding Highest value in groups

2016-04-22 Thread Tom Wright
Assuming your dataframe is in a variable x: > require(dplyr) > x %>% group_by(ID) %>% summarise(maxVal = max(Value,na.rm=TRUE)) On Fri, 2016-04-22 at 13:51 +, Saba Sehrish via R-help wrote: > Hi > > > I have two columns in data frame. First column is based on "ID" assigned to > each grou

Re: [R] Error using RPostgreSQL

2016-04-22 Thread Jeff Newmiller
I don't use PostGreSQL, but I strongly suspect that you would have this problem using other drivers as well, so pick any method described in the PostGreSQL documentation to verify that you can reach the server and your dbname from the machine where you are running R. Note that where you are conn

[R] Finding Highest value in groups

2016-04-22 Thread Saba Sehrish via R-help
Hi I have two columns in data frame. First column is based on "ID" assigned to each group of my data (similar ID depicts one group). From second column, I want to identify highest value among each group and want to assign the same ID to that highest value. Right now the data looks like: ID

[R] subset by multiple letters condition

2016-04-22 Thread ch.elahe via R-help
Hi all, I have a data frame df and I want to do subset based on several conditions of letters of the names in Command.1)if the names contain PD 2)if the names contain t1 3)if the names contain t2 4)if the names contain t1 and PD 5)if the names contain t2 and PD 6)otherwise the names would be

[R] Problem installing/loading packages from Africa

2016-04-22 Thread Tim Werwie
I'm very new to R and I live in Mali, west Africa. I'm on *OS X 10.7.5*. I downloaded and installed *R 3.2.1*. I downloaded and installed *RStudio 00.99.893*. I ran through the free Microsoft data camp intro to R course, then started another free course through 'edX', for Data and Statistics for L

[R] Unexpected values obtained when reading in data using ncdf and ncdf4

2016-04-22 Thread Louise Mair
Dear R Users, I am encountering a problem when reading nc files into R using the ncdf and ncdf4 libraries. The nc files are too large to attach an example (but if someone is interested in helping out I could send a file privately via an online drive), but the code is basic: for(i in 1:length(t

[R] R - Understanding output of the Knoxtest (Package (surveillance))

2016-04-22 Thread Oscar Janin
The function knox of the "Surveillance" package performs Knox test for space-time interaction. The output is supposed to give the numbers of events that occur in a specific distance in space and time define by the function arguments. This function also perform a Monte Carlo permutation test, which

Re: [R] clock24.plot

2016-04-22 Thread Jim Lemon
Hi Ogbos, Here is your sample data plotted in roughly the same way as the image. You can get the hours to start at the bottom, but it will require more code. swe$hour<-as.numeric(sapply(strsplit(swe$time,":"),"[",1)) swe$FD<-sample(1:2,nrow(swe),TRUE) library(plotrix) clock24.plot(swe$count,swe$ho

Re: [R] plot 8 functions on one graph?

2016-04-22 Thread PIKAL Petr
Hi Normally data in data frames are considered column wise and ggplot expects this ggplot(yourdataframe, aes(x=some column, y=other column, colour=grouping factor, ...) So if you want to use ggplot, you shall transpose your data frame and reshape it to long format. See ?ggplot ?t ?reshape ?me

Re: [R] EIGEN VECTOR PROBLEM

2016-04-22 Thread Berend Hasselman
> On 21 Apr 2016, at 22:17, MD. HABIBUR RAHMAN wrote: > > Dear Sir, > I am an R user. > I am in problem to find eigen vectors in R. > For the following matrix eigen vectors are not right. I can not understand > why?? > For the 1st eigen value and 2nd eigen value are same, but the eigen vectors >