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

2016-04-25 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', Reeller_K

Re: [R] ylim in barplot()

2016-04-25 Thread Ivan Calandra
Thank you David, That's a nice workaround using plotrix::barp(), but that doesn't explain why ylim doesn't work as intended (or at least, as I expect it to work), or why xpd has no influence when using devEMF::emf()... The problem with saving directly in RStudio is that it requires to manual

Re: [R] Using read.csv() to import data

2016-04-25 Thread Bert Gunter
Keep on reading. R functions (including analyses and even plots in some cases) pproduce objects with various structures that are then summarized and displayed by other functions (which also produce objects), sometimes automagically. To "export" results to files or other software you need to know h

Re: [R] Num to INT

2016-04-25 Thread Jeff Newmiller
Using Excel to prepare data can have many pitfalls that are Excel-specific and therefore off-topic here. Please provide a sample of your data (in CSV?) in the body of your next email along with the R code you used to import it, and be sure to send in plain text format because HTML email frequ

Re: [R] Using read.csv() to import data

2016-04-25 Thread charles rockson via R-help
Duncan, What about converting your anova results in R  back into csv or excel? Thanks Charles   From: Duncan Murdoch To: Jason Hernandez ; "r-help@r-project.org" Sent: Sunday, April 24, 2016 2:05 PM Subject: Re: [R] Using read.csv() to import data On 24/04/2016 4:30 PM, Jason Hern

[R] Num to INT

2016-04-25 Thread André Luis Neves
Hi there: I transformed four columns of values in my dataset into an integer using excel, but when I imported the dataset into R, it is still reading one of the columns as NUM. Then, I used as.integer function to convert the remaining column into INT, but unfortunately, it is replacing the values

Re: [R] CRAN package check results tabulated ... wasRe: Number of package in Ubuntu

2016-04-25 Thread David Winsemius
> On Apr 24, 2016, at 4:51 AM, boB Rudis wrote: > > Or grab https://cran.r-project.org/web/checks/check_results.rds and > read it w/o the need for scraping. > I had not realized there was a repository like that. However, I'm not sure what it means. It's not the same as the package listing on

[R] how to create initial configuraton for isoMDS

2016-04-25 Thread LiLi (Z)
Hi, I'm trying to use isoMDS to project a directed graph to 2-dim vectors, but I got an error. #here is the code to create the graph using igraph package and run isoMDS on it. library(igraph) library(MASS) g<-make_graph(c(1,2, 2,3, 2,4, 3,4, 4,5, 5,6, 3,6, 1,6, 2,5),directed=TRUE) dist<-distance

Re: [R] Please assist -- Unable to remove '-' character from char vector--

2016-04-25 Thread David Winsemius
> On Apr 25, 2016, at 2:32 AM, Sunny Singha > wrote: > > Thank you Jim, > The code did assist me to get the what I needed. > Also, I learnt that there are different types of dashes > (en-dash/em-dash/hyphen) as explained on this site : > http://www.punctuationmatters.com/hyphen-dash-n-dash-and-

Re: [R] ylim in barplot()

2016-04-25 Thread David L Carlson
If you are using a Windows system, you can Export the plot from RStudio and save it as a metafile without using package devEMF and it will crop the bars with xpd=FALSE. When I used devEMF on a Windows machine, the bars were not cropped with barplot() as you indicated, but when I switched to plot

Re: [R] Creating variables on the fly

2016-04-25 Thread MacQueen, Don
I'm going to assume that Kunden is a data frame, and it has columns (variables) with names like Umstatz_2011 and that you want to create new columns with names like Kunde_real_2011 If that is so, then try this (not tested): for (year in 2011:2015) { nmK <- paste0("Kunde_real_", year) nmU

[R] Using read.csv() to import data

2016-04-25 Thread charles rockson via R-help
First save your file as csv and then type the following in the consoleassignname assignname=read.csv(file.choose()) This would open up your dcouments file and then you can select the file you saved as csv. Cheers From: Jason Hernandez via R-help To: "r-help@r-project.org" Sent: S

[R] ylim in barplot()

2016-04-25 Thread EYSSAUTIER Stéphanie
Dear useRs, I'm having troubles with using ylim in barplot(): even though I reduce the y-scale using ylim, the bars still extend down to 0into the x-labels. The sample data is below, and here is the code. #This works fine but I would like to plot only from 50 to 70: barplot(t(mydata), beside=T

Re: [R] use switch or function in connecting different cases.

2016-04-25 Thread David L Carlson
What do you mean by "it didnt update itself?" You will get the same results on each run since you set the random seed to 1 when you call the function. As a result, each time you will get the same results. - David L Carlson Department of Anthropology Texas A&M

Re: [R] use switch or function in connecting different cases.

2016-04-25 Thread s ji
This is my current work.Now i am trying to use a function to do the normal distribution simulation. rm(list=ls()) t <- u<- mann<- rep(0, 45) Nsimulation<-function(S1,S2,Sds,nSims) { set.seed(1) for (sim in 1:nSims) { matrix_t <-matri

Re: [R] Using read.csv() to import data

2016-04-25 Thread David L Carlson
You can also use getwd() to see what folder/directory R is currently using and setwd("folder") to change it. Also list.files() lists all of the files in that current directory. The code you included assumes that the file is located in the root directory which is probably wrong. Try mammals <

Re: [R] Inserting a blank row to every other row

2016-04-25 Thread David L Carlson
This is basically Bert's solution, but simplifying one line. > z <- data.frame(a=1:3,b = letters[1:3]) > i <- seq_len(nrow(z)) > z <- dat[rep(i, each=2), ] > is.na(z[i*2, ]) <- TRUE > z ab 11a 1.1 NA 22b 2.1 NA 33c 3.1 NA - D

[R] [R-pkgs] New package: weightr (v. 1.0.0)

2016-04-25 Thread Katie Coburn
Greetings, R users! I'm excited and pleased to announce that the weightr package was released to CRAN today: https://cran.r-project.org/web/packages/weightr/ Our package provides a function for meta-analysts to implement the Vevea and Hedges (1995) weight-function model for publication bias in R

Re: [R] Please assist -- Unable to remove '-' character from char vector--

2016-04-25 Thread Sunny Singha
Thank you Jim, The code did assist me to get the what I needed. Also, I learnt that there are different types of dashes (en-dash/em-dash/hyphen) as explained on this site : http://www.punctuationmatters.com/hyphen-dash-n-dash-and-m-dash/ I achieved it by executing below command after going through

Re: [R] Please assist -- Unable to remove '-' character from char vector--

2016-04-25 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jim Lemon > Sent: Monday, April 25, 2016 9:10 AM > To: Sunny Singha > Cc: r-help ; Sandeep Singha > > Subject: Re: [R] Please assist -- Unable to remove '-' character from char > vector-- > > Hi Sun

Re: [R] Please assist -- Unable to remove '-' character from char vector--

2016-04-25 Thread Jim Lemon
Hi Sunny, Try this: # notice that I have replaced the fancy hyphens with real hyphens end<-c("2001-","1992-","2013-","2013-","2013-","2013-", "1993-2007","2010-","2012-","1984-1992","1996-","2015-") splitends<-sapply(end,strsplit,"-") last_bit(x) return(x[length(x)]) sapply(splitends,last_bit) J