[R] Filtering Cases with != NA

2015-12-17 Thread G . Maubach
Dear All, I am new to "R" and search for a solution to exclude cases if a certain variable contains NA for a case. Example No Name Turnover 1 Smith 1500 2 Mayor 200 3 Miller 4 Batic 750 I would like to create a subset excluding case 3 Miller NA. I tried to following: new_dataset <-

[R] Antwort: RE: Merging variables

2016-06-07 Thread G . Maubach
Hi Petr, I would like to describe the data situation in brief: I have an business warehouse dataset (referred to as BW data) containing sales and an ERP customer master data dataset with additional information (referred to as ERP data). Though customer IDs and customer names are identical

[R] Antwort: Re: Merging variables

2016-06-07 Thread G . Maubach
Hi Michael, yes, I was astonished about this behaviour either. I have worked with SPSS a lot - and that works different. I would like to share some of my data. Can you tell me how I can dump a dataset in a way that I can post it here as text? Kind regards Georg Von:Michael Dewey

[R] Merging variables

2016-06-06 Thread G . Maubach
Hi All, I merged two datasets: ds_merge1 <- merge(x = ds_bw_customer_4_match, y = ds_zww_customer_4_match, by.x = "customer", by.y = "customer", all.x = TRUE, all.y = FALSE) R created a new dataset with the variables customer.x and customer.y. I would like to merge these two variable back

[R] Antwort: RE: Merging variables

2016-06-06 Thread G . Maubach
Hi David, Hi Petr, many thanks for your help. With your hints I got the idea how I could do it and I came up with this solution: -- cut -- #--- # Module: t_merge_variables.R # Author: Georg Maubach #

[R] Warning message in openxlsx

2016-06-14 Thread G . Maubach
Hi All, I get the warning message Warning message: In styles$font : partial match of 'font' to 'fonts' when executing > xls_workbook <- t_create_workbook() > xls_sheetname <- "Kunden" > xls_ds_to_save <- ds_merge1 > xls_filename <- paste0(data_created, "_Merge1_BW-SAP-Kunden_cleaned.xlsx") >

[R] Installation of package "rio" broken

2016-06-14 Thread G . Maubach
Hi all, today I wanted to install package "rio". As it depends on package "feather" which is only available as source I have chosen to install "rio" from source. The installations fails with the following messages: -- cut -- * installing *source* package 'feather' ... ** Paket 'feather'

