Re: [R] using pdf(file="") encount a Chinese garbled

2014-09-11 Thread Jinsong Zhao
On 2014/9/11 21:10, PO SU wrote: Dear expeRts, When i use the following codes: pdf(file="1.pdf",width=15) plot(1:3,main="你好") dev.off() #There were 12 warnings (use warnings() to see them) I find that "你好" can't show correctly in pdf file, but i just plot(1:3,main="你好")

[R] using pdf(file="") encount a Chinese garbled

2014-09-11 Thread PO SU
Dear expeRts,     When i use the following codes:     pdf(file="1.pdf",width=15)     plot(1:3,main="你好")     dev.off() #There were 12 warnings (use warnings() to see them)   I find that "你好" can't show correctly in pdf file, but  i just   plot(1:3,main="你好") to R plot viewer, it's ok .   Is there

[R] mice - undefined columns selected

2014-09-11 Thread Jeremy Miles
I've got a problem with the mice package that I don't understand. Here's the code: library(mice) d <- read.csv("https://dl.dropboxusercontent.com/u/24381951/employment.csv";, as.is=TRUE, row.names=1)d.imp <- mice(data=d, m=1) Result is: Error in `[.data.frame`(data, , jj) : undefined columns sel

Re: [R] How to test for open pdf file on Windows before calling cairo_pdf ?

2014-09-11 Thread Henrik Bengtsson
A poor mans solution would be to try to temporarily delete or move the file, depending exactly what you wish to do. You can also try: library("R.utils") pathname <- Arguments$getWritablePathname("file2.pdf", mustNotExist=FALSE) which does lots of assertions of write permissions of new and existin

Re: [R] Margins to fill matrix

2014-09-11 Thread Stefan Petersson
Yes! That's excactly what I need. Thank You so much! Den 11 sep 2014 21:20 skrev "David L Carlson" : > You want r2dtable(): > > > ?r2dtable > > set.seed(42) > > a <- r2dtable(1, seats, mandates) > addmargins(a[[1]]) > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] > [1,]2310

[R] weird install package error

2014-09-11 Thread Yuan Luo
Hi, I am getting an error installing the MASS package. Googling suggests restarting R, but it didn't help. Anyone has a clue? Many thanks, Yuan > install.packages("MASS") Installing package into ‘/PHShome/yl960/R/3.0’ (as ‘lib’ is unspecified) trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/cont

Re: [R] Margins to fill matrix

2014-09-11 Thread David Winsemius
On Sep 11, 2014, at 5:13 AM, Stefan Petersson wrote: > I have : > > rs <- c(3, 2, 3, 4) > cs <- c(4, 5, 3) > > And want: > >> matrix >[,1] [,2] [,3] > [1,] 120 > [2,] 101 > [3,] 111 > [4,] 121 > > The rowSums in the above matrix is equal to sum(rs) and colS

[R] How to test for open pdf file on Windows before calling cairo_pdf ?

2014-09-11 Thread Kevin Wright
On Windows: The pdf("file1.pdf") command will throw an error if the file1.pdf is open in a viewer. For example: pdf("file1.pdf") plot(1:10) dev.off() shell.exec("file1.pdf") pdf("file1.pdf") # Causes an error As suggested by the help page for file.access(), I normally use try(pdf("file1.pdf"))

Re: [R] Margins to fill matrix

2014-09-11 Thread David L Carlson
You want r2dtable(): > ?r2dtable > set.seed(42) > a <- r2dtable(1, seats, mandates) addmargins(a[[1]]) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,]23106212 17 [2,]8011 11021 24 [3,]8052711

Re: [R] incorrect number of dimensions

2014-09-11 Thread David L Carlson
Look below to see what happens to your formatting when you use html. Don't use html. Why do you use x='df' in defining the function df is a data frame with 5 observations and 4 variables. 'df' is a character vector of length 1. Your function is looking for a data frame (or matrix) with at least

Re: [R] How to plot soil moisture data as a contour plot

