similar to: rename multiple files by file.rename or other functions

Displaying 20 results from an estimated 1000 matches similar to: "rename multiple files by file.rename or other functions"

2017 Sep 28
0
rename multiple files by file.rename or other functions
Hi John, Maybe this: filenames<-c("XYZW01Genesis_ABC.mp3","XYZW02Genesis_ABC.mp3") for(filename in filenames) { filefirst<-sapply(strsplit(filename,"[.]"),"[",1) fileno<-sub("_","",gsub("[[:alpha:]]","",filefirst)) file.rename(filename,paste("01Gen",fileno,".mp3",sep="")) }
2017 Sep 28
1
rename multiple files by file.rename or other functions
Hi John, Thanks to Jim for pointing out the file.rename() function. You can try this: # define the filename templates strIn <- "XYZW--Genesis_ABC.mp3" strOut <- "01Gen--.mp3" # create the strings "01", "02", ..., "50" v <- sapply(1:50, function(i) sprintf("%02d",i) ) # perform all the file renames for ( s in v ) {
2017 Sep 28
0
rename multiple files by file.rename or other functions
The combination of list.files(), gsub() and file.rename() should to the trick. ir. Thierry Onkelinx Statisticus/ Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance thierry.onkelinx at inbo.be Kliniekstraat 25, B-1070 Brussel
2017 Sep 21
3
Add wrapper to Shiny in R package
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()? *Under R directory:* myApp <- function(x, ...) {
2017 Sep 21
0
Add wrapper to Shiny in R package
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 BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie &
2017 Nov 09
0
weighted average grouped by variables
Hello an update about my question: I worked out the following solution (with the package "dplyr") library(dplyr) mydf%>% mutate(speed_vehicles=n_vehicles*mydf$speed) %>% group_by(date_time,type) %>% summarise( sum_n_times_speed=sum(speed_vehicles), n_vehicles=sum(n_vehicles), vel=sum(speed_vehicles)/sum(n_vehicles) ) In fact I was hoping to manage everything in a
2017 Nov 09
1
weighted average grouped by variables
Dear Massimo, It seems straightforward to use weighted.mean() in a dplyr context library(dplyr) mydf %>% group_by(date_time, type) %>% summarise(vel = weighted.mean(speed, n_vehicles)) Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team
2017 Sep 21
2
Keep on getting message errors when trying to install and load packages
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 Variables *button *> a. *Edit* current R_LIBS_USER to new file path b. *New*
2017 Nov 24
2
Multiple sets of proportion tests
Hi all , I have a dataframe of 200 columns and 2 rows. The first row in each column contains the frequency of cases in group I . The second row in each column contains the frequency of cases in group II. The frequency of trails is a fixed value for group I(e.g.200) and it is also another fixed values for group II (e.g. 100). The dataset looks like this :- > Mydata
2017 Sep 21
1
Keep on getting message errors when trying to install and load packages
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 FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
2017 Sep 21
0
Keep on getting message errors when trying to install and load packages
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 simply set it up so that all installed packages are stored in a different path? Again, thank you guys
2017 Dec 13
1
overlay two histograms ggplot
Hi all, How can I overlay these two histograms? ggplot(gg, aes(gg$Alz, fill = gg$veg)) + geom_histogram(alpha = 0.2) ggplot(tt, aes(tt$Cont, fill = tt$veg)) + geom_histogram(alpha = 0.2) thanks for any help! Elahe
2017 Nov 09
4
weighted average grouped by variables
hi all I have this dataframe (created as a reproducible example) mydf<-structure(list(date_time = structure(c(1508238000, 1508238000, 1508238000, 1508238000, 1508238000, 1508238000, 1508238000), class = c("POSIXct", "POSIXt"), tzone = ""), direction = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L), .Label = c("A", "B"), class =
2017 Sep 21
1
Add wrapper to Shiny in R package
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.env) shiny::runApp(app) } app = shinyApp( ui =
2017 Nov 24
0
Multiple sets of proportion tests
Hi anonymous, ?prop.test states that it returns a list. And one of the element is 'p.value'. str() on the output of prop.test() reveals that too. So prop.test()$p.value or prop.test()["p.value"] should work. Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR
2017 Sep 20
2
Keep on getting message errors when trying to install and load packages
Dear R friends, I am currently using Windows 8, 64-bit operating system, x64-based processor. I have installed R version 3.4.1 "Single Candle". Also, I have several packages installed in this path: C:\Users\PaulBernal\Documents\R\win-library\3.4 Plus some other packages installed in this other path: C:\Users\PaulBernal\Desktop\DESTOP FILES\R Books C:\Users\PaulBernal\Desktop\DESTOP
2017 Sep 17
2
Shiny App inside R Package
Dear List, I have a wrapper function that creates a Shiny App, as illustrated below. I'd like to include the function myApp() inside a package. I'd appreciate your guidance here, as I could not find good instructions on this online. myApp <- function(x) { require(shiny) shinyApp( ui = fluidPage( sidebarLayout( sidebarPanel(sliderInput("n",
2017 Nov 24
1
Multiple sets of proportion tests
Thank you for clarifying this point but my main question was about how to modify my code to do the analysis correctly. The code I mentioned :- MyResults <- apply(Mydata, 2, function(x)prop.test(Mydata,c(200,100)) Results in this error : 'x' and 'n' must have the same length in the prop.test(x,n). How can I modify "x' or "n" arguments so the analysis
2017 Sep 21
0
Keep on getting message errors when trying to install and load packages
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 additional packages. We also tell them to set the environment variable R_LIBS_USER to C:/R/library and make
2008 May 20
7
Problems sending large results with backgroundrb
I''m working on an application that does extensive database searching. These searches can take a long time, so we have been working on moving the searches to a backgroundrb worker task so we can provide a sexy AJAX progress bar, and populate the search results as they are available. All of this seems to work fine until the size of the search results gets sufficiently large, when we start