[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] Difference subsetting (dataset$variable vs. dataset["variable"]

2016-05-31 Thread G . Maubach
Hi All, I thought dataset$variable is the same as dataset["variable"]. I tried the following: > str(ZWW_Kunden$Branche) chr [1:49673] "231" "151" "151" "231" "231" "111" "231" "111" "231" "231" "151" "111" ... > str(ZWW_Kunden["Branche"]) 'data.frame':49673 obs. of 1 variable: $

[R] Antwort: RE: Variable labels and value labels

2016-06-01 Thread G . Maubach
Hi Petr, I am looking for a general procedure that I can use with any package of R. As to my current experience it probably will happen that I need a procedure from another package than hmisc or memisc and the my solution shall work even than so that I do need to find another way to do it.

[R] Antwort: Re: Variable labels and value labels

2016-06-01 Thread G . Maubach
Hi Jim, many thanks for the hint. When looking at the documentation I did not get how I do control which value gets which label. Is it possible to define it? Kind regards Georg Von:Jim Lemon An: g.maub...@weinwolf.de, r-help mailing list

[R] Antwort: Re: Unable to update R software to 3.3.0

2016-06-01 Thread G . Maubach
Hi all, I did it today on Debian GNU Linux 8 Jessie this way: vim /etc/apt/sources.list deb http://cran.uni-muenster.de/bin/linux/debian jessie-cran3 ESC;:wq apt.get update apt-get install r-base r-base-dev This worked for me. When installing R packages from within R I found that R needed the

[R] Installing miniCRAN on Debian

2016-06-01 Thread G . Maubach
Hi All, I am installng miniCRAN on Debian GNU Linux 8 Jessie (Linux analytics7 4.5.0-0.bpo.2-amd64 #1 SMP Debian 4.5.4-1~bpo8+1 (2016-05-13) x86_64 GNU/Linux) and R 3.3.0 -- cut -- > sessionInfo() R version 3.3.0 (2016-05-03) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian

[R] Utility Functions

2016-05-31 Thread G . Maubach
Hi All, I was new to R and this list a couple of mounths ago. When processing my data I got tremendous support from R-Help mailing list. The solutions I have worked out with your help might be also helpful for others. I have put the solutions in a couple of small functions with documentation

[R] Variable labels and value labels

2016-05-31 Thread G . Maubach
Hi All, I am using R for social sciences. In this field I am used to use short variable names like "q1" for question 1, "q2" for question 2 and so on and label the variables like q1 : "Please tell us your age" or q2 : "Could you state us your household income?" or something similar indicating

[R] Building a binary vector out of dichotomous variables

2016-06-16 Thread G . Maubach
Hi All, I need to build a binary vector made of a set of dichotomous variables. What I have so far is: -- cut -- ds_example <- structure( list( year2013 = c(0, 0, 0, 1, 1, 1, 1, 0), year2014 = c(0, 0, 1, 1, 0, 0, 1, 1), year2015 = c(0, 1, 1, 1, 0, 1,

[R] (Off-Topic] Introducing a new R Blog

2016-06-20 Thread G . Maubach
Hi All, today I would like to announce a now R blog. I contains a few entries about the findings during my course of studies and my daily work: https://github.com/gmaubach/R-Know-How/wiki/R-Blog I hope you'll find my hints usefull. In addition you could have a look at a small R collection of

[R] Subscripting problem with is.na()

2016-06-23 Thread G . Maubach
Hi All, I would like to recode my NAs to 0. Using a single vector everything is fine. But if I use a data.frame things go wrong: -- cut -- var1 <- c(1:3, NA, 5:7, NA, 9:10) var2 <- c(1:3, NA, 5:7, NA, 9:10) ds_test <- data.frame(var1, var2) test <- var1 test[is.na(test)] <- 0 test # NA

[R] r_toolbox: Update

2016-06-23 Thread G . Maubach
Hi folks, I have updated the functions of the r_toolbox.R set of utilities: https://sourceforge.net/projects/r-project-utilities/files/?source=navbar Naming was changed with some functions to reflect similar functions in SAS or SPSS, e. g. t_n_miss, t_n_valid. In addition I added functions for

Re: [R] Subscripting problem with is.na()

2016-06-24 Thread G . Maubach
Hi Bert, many thanks for all your help and your comments. I learn at lot this way. My question was about is.na() at the first sight but the actual task looks like this: I have two variables in my customer data that signal if the customer accout was closed by master data management or by

[R] Fw: Aw: Re: Building a binary vector out of dichotomous variables

2016-06-17 Thread G . Maubach
> Hi Tom, > > thanks for your reply. > > Yes, that's exactly what I am looking for. I did not know about the automatic > type conversion in R. > > #-- cut -- > ds_example <- > structure( > list( > year2013 = c(0, 0, 0, 1, 1, 1, 1, 0), > year2014 = c(0, >0,

[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] Merging Data Sets with Full Outer Join

2016-04-20 Thread G . Maubach
Hi All, I would like to match some datasets. Both deliver variables AND cases which might or might not be present in all datasets: This sequence Kunden <- Kunden_2011 Kunden <- merge(Kunden, Kunden_2012, by.x = "Debitor", by.y = "Debitor") Kunden <- merge(Kunden, Kunden_2013,

[R] R Script Template

2016-04-27 Thread G . Maubach
Hi All, I am addressing this post to all who are new to R. When learing R in the last weeks I took some notes for myself to have code snippets ready for the data analysis process. I put these snippets together as a script template for future use. Almost all of the given command prototypes

[R] Interdependencies of variable types, logical expressions and NA

2016-04-28 Thread G . Maubach
Hi All, my script tries to do the following on factors: > ## Check for case 3: Umsatz = 0 & Kunde = 1 > for (year in 2011:2015) { + Umsatz <- paste0("Umsatz_", year) + Kunde <- paste0("Kunde01_", year) + Check <- paste0("Check_U_0__Kd_1_", year) + + cat('Creating', Check, 'from',

[R] Antwort: RE: Missing Values in Logical Expressions

2016-04-27 Thread G . Maubach
Hi Petr, Hi Jim, many thanks for your help. Today I constructed a sample dataset and tested your suggestions. Everything worked OK. Then I took the code and testet on the original data. And - it worked OK this morning also. I went back to my script of Thuesday and ran it again. OK. Then I

[R] Antwort: Re: R Script Template

2016-04-28 Thread G . Maubach
Hi All, please find enclosed the missing attachment. Kind regards Georg -- cut -- #-[ Header ] -- # Program : Framework for R scripts # Author: Georg Maubach # Date : 2016-03-03 # Update:

[R] Antwort: Fw: Re: Creating variables on the fly (SOLVED)

2016-04-26 Thread G . Maubach
Hi Don, Hi to all readers, many thanks for all your answers and all your help. I adapted Don's code to my data and Don's code does the trick: str(Kunden01) for (year in 2011:2015) { Reeller_Kunde <- paste0("Reeller_Kunde_", year) Umsatz <- paste0("Umsatz_", year) cat('Creating',

[R] Missing Values in Logical Expressions

2016-04-26 Thread G . Maubach
Hi All, I need to evaluate missing values in my data. I am able to filter these values and do simple statistics on it. But I do need new variables based on variables with missing values in my dataset: Check_Kunde_2011 <- ifelse(is.na(Umsatz_2011) == TRUE & Kunde_2011 == 1, 1, 0)

[R] WG: Filtering String Variables (SOLVED)

2016-05-23 Thread G . Maubach
Hi All, the solution for my question is as follows ## Filter duplicates and correpsonding non-duplicates ### To filter duplicates and their corresponding non-duplicates use the ### following code snippet: Debitor <- c("968691", "968691", "968691", "A04046", "A04046",

[R] Filtering String Variables

2016-05-23 Thread G . Maubach
# Hi All, # # I have the following data frame (example): Debitor <- c("968691", "968691", "968691", "A04046", "A04046", "L0006", "L0006", "L0006", "L0023", "L0023", "L0056", "L0056", "L0094", "L0094", "L0094", "L0124",

[R] Creating a data frame from scratch

2016-05-24 Thread G . Maubach
Hi All, I need to create a data frame from scratch and fill variables created on the fly with values. What I have so far: -- schnipp -- # Example dataset gene <- c("ENSG0208234","ENSG0199674","ENSG0221622","ENSG0207604",

[R] Antwort: Re: Re: Antwort: Re: Re: sink(): Cannot open file

2016-05-11 Thread G . Maubach
Hi Sarah, yes, I followed your suggestion. If I do exactly what is in the example of the documentation: sink("C:/Temp/sink-examp.txt") i <- 1:10 outer(i, i, "*") sink() unlink("C:/Temp/sink-examp.txt") it does not write anything, i. e. no file is created in "C:/Temp/". The script is executed

[R] Antwort: Re: Antwort: Re: Re: sink(): Cannot open file

2016-05-11 Thread G . Maubach
Duncan, thanks for the hint. I have done it correctly in R fashion ## capture all the output to a file. zz <- file("C:/Temp/all.Rout", open = "wt") sink(zz) sink(zz, type = "message") try(log("a")) ## back to the console sink(type = "message") sink() unlink("C:/Temp/all.Rout") But the error

[R] Antwort: Antwort: Re: Re: Antwort: Re: Re: sink(): Cannot open file

2016-05-12 Thread G . Maubach
Hi Martin, many thanks for following-up on my question. I did it again: ## capture all the output to a file. zz <- file("C:/Temp/all.Rout", open = "wt") sink(zz) sink(zz, type = "message") try(log("a")) ## back to the console sink(type = "message") sink() close(zz) This works. I tried several

[R] Antwort: Re: Antwort: Re: Antwort: Re: Re: sink(): Cannot open file (SOLVED)

2016-05-12 Thread G . Maubach
Hi Henrik, Jim, Sarah, Duncan, Hi All, I have tried the built-in solution using PowerShell: $lockedFile="C:\Windows\System32\wshtcpip.dll" Get-Process | foreach{$processVar = $_;$_.Modules | foreach{if($_.FileName -eq $lockedFile){$processVar.Name + " PID:" + $processVar.id}}} It did not show

[R] Antwort: Re: Re: sink(): Cannot open file

2016-05-10 Thread G . Maubach
Hi Jim, I tried: sink("all.Rout") try(log("a")) sink() The program executes without warning or error. The file "all.Rout" is begin created. Nothing will be written to it. The file is accessable rights after the execution of the program by notepad.exe. The program zz <- file("all.Rout", open

[R] sink(): Cannot open file

2016-05-10 Thread G . Maubach
Hi All, I would like to route the output to a file using sink(). When using the example from the ?sink documentation: sink("sink-examp.txt") i <- 1:10 outer(i, i, "*") sink() unlink("sink-examp.txt") ## capture all the output to a file. zz <- file("all.Rout", open = "wt") sink(zz) sink(zz,

[R] Antwort: Re: Antwort: Re: Re: sink(): Cannot open file

2016-05-10 Thread G . Maubach
Hi Sarah, John, Jim, Hi All, I have set my envrionment variable path <- file.path("H:", "2016", "Analysis") setwd(dir = path) This works well cause the file is created in that directory. I have tried close(zz) unlink(zz) and neither worked nor did it work out using them together. I had

[R] Antwort: Antwort: Re: selecting columns from a data frame or data table by type, ie, numeric, integer

2016-05-04 Thread G . Maubach
Hi Martin, many thanks for your answer and your broad explanation. I am a newbie to "R" and got help on this list and thought I could give something back what looked OK to me. regarding 0) You're right, it's pseudo code. I assumed that anybody on the list would be able to adapt the code to

[R] Antwort: Re: selecting columns from a data frame or data table by type, ie, numeric, integer

2016-05-04 Thread G . Maubach
Hi All, Hi Carl, I am not sure if this is useful to you, but I followed your conversation and thought of you when I read this: for (i in 1:ncol(dataset)) { if(class(dataset) == "character|numeric|factor|or whatsoever") { dataset[, i] <- as.factor(dataset[, i]) } } Source: Zumel, Nina /

[R] Antwort: Re: sink(): Cannot open file

2016-05-10 Thread G . Maubach
Hi Jim, thanks for your reply. ad 1) "all.Rout" was created in the correct directory. It exists properly with correct file properties on Windows, e.g. creation date and time and file size information. ad 2) I can not access the file with Notepad.exe directly after it was created by R. The

[R] Antwort: Re: Creating a data frame from scratch (SOLVED)

2016-05-25 Thread G . Maubach
Hi Dan, Hi All, many thanks for your help. Please find enclosed my little function for your use: -- cut -- #--- # Module: t_count_na.R # Author: Georg Maubach # Date : 2016-05-24 # Update

[R] Spread data.frame on 2 variables

2016-07-28 Thread G . Maubach
Hi All, I need to spread a data.frame on 2 variables, e. g. "channel" and "unit". If I do it in two steps spreads keeps all cases that does not look like the one before although it contains the same values for a specific case. Here is what I have right now: -- cut -- test1$dummy <- 1 test2

[R] Error when installing packages

2016-07-26 Thread G . Maubach
Hi All, I try to install packages on Debian GNU Linux 8 (Kernel 3.16.0-4-amd64). My sessionInfo() is R version 3.3.1 (2016-06-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 8 (jessie) locale: [1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C [3]

[R] Antwort: Re: Re: Spread data.frame on 2 variables (SOLVED)

2016-08-02 Thread G . Maubach
Hi Ulrik, many thanks for your help. The problem was that R regards a dataset with a combination like caseID custID channel unit 1 100010 10 2 100020 10 3 100020

[R] Accessing an object using a string

2016-08-15 Thread G . Maubach
Hi All, I would like to access an object using a sting. # Create example dataset var1 <- c(1, 2, 3) var2 <- c(4, 5, 6) data1 <- data.frame(var1, var2) var3 <- c(7, 8, 9) var4 <- c(10, 11, 12) data2 <- data.frame(var3, var4) save(file = "c:/temp/test.RData", list = c("data1", "data2")) #

[R] R Toolbox (Release 2 of 2016-07-21)

2016-07-21 Thread G . Maubach
Hi All, I have uploaded a new release of the R Toolbox. R Toolbox is a collection of simple but useful functions which I developed for myself to shorten the develoment process. Currently all functions use base R. No other packages are needed. One exception is "t_openxlsx" cause this module

[R] Antwort: RE: Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread G . Maubach
Hi All, Petr, Bert, David, Ivan, Duncan and Rui helped me to develop a function able to replace NA's in variables IF NEEDED: #--- # Module: t_replace_na.R # Author: Georg Maubach # Date :

[R] Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread G . Maubach
Hi David, Hi Bert, many thanks for the valuable discussion on NA in R (please see extract below). I follow your arguments leaving NA as they are for most of the time. In special occasions however I want to replace the NA with another value. To preserve the newly acquired knowledge for me I

[R] Antwort: RE: Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread G . Maubach
Hi Petr, many thanks for your reply and the examples. My subscripting problems drive me nuts. I have understood that dataset[variable] is semantically identical to dataset[, variable] cause dataset[variable] takes all cases because no other subscripts are given. Where can I lookup the rules

[R] Installing from source on Windows 7: tibble

2016-06-29 Thread G . Maubach
Hi All, I would like to install R packages from source on Windows 7 64-Bit. Currently my settings are: -- cut -- > sessionInfo() R version 3.3.0 (2016-05-03) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 locale: [1]

[R] Antwort: Re: dplyr : row total for all groups in dplyr summarise

2016-07-05 Thread G . Maubach
Hi guys, I checked out your example but I can't follow the results.: > mtcars %>% + group_by (am, gear) %>% + summarise (n=n()) %>% + mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>% + ungroup() %>% + mutate(row.tot = sum(n)) Source: local data frame [4 x 5] am gear

[R] Formatting ggplot2 graph

2016-07-06 Thread G . Maubach
Hi All, my current code looks lke this: freq_ls <- structure(list(Var1 = c("zldkkd", "aakdkdk", "aaakdkd", "aaieiwo", "vöalsl", "ssddkdk", "glowowp", "laoiw", "ruklow", "rolsl",

[R] Choropleth: Turnover by ZipCode

2016-07-11 Thread G . Maubach
Hi All, Dear Readers, I need to create a choropleth graph with turnover by zipcode. This is what I have so far: # Not run (Begin) # Install packages if needed # install.packages(pkgs = c("maptools", "rgdal", "RColorBrewer", "grDevices")) # Not run (End) # Load libraries library(maptools);

[R] Antwort: Re: Dump of new Methods (SOLVED)

2016-07-04 Thread G . Maubach
Hi Bert, many thanks. Found them. Kind regards Georg Von:Bert Gunter An: g.maub...@weinwolf.de, Datum: 04.07.2016 16:43 Betreff:Re: [R] Dump of new Methods ?getwd Cheers, Bert Bert Gunter "The trouble with having an open mind is that people

[R] WG: Fw: Re: dplyr : row total for all groups in dplyr summarise

2016-07-06 Thread G . Maubach
Hi All, if I run the suggested code mtcars %>% group_by (am, gear) %>% summarise (n = n()) %>% mutate(rel.freq = paste0(round(100 * n / sum(n), 0), "%")) %>% ungroup() %>% plyr::rbind.fill(data.frame(n = nrow(mtcars), rel.freq = "100%”)) I

[R] Writing a formula to Excel

2016-06-30 Thread G . Maubach
Hi All, I am using excel.link to work seemslessly with Excel. In addition to values, like numbers and strings, I would like to insert a full operational formula into a cell. xlc["G14"] <- print(paste("=G9*100/G6"), quote = FALSE) The strings is put into the cell, but the cell is not

[R] Antwort: Re: Antwort: Re: Antwort: Re: Installing from source on Windows 7: tibble [RE OPENED]

2016-06-30 Thread G . Maubach
Hi Duncan, I would not have changed the COMPILED_BY option unless I thought I have to. In my "C:\R-Project\Rtools\mingw_32\bin" I have c++.exe g++.exe gcc.exe i686-w64-mingw32-c++.exe i686-w64-mingw32-g++.exe i686-w64-mingw32-gcc-4.9.3.exe i686-w64-mingw32-gcc.exe In my

Re: [R] Documenting data

2016-06-30 Thread G . Maubach
Hi Pito, Dear Readers, as other have already mentioned, there are good practices for documenting code and data. I would like to summarize them and add a few not mentioned earlier: 1. You should have always two things: your raw data and your R script/s. The raw data is immutable whereas the R

Re: [R] Documenting data

2016-06-30 Thread G . Maubach
Hi Bert, Hi Readers, I did not know much about attributes in R and how to use them. If it is that flexible you are right and I have learnt something. Kind regards Georg > Gesendet: Donnerstag, 30. Juni 2016 um 20:06 Uhr > Von: "Bert Gunter" > An: g.maub...@gmx.de >

[R] Antwort: Re: Installing from source on Windows 7: tibble

2016-06-29 Thread G . Maubach
Hi Duncan, many thanks for your reply. I did insert die paths to the g++ compiler because I got the message about the not existent compiler. I took the directories for the compiler out again: C:\R-Project\Rtools\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Python

[R] Antwort: Re: Antwort: Re: Installing from source on Windows 7: tibble [SOLVED]

2016-06-29 Thread G . Maubach
Hi Duncan, indeed, I did not see the other part of your message. I did BINPREF ?= C:/R-Project/Rtools/mingw_32/bin/ COMPILED_BY = g++ # instead of gcc-4.9.3 in "C:\R-Project\R-3.3.0\etc\i386\Makeconf" and BINPREF ?= C:/R-Project/Rtools/mingw_64/bin/ COMPILED_BY = g++ # instead of gcc-4.9.3

[R] Dump of new Methods

2016-07-04 Thread G . Maubach
Dear Readers, Hi All, to drive my R knowlegde a bit further I followed the advice of some of you by reading Chambers: Programming with data. I tried some examples from the book: -- cut -- setClass("track", representation (x = "numeric", y = "numeric"))

[R] Antwort: Accessing an object using a string (SOLVED)

2016-08-15 Thread G . Maubach
Hi All, I found the function get() which returns an object. My whole function looks like this: -- cut -- #--- # Module: t_load_dataset.R # Author: Georg Maubach # Date : 2016-08-15 # Update

[R] Antwort: Re: Accessing an object using a string

2016-08-16 Thread G . Maubach
Hi Greg and all others who replied to my question, many thanks for all your answers and help. Currently I store all my objects in .GlobalEnv = Workspace. I am not yet familiar working with different environments nor did I see that this would be necessary for my analysis. Could you explain

[R] Installation of rJava fails

2016-08-17 Thread G . Maubach
Hi All, I try to install RWeka on Debian GNU Linux 8 Jessie (uname -a: 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64) which has a dependency to "rJava". I did apt-get install openjdk-8-jre which went OK. Java is installed in: /var/lib/dpkg/alternatives/java

[R] Authentication and Web Site Scraping

2017-01-21 Thread G . Maubach
Hi All, I would like to learn how to scrape a web site which is password protected. I do my training with my Delicious web site. I will obey all rules and legislation existent. The delicious export api was shut down. I assume that the web site will be shut down in the foreseeable future. In

[R] Antwort: Re: Antwort: Re: packrat: Failed to download current version of foreign(0.8-67)

2017-02-21 Thread G . Maubach
Packrat does a beautiful job, creating local project repositories of all used libraries. If only one library is missing the complete repository is not stored. Having all but one library in the repository is far better than having none. I suggest to change the behaviour of packrat to store all

[R] Antwort: Re: RStudio: Place for Storing Options

2017-02-20 Thread G . Maubach
Hi Martin, Hi Ulrik, I am still working on the answer. I got a message from RStudio team but I am still working on the clearification of the answer and a possible solution. Kind regards Georg Von:Martin Maechler An: , Kopie:

[R] packrat: Failed to download current version of foreign(0.8-67)

2017-02-20 Thread G . Maubach
Hi All, I tried to use packrat on R version 3.3.2 (2016-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 locale: [1] LC_COLLATE=German_Germany.1252 [2] LC_CTYPE=German_Germany.1252 [3] LC_MONETARY=German_Germany.1252 [4] LC_NUMERIC=C

[R] Antwort: Re: packrat: Failed to download current version of foreign(0.8-67)

2017-02-20 Thread G . Maubach
Hi Mr. Ligges, doing as you said R responds with install.packages("foreign") trying URL 'https://cran.uni-muenster.de/bin/windows/contrib/3.3/foreign_0.8-67.zip' Warning in install.packages : cannot open URL 'https://cran.uni-muenster.de/bin/windows/contrib/3.3/foreign_0.8-67.zip': HTTP

[R] Antwort: Re: RStudio: Place for Storing Options

2017-02-23 Thread G . Maubach
Hi Martin, the command %localappdata%\RStudio-Desktop gives on my machine "The command is written wrong or could not be found.". I found "RStudio-Desktop" under C:\Users\\AppData\Local\RStudio-Desktop There references on created notebooks and presentations are stored in the folder

[R] RStudio: Place for Storing Options

2017-02-09 Thread G . Maubach
Hi All, I would like to make a backup of my RStudio IDE options I configure using "Tools/Global Options" from the menu bar. Searching the web did not reveal anything. Can you tell me where RStudio IDE does store its configuration? Kind regards Georg [[alternative HTML version

[R] xtable: Width of Columns

2017-03-02 Thread G . Maubach
Hi All, I have the following code in R Markdown document: ```{r, results = "asis", echo = FALSE} library(xtable) response <- as.data.frame(matrix(NA, 2, 2)) colnames(response) <- c("Anzahl", "Prozent") rownames(response) <- c("gesamte R�cksendungen (brutto) ",

[R] Iteration over variables

2016-09-06 Thread G . Maubach
Hi All, I would like to write a program that iterates over a set of dynamically generated variables and produces some stats or prints parts of the data. # --- data v_turnover_2011 <- c(10, 20, 30, 40 , 50) v_customer_2011 <- c(0, 1, NA, 0, 1) v_turnover_2012 <- c(10, 20, 30, 40 , 50)

[R] How to plot a bunch of dichotomous code variables in one plot using ggplot2

2016-10-05 Thread G . Maubach
Hi All, I have a bunch of dichotomous code variables which shall be plotted in one graph using one of their values, this is "1" in this case. The dataset looks like this: -- cut -- var1 <- c(1,0,1,0,0,1,1,1,0,1) var2 <- c(0,1,1,1,1,0,0,0,0,0) var3 <- c(1,1,1,1,1,1,1,1,0,1) ds <-

[R] Antwort: RE: How to plot a bunch of dichotomous code variables in one plot using ggplot2

2016-10-05 Thread G . Maubach
Hi Bob, Hi John, Hi readers, many thanks for your reply. I did barplot(colSums(dataset %>% select(FirstVar:LastVar))) and it worked fine. How would I do it with ggplot2? Kind regards Georg Von:"Fox, John" An: "g.maub...@weinwolf.de" ,

[R] Putting a bunch of Excel files as data.frames into a list fails

2016-09-28 Thread G . Maubach
Hi All, I need to read a bunch of Excel files and store them in R. I decided to store the different Excel files in data.frames in a named list where the names are the file names of each file (and that is different from the sources as far as I can see): -- cut -- # Sources: # -

[R] Storing long string with white space in variable

2016-10-19 Thread G . Maubach
Hi All, I would like to store a long string with white space in a variable: -- cut -- # Create README.md readme <- "--- title: "Your project title here" author: "Author(s) name(s) here" date: "Current date here" output: html_document --- ```{r setup, include=FALSE}

[R] for loop is looping only once

2016-11-17 Thread G . Maubach
Hi All, I need to execute a loop on variables to compute several KPIs. Unfortunately the for loop is executed only once for the last KPI given. The code below illustrates my current solution but is not completely necessary to spot the problem. I just give an idea what I am doing overall.

[R] Antwort: Re: for loop is looping only once [SOLVED]

2016-11-17 Thread G . Maubach
Hi Ulrik, oh no! What a mistake did I make. But I definitely did not see the failure. Many thanks for helping me. Kind regards Georg Von:Ulrik Stervbo An: g.maub...@weinwolf.de, r-help@r-project.org, Datum: 17.11.2016 12:24 Betreff:Re: [R] for

[R] Different results when converting a matrix to a data.frame

2016-11-16 Thread G . Maubach
Hi All, I build an empty dataframe to fill it will values later. I did the following: -- cut -- matrix(NA, 2, 2) [,1] [,2] [1,] NA NA [2,] NA NA > data.frame(matrix(NA, 2, 2)) X1 X2 1 NA NA 2 NA NA > as.data.frame(matrix(NA, 2, 2)) V1 V2 1 NA NA 2 NA NA -- cut -- Why does

[R] openxlsx Error: length of rows and cols must be

2016-11-15 Thread G . Maubach
Hi All, when using -- cut -- number_style <- openxlsx::createStyle( numFmt = "COMMA" ) openxlsx::addStyle( wb = xlsx_workbook, sheet = "Kundenliste", style = number_style, rows = 2:nrow(customer_list), cols = 4:5 ) --cut -- I get the

[R] Documenting a function using roxygen2

2016-10-11 Thread G . Maubach
Hi All, I began to document my functions using roxygen2. This is an example of a function I would like to write for training and testing purposes: t_simple_table <- function(variable, useNA = TRUE, print = FALSE) { #' @title Create a

[R] Visibility of libraries called from within functions

2016-10-13 Thread G . Maubach
Hi All, in my R programs I use different libraries to work with Excel sheets, i. e. xlsx, excel.link. When running chunks of code repeatedly and not always in the order the program should run for development purposes I ran into trouble. There were conflicts between the methods within these

[R] Antwort: Re: Antwort: Re: Visibility of libraries called from within functions

2016-10-13 Thread G . Maubach
Von:Duncan Murdoch An: g.maub...@weinwolf.de, r-help@r-project.org, Datum: 13.10.2016 12:34 Betreff:Re: Antwort: Re: [R] Visibility of libraries called from within functions On 13/10/2016 6:21 AM, g.maub...@weinwolf.de wrote: > Hi Duncan, > > many

[R] Antwort: Re: Visibility of libraries called from within functions

2016-10-13 Thread G . Maubach
Hi Duncan, many thanks for your reply. Your suggestion of using requireNamespace() together with explicit namespace calling using the "::" operator is what I was looking for: -- cut -- f_test <- function() { requireNamespace("openxlsx") cat("Loaded packages AFTER loading library")

[R] Reshaping geographic data

2016-10-17 Thread G . Maubach
Hi All, I need to reshape an ESRI shape file: http://arnulf.us/PLZ and resp http://www.metaspatial.net/download/plz.tar.gz I found an instruction for T-SQL Server: https://blog.oraylis.de/2010/05/german-map-spatial-data-for-plz-postal-code-regions/ How can I do this using R? Kind regards

[R] SOLVED: Re: Source into a specified environment

2017-01-09 Thread G . Maubach
Hi Jim, many thanks for your answer. That's exactly what I need. Many thanks again. Kind regards Georg Von:jim holtman An: g.maub...@weinwolf.de, Kopie: R mailing list Datum: 10.01.2017 03:59 Betreff:Re: [R] Source into a

[R] openxlsx: No Formatting of Numbers

2016-12-05 Thread G . Maubach
Hi All, Dear Readers, I am using openxlsx to export data to Microsoft Excel 2013, 32-Bit, German Version: --- schnipp --- library("openxlsx") dataset <- structure( list( a = c(1126039.81, 45636.44, 14847.41), b = c(1194447.5, 88310.53, 18699.68), c = c(1560307.73,

[R] openxlsx: No Formatting of Numbers (TEXT ONLY)

2016-12-05 Thread G . Maubach
Hi All, Dear Readers, I am using openxlsx to export data to Microsoft Excel 2013, 32-Bit, German Version: --- schnipp --- library("openxlsx") dataset <- structure( list( a = c(1126039.81, 45636.44, 14847.41), b = c(1194447.5, 88310.53, 18699.68), c = c(1560307.73,

[R] Source into a specified environment

2017-01-09 Thread G . Maubach
Hi All, I wish everyone a happy new year. I have the following code: -- cut -- modules <- c("t_calculate_RFM_model.R", "t_count_na.R", "t_export_table_2_xls.R", "t_find_duplicates_in_variable.R", "t_find_originals_and_duplicates.R", "t_frequencies.R",

[R] Assessing the name of an object within an argument

2017-01-10 Thread G . Maubach
Hi All, I have a function like my_func <- function(dataset) { some operation } Now I would like not only to operate on the dataset (how this is done is obvious) but I would like to get the name of the dataset handed over as an argument. Example: my_func <- function(dataset = iris) {

[R] Way to Plot Multiple Variables and Change Color

2017-03-28 Thread G . Maubach
Hi All, in my current project I have to plot a whole bunch of related variables (item batteries, e.g. How do you rate ... a) Accelaration, b) Horse Power, c) Color Palette, etc.) which are all rated on a scale from 1 .. 4. I need to present the results as stacked bar charts where the variables

[R] Antwort: Re: Way to Plot Multiple Variables and Change Color

2017-03-28 Thread G . Maubach
Hi Richard, many thanks for your reply. Your solution is not exactly what I was looking for. I would like to know how I can change the colors of the stacked bars in my plot and not use the default values. How can this be done? Kind regards Georg Von:"Richard M. Heiberger"

[R] Antwort: Re: Way to Plot Multiple Variables and Change Color

2017-03-28 Thread G . Maubach
Hi Ulrik, your answer is very valuable to me. If you do not know what I do, others don't either. So I should definitely adapt my code. The result of your code and my code is the same. Thus, I use your code cause it is better readable. My other question was how I can change the color palette

[R] ggplot2: Adjusting title and labels

2017-03-16 Thread G . Maubach
Hi All, I have a question to ggplot 2. My code is the following: -- cut -- library(ggplot2) library(scales) df <- data.frame(group = c("Male", "Female", "Child"), value = c(25, 25, 50)) blank_theme <- theme_minimal() + theme( axis.title.x = element_blank(), axis.title.y =

[R] Antwort: Re: Antwort: Re: Way to Plot Multiple Variables and Change Color

2017-04-10 Thread G . Maubach
Hi Ulrik, many thanks for your reply. I had to take an unplanned break and was not in the office during the last two weeks. Thus my late reply. I followed your advice and converted the variable in argument "fill" to factor. Now the color change works: -- cut -- d_result <-

[R] Antwort: Re: Antwort: Re: Antwort: Re: Way to Plot Multiple Variables and Change Color (SOLVED)

2017-04-11 Thread G . Maubach
Hi David, many thanks for your answer. I followed your suggesting and came up with the following code: -- cut -- ggplot( d_result, aes(x = variable, y = n, fill = value)) + geom_bar( stat = "identity") + coord_cartesian(ylim = c(0,100)) + coord_flip() + scale_y_continuous(name

  1   2   >