2014-09-11 Thread Thiago V. dos Santos
David, Thanks a lot for your sugestion, it solved my problem! Greetings, -- Thiago V. dos Santos PhD student Land and Atmospheric Science University of Minnesota http://www.laas.umn.edu/CurrentStudents/MeettheStudents/ThiagodosSantos/index.htm Phone: (612) 323 9898 On Wednesday, September 10,

Re: [R] Building R for better performance

2014-09-11 Thread Anspach, Jonathan P
Yes, that's the original. Then TACC increased the matrix sizes for their tests. Jonathan Anspach Intel Corp. Sent from my mobile phone. On Sep 11, 2014, at 9:18 AM, "Henrik Bengtsson" mailto:h...@biostat.ucsf.edu>> wrote: You'll find R-benchmark-25.R, which I assume is the same and the proper

[R] incorrect number of dimensions

2014-09-11 Thread Marie-Eve St-Onge
Dear all, I'm trying the following experiment simulation, but I'm receiving this error: > probs()Error in x[j, 4] : incorrect number of dimensions however, the simulation works fine outside the function statement{}. What am I doing wrong? # Create some fake data and call the function: df <- data.

Re: [R] Question about searchTwitter{twitteR}

2014-09-11 Thread Cory N
You are only able to search twitter history for a short period of time. gnip.com and similar companies offer historical tweets for sale. cn On Sunday, September 7, 2014 9:21:34 AM UTC-5, Axel Urbiz wrote: > > Hello, > > The function searchTwitter() with the arguments supplied as below would >

Re: [R] R, Big Data and books

2014-09-11 Thread Mohan Radhakrishnan
This too. Applied Predictive Modeling Max Kuhn • Kjell Johnson Thanks, Mohan On Tue, Sep 9, 2014 at 10:03 PM, Subba Rao wrote: > Hi, > > I am interested in R programming in the Big Data space. Are there any > books that would be a good starting point for this career path? > Predictive analy

Re: [R] create new column by replacing multiple unique values in existing column

2014-09-11 Thread John McKown
On Thu, Sep 11, 2014 at 10:49 AM, raz wrote: > Hi, > > I got the following data frame: > dat1 <- read.table(text="a,b > 1,A1 > 2,A1 > 3,A1 > 4,A1 > 5,A1 > 6,A2 > 7,A2 > 8,A2 > 9,A2 > 10,A2 > 11,B1 > 12,B1 > 13,B1 > 14,B1 > 15,B1",sep=",",header=T) > > > I would like to add a new column dat1$new b

Re: [R] create new column by replacing multiple unique values in existing column

2014-09-11 Thread David L Carlson
Note that in the data you sent, b is a factor: > str(dat1) 'data.frame': 15 obs. of 2 variables: $ a: int 1 2 3 4 5 6 7 8 9 10 ... $ b: Factor w/ 3 levels "A1","A2","B1": 1 1 1 1 1 2 2 2 2 2 ... So all you need is > dat1$new <- as.numeric(dat1$b) > table(dat1$new) > table(dat1$new) 1 2 3 5

[R] create new column by replacing multiple unique values in existing column

2014-09-11 Thread raz
Hi, ​I got the following data frame: dat1 <- read.table(text="a,b 1,A1 2,A1 3,A1 4,A1 5,A1 6,A2 7,A2 8,A2 9,A2 10,A2 11,B1 12,B1 13,B1 14,B1 15,B1",sep=",",header=T) ​ ​I would like to add a new column dat1$new based on column "b" (dat$b) in which values will be substituted according to their un

Re: [R] some question about vector[-NULL]

