Re: [R] require help

2017-09-21 Thread Gabor Grothendieck
Assuming the input data.frame, DF, is of the form shown reproducibly in the Note below, to convert the series to zoo or ts: library(zoo) # convert to zoo z <- read.zoo(DF) # convert to ts as.ts(z) # Note: DF <- structure(list(year = c(1980, 1981, 1982, 1983, 1984), cnsm = c(174, 175, 175, 17

Re: [R] List of occuring values

2017-09-21 Thread Jim Lemon
Hi Ferri, Do you mean getting something like the vector of original values back? boodat<-sample(LETTERS[1:4],100,TRUE) bootab<-table(boodat) untab<-function(x) { lenx<-length(x) newx<-NULL for(i in 1:lenx) newx<-c(newx,rep(names(x)[i],x[i])) return(newx) } untab(bootab) Jim On Thu, Sep 21, 2

Re: [R] rcorr error in R stat

2017-09-21 Thread ruipbarradas
Hello, Also, the other file, NPA.csv, is not in tabular form. Can you please reformat it? Rui Barradas Citando ruipbarra...@sapo.pt: Hello, Please keep this on the list, always cc r-help. One of the files in your attachment is empty: y <- read.csv(file.choose("GT.csv")) Error in read.tab

Re: [R] rcorr error in R stat

2017-09-21 Thread ruipbarradas
Hello, Please keep this on the list, always cc r-help. One of the files in your attachment is empty: y <- read.csv(file.choose("GT.csv")) Error in read.table(file = file, header = header, sep = sep, quote = quote,  :   no lines available in input Rui Barradas   Citando Chaitanya Ganne : > Than

Re: [R] List of occuring values

2017-09-21 Thread William Dunlap via R-help
Note that this data.frame(table(...)) makes a column for each argument to table(...), plus a column for the frequencies so you can easily deal with multiway tabulations. > rawData <- data.frame( + sizes = c("Small", "Large", "Large", "Large"), + colors = c("Red", "Blue", "Blue", "Red"), +

Re: [R] Add wrapper to Shiny in R package

2017-09-21 Thread Duncan Murdoch
On 21/09/2017 11:30 AM, Axel Urbiz wrote: Thank you Thierry. I'm trying to following your suggestion in the example below, but getting: Error in get("xs", envir = my.env) : object 'my.env' not found. library(shiny) library(shinydashboard) myApp <- function(x, ...) { xs <- scale(x) my.

Re: [R] Add wrapper to Shiny in R package

2017-09-21 Thread Axel Urbiz
Thank you Thierry. I'm trying to following your suggestion in the example below, but getting: Error in get("xs", envir = my.env) : object 'my.env' not found. library(shiny) library(shinydashboard) myApp <- function(x, ...) { xs <- scale(x) my.env <- new.env() assign("xs", xs, envir = my

Re: [R] Add wrapper to Shiny in R package

2017-09-21 Thread Jeff Newmiller
... which begs the question... how does the my.env variable get from the myApp function into the server function? Perhaps read [1]? [1] https://shiny.rstudio.com/articles/function.html -- Sent from my phone. Please excuse my brevity. On September 21, 2017 8:13:15 AM PDT, Thierry Onkelinx wr

Re: [R] Add wrapper to Shiny in R package

2017-09-21 Thread Thierry Onkelinx
Dear Axel, I've used environment for such problems. assign("xs", xs, envir = my.env) in the myApp function get("xs", envir = my.env) in the server function Best regards, ir. Thierry Onkelinx Statisticus/ Statiscian Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZO

Re: [R] Keep on getting message errors when trying to install and load packages

2017-09-21 Thread Jeff Newmiller
This practice is not portable, as not everyone's default file creation permissions allow others to read those files, so putting them outside your home directory isn't necessarily helpful. It is much better to use the default user library within your home directory as suggested by the R install p

Re: [R] List of occuring values

2017-09-21 Thread William Dunlap via R-help
unique(x) will give you the distinct values in x. table(x) will give you the distrinct values and their frequencies as an array with dimnames. data.frame(table(x)) will give you a 2-column data.frame with the distinct values and their frequencies. > values <- c("Small", "Large", "Large", "Large"

Re: [R] List of occuring values

2017-09-21 Thread David L Carlson
Your question does not make sense. Show us what you have tried. If you cannot include part of the data you are using, try the Titanic data set included with R: > data(Titanic) > str(Titanic) table [1:4, 1:2, 1:2, 1:2] 0 0 35 0 0 0 17 0 118 154 ... - attr(*, "dimnames")=List of 4 ..$ Class

Re: [R] Keep on getting message errors when trying to install and load packages

2017-09-21 Thread Thierry Onkelinx
Dear Paul, We install R in C:/R/R-x.y.z and packages in C:/R/library. This makes the packages location independent from the R version. Best regards, ir. Thierry Onkelinx Statisticus/ Statiscian Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE

[R] List of occuring values

2017-09-21 Thread Ferri Leberl
Dear all, ftable produces a list of the frequencies of all occuring values. But how about the occuring values? How can I retrieve a list of occuring values? How can I retrieve a table with both the list of occuring values and their respective frequencies? Thank you in advance, Yours, Ferri _

Re: [R] Keep on getting message errors when trying to install and load packages

2017-09-21 Thread Paul Bernal
Dear Leslie and Thierry, Thank you so much for your kind and extremely valuable replies. Only one doubt remains, which path do you think is the best option to store downloaded packages? Should I set it up so that all installed packages are in the same folder (path) that I installed R? Or can I sim

[R] Add wrapper to Shiny in R package

2017-09-21 Thread Axel Urbiz
Dear List, I'm trying to add a function that calls a Shiny App in my R package. The issue is that within my function, I'm creating objects that I'd like to pass to the app. For instance, from the example below, I'm getting "Error: object 'xs' not found". How can I pass "xs" explicitly to shinyApp(

Re: [R] Keep on getting message errors when trying to install and load packages

2017-09-21 Thread Leslie Rutkowski
Hi Paul, I recently ran into file path conflicts and found the following useful (looks like you already know the answer to 1.): 1. Use .libPaths() to find where packages are being stored. 2. To change this path: Control Panel > search “View advanced system settings” > Environment Var

Re: [R] Keep on getting message errors when trying to install and load packages

2017-09-21 Thread Thierry Onkelinx
Dear Paul, Maybe some of the packages were installed by a user with admin rights and you are installing them with a user how has no admin rights. Thus you have no rights to remove the files created by the admin user. We made clear to our IT departement that they only may install R and not additio