[R] WG: Fw: Re: rmarkdown and font size

2017-06-12 Thread G . Maubach
Hi Dan, Hi All, I read the below post. I am wondering how do I know which "keys" are available, e.g. "core.r" and "pre". Where kind I find the definition of what can be adjusted and which "words" to use? Kind regards Georg > Gesendet: Donnerstag, 08. Juni 2017 um 16:16 Uhr > Von: "Nordlund,

[R] Antwort: Re: Re: Paths in knitr

2017-06-12 Thread G . Maubach
Hi Yihui, I took root.dir and base.dir out. Everything works fine despite the change. I have implemented the solution Duncun suggested. I have difficulties with the scaling / image size in my report. Some plots are too big, some are too small. I need to adjust any plot. Steep learning curve :)

Re: [R] Paths in knitr

2017-06-12 Thread G . Maubach
Hi Yihui, Hi Duncan, I corrected my typo. Unfortunately knitr did not find my plots in the directory where they reside which is different from the Rmd document. The documentation of knitr says: base.dir: (NULL) an absolute directory under which the plots are generate root.dir: (NULL) the root d

[R] Paths in knitr

2017-06-08 Thread G . Maubach
Hi All, I have to compile a report for the management and decided to use RMarkdown and knitr. I compiled all needed plots (using separate R scripts) before compiling the report, thus all plots reside in my graphics directory. The RMarkdown report needs to access these files. I have defined ```

[R] purrr::pmap does not work

2017-06-07 Thread G . Maubach
Hi All, I try to do a scatterplot for a bunch of variables. I plot a dependent variable against a bunch of independent variables: -- cut -- graphics::plot( v01_r01 ~ v08_01_up11, data = dataset, xlab = "Dependent", ylab = "Independent #1" ) -- cut -- It is tedious to repeat the stateme

[R] ggplot: Pie Chart with correct labels

2017-05-30 Thread G . Maubach
Hi All, I would like to do the following pie chart using ggplot from an official data source ( http://www.deutscheweine.de/fileadmin/user_upload/Website/Service/Downloads/Statistik_2016-2017-neu.pdf , Tab 8, Page 14): -- cut -- cat("# weinimport_piechart.R\n") # -- Input -

[R] Off-Topic: Project Organisation

2017-05-11 Thread G . Maubach
Hi All, this post is somewhat off-topic cause it deals with a meta issue related to project organisation instead of real R code. I have updated my blog concerning a possible directory and file structure for marketing research projects and data mining projects alike: https://github.com/gmaubach

[R] Antwort: RE: Antwort: Re: Factors and Alternatives (SOLVED)

2017-05-09 Thread G . Maubach
Hi David, Hi Bob, many thanks for your help. Your solution - just to use all levels instead of just the one's found in the data - helped. The original code looked like this: -- cut -- c_v10_val_labs <- c( "1 = sehr gut", "2", "3", "4", "5", "6 = sehr schlecht" ) # where c_v10_val_labs

[R] Antwort: Re: Factors and Alternatives

2017-05-09 Thread G . Maubach
Hi Bob, many thanks for your reply. I have read the documentation. In my current project I use "item batteries" for dimensions of touchpoints which are rated by our customers. I wrote functions to analyse them. If I create a factor before filtering and analysing I lose the original values of t

[R] Factors and Alternatives

2017-05-09 Thread G . Maubach
Hi All, I am using factors in a study for the social sciences. I discovered the following: -- cut -- library(dplyr) test1 <- c(rep(1, 4), rep(0, 6)) d_test1 <- data.frame(test) test2 <- factor(test1) d_test2 <- data.frame(test2) test3 <- factor(test1, levels = c(0, 1),

[R] Antwort: Re: Multiple-Response Analysis: Cleaning of Duplicate Codes (SOLVED)

2017-04-26 Thread G . Maubach
Hi Bert, many thanks for your reply. I appreciate your help a lot. I would like to do the operation (= finding the duplicates) row-wise. During this night a solution showed up in my dreams :) Instead of using duplicates() to flag and filter the values I could use unique instead with the same r

[R] Antwort: Re: Multiple-Response Analysis: Cleaning of Duplicate Codes (SOLVED)

2017-04-26 Thread G . Maubach
Hi Bert, many thanks for your reply. I appreciate your help a lot. I would like to do the operation (= finding the duplicates) row-wise. During this night a solution showed up in my dreams :) Instead of using duplicates() to flag and filter the values I could use unique instead with the same r

[R] Multiple-Response Analysis: Cleaning of Duplicate Codes

2017-04-25 Thread G . Maubach
Hi All, in my current project I am working with multiple-response questions (MRSets): -- Coding -- 100 Main Code 1 110 Sub Code 1.1 120 Sub Code 1.2 130 Sub Code 1.3 200 Main Code 2 210 Sub Code 2.1 220 Sub Code 2.2 230 Sub Code 2.3 300 Main Code 3 310 Sub Code 3.1 320 Sub Code 3.2 The coding

[R] Follow-up: RStudio: Place for Storing Options (as plain text)

2017-04-19 Thread G . Maubach
Hi All, some time ago I asded a question about the places where RStudio stores it configuration information. I came across this posting https://support.rstudio.com/hc/en-us/articles/206382178?version=1.0.136&mode=desktop explaining RStudio keybindings (predefined and customized). At the end of

[R] ggplot2: ..n.. and ..count.. in geom_text

2017-04-18 Thread G . Maubach
Hi All, I have the following code: -- cut (g03_02_p02 <- ggplot(data = d_kzb_input) + geom_bar( mapping = aes(x = v03_02_r01, y = round(..prop.. * 100, 0)), fill = c_ww_palette["blue"]) + scale_y_continuous(limits = c(0, c_y_limit)) + theme_classic() + ggtitle(paste0("Question 3

[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 =

[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 <- structure(list("var

Re: [R] Archive format

2017-04-08 Thread G . Maubach
Hi Joe, I have read your question with great interest. I am a little bit astonished to read about your project. There is a big national institute in Germany called GESIS (https://de.wikipedia.org/wiki/GESIS_%E2%80%93_Leibniz-Institut_f%C3%BCr_Sozialwissenschaften) which does the same job you a

[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 fo

[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" An: g.m

[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] 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 = el

[R] Antwort: Re: Approach for Storing Result Data

2017-03-09 Thread G . Maubach
Hi Gunter, Hi Jeff, Hi Readers, many thanks for your reply. My questions seems to be a little off topic cause it is not about using the programming language itself but how to use it in a analytics context. It is about processes and approaches of how to do things in R from a conception point of

[R] Approach for Storing Result Data

2017-03-08 Thread G . Maubach
Hi All, today I have a more general question concerning the approach of storing different values from the analysis of multiple variables. My task is to compare distributions in a universe with distributions from the respondents using a whole bunch of variables. Comparison shall be done on rela

[R] Follow-up: RStudio: Place for Storing Options (as plain text)

2017-03-08 Thread G . Maubach
Hi All, I got a late reply from RStudio Support concerning the question where RStudio store options and configurations: -- cut -- The post RStudio Config Files has a new comment. . . . Unfortunately, it's unlikely that we'll be able to provide a programmatic R interface in the near future --

[R] Follow-up: RStudio: Place for Storing Options

2017-03-08 Thread G . Maubach
Hi All, I got a late reply from RStudio Support concerning the question where RStudio store options and configurations: -- cut -- The post RStudio Config Files has a new comment. . . . Unfortunately, it's unlikely that we'll be able to provide a programmatic R interface in the near future --

[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) ", "auswertbar

[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 "RStudio-

[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 l

[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 stat

[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: Ulrik Stervbo , R-help mailing list Datum: 09.02.20

[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 [5

[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 delete

[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 my

[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) { prin

[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 specified environment ?sys.source Here is a

[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", "t_inspect_data

[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, 34203

[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, 34203

[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 loop is looping only once

[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. Looks

[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 data.

[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 error

[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} knitr::opts_chunk$set(echo

[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 Geo

[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 thanks for your reply. > > Y

[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] 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 fun

[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 simp

[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" , Kopie: "r-help@r-project.org" Datum: 05.

[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 <- data.frame(var

[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: # - http://stackove

[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) v_customer_

[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 /usr/lib/

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

2016-08-15 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 why

[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] 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")) # Define

[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] 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] LC_TIME=de_

[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 dea

[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); libr

[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", "delk

[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] 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] 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 keep coming along and st

[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")) trac

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 > Cc: "Pito Salas" , "R Help"

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 sc

[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 evaluate

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

2016-06-29 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 "C:\R-Project\Rtools\m

[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 i

[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 3.5\Scripts\;C:\P

[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] LC_COLLATE=German_Germany.

[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 : 2016-06

[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 w

[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 wrot

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 sales.

[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

[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 rec

[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 f

[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] 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, 0

[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' erfolgr

[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] 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] Antwort: RE: Merging variables

2016-06-06 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 due

[R] Antwort: Re: Merging variables

2016-06-06 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 An:

[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 # Dat

[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: 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 , Datum: 01.06.2016 03:59 Betreff:

[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. Kin

[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 GNU/Lin

[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 a

[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 w

[R] Difference subsetting (dataset$variable vs. dataset["variable"]

2016-05-30 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: 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] 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", "ENSG0207431","ENSG0221312","ENSG00134940305",

[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", "L0

  1   2   >