2014-09-11 Thread Philippe GROSJEAN
..<°}))>< ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons University, Belgium ( ( ( ( ( .. On 11 Sep 2014,

Re: [R] some question about vector[-NULL]

2014-09-11 Thread Duncan Murdoch
On 11/09/2014 3:29 AM, Philippe GROSJEAN wrote: On 11 Sep 2014, at 08:24, PIKAL Petr wrote: > Hi > > You still do not disclose important info about details of your functions. However, when you want to perform indexing like you show, you maybe can get rid of NULL and use zero instead. > >> a<-

Re: [R] Building R for better performance

2014-09-11 Thread Henrik Bengtsson
You'll find R-benchmark-25.R, which I assume is the same and the proper pointer to use, at http:// r.research.att.com /benchmarks/ Henrik I'm out of the office today, but will res

Re: [R] Building R for better performance

2014-09-11 Thread Anspach, Jonathan P
I'm out of the office today, but will resend it tomorrow. Jonathan Anspach Intel Corp. Sent from my mobile phone. On Sep 11, 2014, at 3:49 AM, "arnaud gaboury" wrote: >>> I got the benchmark script, which I've attached, from Texas Advanced >>> Computing Center. Here are my results (elapsed ti

Re: [R] Margins to fill matrix

2014-09-11 Thread Stefan Petersson
I have : rs <- c(3, 2, 3, 4) cs <- c(4, 5, 3) And want: > matrix [,1] [,2] [,3] [1,] 120 [2,] 101 [3,] 111 [4,] 121 The rowSums in the above matrix is equal to sum(rs) and colSums is equal to sum(cs). It's sort of a matrix expansion where the margins are know

Re: [R] Margins to fill matrix

2014-09-11 Thread Charles Determan Jr
Do you have an example of what you would like your output to look like? It is a little difficult to fully understand what you are looking for. You only have 18 values but are looking to fill at 10x8 matrix (i.e. 80 values). If you can clarify better we may be better able to help you. Charles

Re: [R] some question about vector[-NULL]

2014-09-11 Thread Philippe GROSJEAN
On 11 Sep 2014, at 08:24, PIKAL Petr wrote: > Hi > > You still do not disclose important info about details of your functions. > However, when you want to perform indexing like you show, you maybe can get > rid of NULL and use zero instead. > >> a<-1:5 >> a[-c(1,3)] > [1] 2 4 5 >> a[-c(0,1,3)

[R] Linkage disequilibrium plot

2014-09-11 Thread Sabine Siegert
Hi, I want to generate a LD plot that looks like the triangle in the lower part of the output of snp.plotter() As I would not use the values of the original LD measure (instead I use a more general measure) I have calulated pairwise "correlation" on my own. I could arrange the results in a data

Re: [R] marketing-questionnaire with split-design

2014-09-11 Thread Jim Lemon
On Thu, 11 Sep 2014 08:58:54 PM Jim Lemon wrote: Sorry, copying fumble. The last line in the loop should read: sum(nddf[subject,seq(2,10,by=2)])) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] marketing-questionnaire with split-design

2014-09-11 Thread Jim Lemon
On Tue, 9 Sep 2014 04:42:11 PM Norbert Dörrer wrote: > Dear Experts > > I'm quite new to the world of R; so maybe my question is kind of > beginners... > > I am right now trying to analyse questionnaire data (CAWI) for producing a > image/positioning map of the competitors of my company; when p

Re: [R] some question about vector[-NULL]

2014-09-11 Thread Duncan Murdoch
On 11/09/2014, 6:04 AM, PO SU wrote: > > > Actually, i thought the way: > a<-1:3 > b<-NULL or 2 > a[-b] will not work if b is NULL > > A<-c(a,1) If a is a long vector, that is a very expensive operation, at least as expensive as constructing a logical vector of the same length as a. > B<-c(b

Re: [R] sequential input script dataframe process functionality

2014-09-11 Thread rl
On 2014-09-10 10:45, PIKAL Petr wrote: On 2014-09-08 15:47, William Dunlap wrote: > d <- data.frame(Choices=c("One","Two","One","Three"), X=1:4) > i <- 1 # possible output of menu(unique(d$Choices)) > d[ d$Choices[i] == d$Choices, ] > # Choices X > #1 One 1 > #3 One 3 > > testd <- data

Re: [R] some question about vector[-NULL]

2014-09-11 Thread PO SU
Actually, i  thought  the way: a<-1:3 b<-NULL or 2 a[-b] will not work if b is NULL A<-c(a,1) B<-c(b,length(A)) A[-B] will get the same result as if b is NULL get a, if b is 2 get a[-2] I think it works well  in considering memory use or efficiency or code tidy. -- PO SU mail: desolato...@

Re: [R] some question about vector[-NULL]

2014-09-11 Thread PO SU
Orignally i don't want to do the if ( length) check because i know that in a 1 loops, after may be 10 or 20 or 100 loops , "i" will not be empty. so i mean , in the left loops, i would always check something not needed to check which i would not like to do.   -- PO SU mail: desolato...@1

Re: [R] How to get JRI package

2014-09-11 Thread Pascal Oettli
Please check this link, particularly the red line: http://rforge.net/JRI/ Regards, Pascal On Thu, Sep 11, 2014 at 6:44 PM, madhvi.gupta wrote: > I already have rjava.JRI package is for r java interface > > On 09/11/2014 02:44 PM, Pascal Oettli wrote: >> >> Hi, >> >> As far as I know, there is an

Re: [R] some question about vector[-NULL]

2014-09-11 Thread Duncan Murdoch
On 10/09/2014, 9:53 PM, PO SU wrote: > > Tks, i think using logical index is a way, but to do that, i have to keep a > vector as long as the original vector. that's, to exclude position 1 and 3 > from > a<-1:5 > I have to let b<-c(F,T,F,T,T) and exec a[b], not a[-c(1,3)]. which c(1,3) is > muc

Re: [R] How to get JRI package

2014-09-11 Thread Pascal Oettli
Hi, As far as I know, there is any package "JRI". You need to install "rJava". Regards, Pascal On Thu, Sep 11, 2014 at 6:08 PM, madhvi.gupta wrote: > Hi, > My R Studio version is 3.1.0 but JRI package is not getting installed on > it.It is giving the following error. > package ‘JRI’ is not avai

Re: [R] R, Big Data and books

2014-09-11 Thread Angel Rodriguez
Sorry for that, Glenn. http://statweb.stanford.edu/~tibs/ElemStatLearn/ Have also a look at this that I've run into: http://codecondo.com/9-free-books-for-learning-data-mining-data-analysis/ Best regards, Angel De: Glenn Doherty [mailto:glennrdohe...@gmail.com] Enviado el: miércoles, 10 de s

[R] How to get JRI package

2014-09-11 Thread madhvi.gupta
Hi, My R Studio version is 3.1.0 but JRI package is not getting installed on it.It is giving the following error. package ‘JRI’ is not available (for R version 3.1.0) Is there any another way to do this? Thanks __ R-help@r-project.org mailing list ht

Re: [R] Building R for better performance

2014-09-11 Thread arnaud gaboury
>> I got the benchmark script, which I've attached, from Texas Advanced >> Computing Center. Here are my results (elapsed times, in secs): Where can we get the benchmark script? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

[R] Margins to fill matrix

2014-09-11 Thread Stefan Petersson
Hi, I have two vector of margins. Now I want to create "fill" matrix that reflects the margins. seats <- c(17,24,28,30,34,36,40,44,46,50) mandates <- c(107,23,24,19,112,19,25,20) Both vectors adds up to 349. So I want a 10x8 matrix with row sums corresponding to "seats" and column sums corresp

Re: [R] some question about vector[-NULL]

2014-09-11 Thread PIKAL Petr
Hi If you insist on this behaviour you need to redefine [ function to suit your needs. You can see there is already plenty of methods for this operator. > methods("[") [1] [.acf* [.arrow* [.AsIs [.bibentry* [5] [.data.frame [.Date [.difftime

Re: [R] some question about vector[-NULL]

2014-09-11 Thread PO SU
It really suprise me that a[-c(0,1,2)] works as a[-c(1,2)]. But, unfortunately, a[-0] still can't work . That 's mean: i want: a<-1:3 a[-0] > 1 2 3 or a[-NULL] > 1 2 3 -- PO SU mail: desolato...@163.com Majored in Statistics from SJTU At 2014-09-11 02:24:25, "PIKAL Petr" wrote: >Hi > >Y