[R] how to save object created by assign()

2010-11-19 Thread Jinsong Zhao
Hi there, When I run the following code, I could get correct objects (with correct values): for(i in 1:6) { #-- Create objects 'r.1', 'r.2', ... 'r.6' -- nam - paste(r,i, sep=.) assign(nam, 1:i) # save(nam, file = paste(nam, RData, sep = .)) } I hope to save the object

Re: [R] how to save object created by assign()

2010-11-19 Thread Jinsong Zhao
On 2010-11-19 22:37, Jinsong Zhao wrote: Hi there, When I run the following code, I could get correct objects (with correct values): for(i in 1:6) { #-- Create objects 'r.1', 'r.2', ... 'r.6' -- nam - paste(r,i, sep=.) assign(nam, 1:i) # save(nam, file = paste(nam, RData, sep = .)) } I hope

Re: [R] Where to download R .xls sample files?

2010-11-28 Thread Jinsong Zhao
On 2010-11-28 19:46, Stephen Liu wrote: Hi folks, Which R packages containing sample .xls files? TIA why do you need .xls format data file? B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Instrumental Variables Regression

2009-12-15 Thread Jinsong Zhao
Hi there, I hope to build a model Y ~ X1 + X2 + X3 + X4 with X1 has two instrumental variable A and B, and X2 has one instrumental variable A. I have searched the R site and mailling list, and known that the tsls() from sem package and ivreg() from AER package can deal with instrumental variable

[R] Rgui crashed on Windows XP Home

2010-06-11 Thread Jinsong Zhao
Hi there, I just installed R 2.11.1 on my PC, which runs a Windows XP Home. The installation is successful, however, when I double click on the R icon, I get the following error message: R for Windows GUI front-end has encountered a problem and needs to close. We are sorry for the

Re: [R] Rgui crashed on Windows XP Home

2010-06-12 Thread Jinsong Zhao
On 2010-6-12 5:58, Duncan Murdoch wrote: Jinsong Zhao wrote: Hi there, I just installed R 2.11.1 on my PC, which runs a Windows XP Home. The installation is successful, however, when I double click on the R icon, I get the following error message: R for Windows GUI front-end has encountered

[R] More than two font in a plot

2010-06-29 Thread Jinsong Zhao
, and it's not what I hope to get. I hope the Latin character is displayed in Helvetica. Any suggestions? Thanks in advance! Regards, Jinsong -- Jinsong Zhao, Ph.D. College of Resources and Environment Huazhong Agricultural University Wuhan 430070, P.R. China E-mail: jsz...@mail.hzau.edu.cn

Re: [R] More than two font in a plot

2010-06-30 Thread Jinsong Zhao
very much for your suggestion. tikz is a powerful graphic language, however, I am not familiar with it. Before this question, I add Chinese character to postscript file by LaTeX with psfrag. Regards, Jinsong -- Jinsong Zhao, Ph.D. College of Resources and Environment Huazhong Agricultural

Re: [R] More than two font in a plot

2010-06-30 Thread Jinsong Zhao
On 2010-6-30 7:06, Paul Murrell wrote: Hi On 6/30/2010 2:17 AM, Jinsong Zhao wrote: Hi there, I am a Chinese R user. I hope to display Chinese character in a plot, and than save it in PostScript format. I have read the article titled Non-Standard Fonts in PostScript and PDF Graphics

Re: [R] More than two font in a plot

2010-06-30 Thread Jinsong Zhao
On 2010-6-30 16:24, Patrick Connolly wrote: On Wed, 30-Jun-2010 at 11:06AM +1200, Paul Murrell wrote: Hi On 6/30/2010 2:17 AM, Jinsong Zhao wrote: Hi there, I am a Chinese R user. I hope to display Chinese character in a plot, and than save it in PostScript format. I have read the article

[R] plain text in Chinese can not be set

2010-06-30 Thread Jinsong Zhao
, font = 3) # italic dev.off() pdf(test_4.pdf, fonts = c(GB1)) plot(1:10) text(5,4, \u4F60\u597D, family=GB1, font = 4) ## symbol text(5,5, is 'hello' in Chinese, font = 4) # bold italic dev.off() -- Jinsong Zhao, Ph.D. College of Resources and Environment Huazhong Agricultural University Wuhan

Re: [R] plain text in Chinese can not be set

2010-06-30 Thread Jinsong Zhao
options in pdf(). But I do not have the ability to give a solution. Regards, Jinsong On 2010-7-1 7:14, Jinsong Zhao wrote: Hi there, According to ?par, 'font' is an integer which specifies which font to use for text, that 1 corresponds to plain text (the default), 2 to bold face, 3 to italic and 4

Re: [R] plain text in Chinese can not be set

2010-07-01 Thread Jinsong Zhao
On 2010-7-1 12:16, Jinsong Zhao wrote: Hi there, The following code can produce the correct type face, however, the Latin character are displayed in GB1 font. pdf(test_1.pdf, family = c(GB1)) plot(1:10) text(5,1, \u4F60\u597D, font = 1) text(5,2, \u4F60\u597D, font = 2) text(5,3, \u4F60\u597D

[R] PDFfontNumber bugs in devPS.c (Re: plain text in Chinese can not be set)

2010-07-01 Thread Jinsong Zhao
On 2010-7-1 15:24, Jinsong Zhao wrote: Read the source again more carefully. I think I get the solution: Change the following line in PDFfontNumber function in devPS.c: num = 1000 + (cidfontIndex - 1)*5 + 1 + face; to num = 1000 + (cidfontIndex - 1)*5 + face; It appears two times

[R] pass data to log-likelihood function

2008-09-04 Thread Jinsong Zhao
Hi there, When I do bootstrap on a maximum likelihood estimation, I try the following code, however, I get error: Error in minuslogl(alpha = 0, beta = 0) : object x not found It seems that mle() only get data from workspace, other than the boot.fun(). My question is how to pass the data to

[R] how to deal with NaN in boot object

2008-09-04 Thread Jinsong Zhao
Hi there, I use boot() to do bootstrap simulation on my statistic, I get a boot object, named obj. For certain reasons, there are some NaN in obj$t. Now, I hope to get confidence interval using boot.ci(), it give the following error: Error in if (const(t, min(1e-08, mean(t)/1e+06))) { :

Re: [R] How to draw a plot like this?

2008-09-15 Thread Jinsong Zhao
Neil Shephard wrote: Jinsong Zhao wrote: Hi there, I hope to draw a plot like this: http://www.sg-chem.net/swizard/Ru-bqdi-spectra.gif is it possible to draw it using R? thanks for any suggestions. My intuition would say yes it is possible as R graphics are highly flexible. I'm afraid I

[R] How to draw a plot like this?

2008-09-14 Thread Jinsong Zhao
Hi there, I hope to draw a plot like this: http://www.sg-chem.net/swizard/Ru-bqdi-spectra.gif is it possible to draw it using R? thanks for any suggestions. regards, Jinsong __ R-help@r-project.org mailing list

[R] probit analysis with natural response

2008-06-20 Thread Jinsong Zhao
will give the following error message: Error in optim(start, f, method = method, hessian = TRUE, ...) : non-finite finite-difference value [3] ~~~or [1] when beta set to 5. What's wrong? And how to improve the above code? Thanks in advance! Jinsong Zhao

[R] L-BFGS-B needs finite values of 'fn'

2008-06-24 Thread Jinsong Zhao
Hi, When I run the following code, r - c(3,4,4,3,5,4,5,9,8,11,12,13) n - rep(15,12) x - c(0, 1.1, 1.3, 2.0, 2.2, 2.8, 3.7, 3.9, 4.4, 4.8, 5.9, 6.8) x - log10(x) fr - function(c, alpha, beta) { P - c + (1-c) * pnorm(alpha + beta * x) P - pmax(pmin(P,1),0) -(sum(log(choose(n,r))) + sum(r *

Re: [R] L-BFGS-B needs finite values of 'fn'

2008-06-24 Thread Jinsong Zhao
Another question related with the same code: r - c(3,4,4,3,5,4,5,9,8,11,12,13) n - rep(15,12) x - c(0, 1.1, 1.3, 2.0, 2.2, 2.8, 3.7, 3.9, 4.4, 4.8, 5.9, 6.8) x - log10(x) fr - function(c, alpha, beta) { P - c + (1-c) * pnorm(alpha + beta * x) P - pmax(pmin(P,1),0) -(sum(log(choose(n,r)))

[R] principal factor analysis

2008-07-19 Thread Jinsong Zhao
Hi, Is there a function to do principal factor analysis in R? I am reading through ``A user's guide to principal components'' by J. E. Jackson. In Table 17.1, a comparison between principal components and common factors, and there is obvious difference between them. However, I don't know how to

[R] response surface analysis

2008-07-26 Thread Jinsong Zhao
Hi, Is there a package that could do response surface analysis equivalent to SAS RSREG procedure? Thanks! Regards, Jinsong __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] A easy way to write formula

2008-07-27 Thread Jinsong Zhao
Hi I have a data frame, including x1, x2, x3, and y. I use lm() to fit second-order linear model, like the following: ft - lm(y ~ x1 + x2 + x3 + I(x1 * x1) + I(x1 * x2) + I(x1 * x3) + I(x2 * x2) + I(x2 * x3) + I(x3 * x3), mydata) if the independent variable number is large, the formula will be

Re: [R] response surface analysis

2008-07-27 Thread Jinsong Zhao
Tom La Bone wrote: There appears to be a very promising response surface package being discussed at useR-2008, but I have been unable to find the package on CRAN or contact the authors. www.statistik.uni-dortmund.de/useR-2008/abstracts/Sztendur+Diamond.pdf Tom Thanks for pointing me to

[R] [OT] two question about color space.

2009-03-14 Thread Jinsong Zhao
Hi there, I try to plot visible light spectrum (380nm~780nm) with color corresponding to the specific wavelength. However, I don't find a function that could do this. Another question, it's possible to plot a color space chromaticity diagram like this:

Re: [R] [OT] two question about color space.

2009-03-14 Thread Jinsong Zhao
Hi, For a good discussion of the link between colour and spectra I would suggest, http://www.fourmilab.ch/documents/specrend/ which provides an open-source C code to perform the conversion you ask for. I asked for some advice on how to wrap a R function around this code last week but

Re: [R] [OT] two question about color space.

2009-03-14 Thread Jinsong Zhao
if you don't mind about the efficiency of your program, just use ? sapply on a range of wavelengths. I'm not particularly keen on the implementation of the FORTRAN program you used compared to the one I suggested, it seems like a very crude convolution. Thank you very much for your

Re: [R] [OT] two question about color space.

2009-03-16 Thread Jinsong Zhao
Thanks for pointing this out, i did check the available packages before dwelling on this but i was focussed on the first part of the problem (spectrum to xyz). The available convertColor() function is especially welcome that it was the most inefficient part of the code I produced yesterday.

[R] how to input a string without quote

2008-11-29 Thread Jinsong Zhao
Hi there, I hope to use a string as an input in my function, however, I don't want to input the quotation mark. Is it possible? Thanks in advance. Regards, Jinsong __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] how to input a string without quote

2008-11-29 Thread Jinsong Zhao
Hi there, I hope to use a string as an input in my function, however, I don't want to input the quotation mark. Is it possible? Thanks in advance. Regards, Jinsong __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] how to input a string without quote

2008-11-30 Thread Jinsong Zhao
Wow, you are so lazy... But sometimes R is just designed for lazy guys... ## f = function(a) { s = substitute(a) as.character(s) } ## f(a = asdf) [1] asdf f(qwer) [1] qwer Regards, Yihui -- Yihui Xie [EMAIL PROTECTED] Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile:

[R] confint() in stats4 package

2011-08-03 Thread Jinsong Zhao
Hi there, I had a problem when I hoped to get confidence intervals for the parameters I got using mle() of stats4 package. This problem would not appear if ``fixed'' option was not used. The following mini-example will demo the problem: x - c(100, 56, 32, 18, 10, 1) r - c(18, 17, 10, 6, 4,

Re: [R] [Bug 14647] profile.mle can not get correct result

2011-08-05 Thread Jinsong Zhao
Thank you very much. now, i call mle(minuslogl=loglik, start=start, method - method, fixed=list()) in the mle.wrap() function, and the profile.mle() worked. however, it created a variable named method in user workspace. if there had been a variable with same name, then the value of that

[R] automatic font selection, please help

2011-04-20 Thread Jinsong Zhao
Hi there, With the helps from this list, I can set specific CJK fonts for character string using text() function. for example: song - CIDFont(SimSun, GBK-EUC-H, GBK, ) postscriptFonts(song = song) postscript(test.ps, height = 7, width =7, family = Times, fonts = c(song), horizontal =

Re: [R] How to read this data properly?

2012-03-03 Thread Jinsong Zhao
On 2012-3-3 23:15, Bogaso Christofer wrote: Dear all, I have been given a data something like below: Dat = 2 3 28.3 3.05 8 3 3 22.5 1.55 0 1 1 26.0 2.30 9 3 3 24.8 2.10 0 3 3 26.0 2.60 4 2 3 23.8 2.10 0 3 2 24.7 1.90 0 2 1 23.7 1.95 0 3 3 25.6 2.15 0 3 3 24.3 2.15 0 2 3 25.8 2.65 0 2 3 28.2

[R] different offset for each label?

2012-03-28 Thread Jinsong Zhao
Hi there, I hope to give a different offset for each label in a complex plot. However, the following code does not work. plot(1:4) text(c(1:4), letters[1:4], pos = c(4,3,2,1), offset=c(1,2,3,4)) it seems that text() only use the first element of c(1,2,3,4), i.e., 1. Is it possible to

Re: [R] different offset for each label?

2012-03-29 Thread Jinsong Zhao
On 2012-03-30 5:34, Uwe Ligges wrote: On 29.03.2012 07:38, Jinsong Zhao wrote: Hi there, I hope to give a different offset for each label in a complex plot. However, the following code does not work. plot(1:4) text(c(1:4), letters[1:4], pos = c(4,3,2,1), offset=c(1,2,3,4)) it seems

[R] Fisher's LSD multiple comparisons in a two-way ANOVA

2012-04-03 Thread Jinsong Zhao
Hi there, Is there a function that can do a Fisher's LSD multiple comparisons in a two-way ANOVA? I hope to get a result similar with TukeyHSD(). Especially, I hope to know the significance of comparisons between the interactions of two factors. In the following example: x - c(76, 84, 78,

Re: [R] Fisher's LSD multiple comparisons in a two-way ANOVA

2012-04-04 Thread Jinsong Zhao
On 2012-04-03 20:03, Rmh wrote: yes. See ?glht in the multcomp package, and the examples using glht in ?MMC in the HH package. Sent from my iPhone Thank you very much for the clues. However, I can't figure out how to construct the linfct in glht. I also tried to inverse the computation

Re: [R] Fisher's LSD multiple comparisons in a two-way ANOVA

2012-04-06 Thread Jinsong Zhao
On 2012-04-05 10:49, Richard M. Heiberger wrote: Here is your example. The table you displayed in gigawiz ignored the two-way factor structure and interpreted the data as a single factor with 6 levels. I created the interaction of a and b to get that behavior. ## your example, with data stored

[R] using ``-'' in function argument

2010-12-02 Thread Jinsong Zhao
Hi there, In function, it's usually using ``='' to assign default value for function argument. For newbie, it's possible to using ``- '' to assign value for function argument. Although it's not a correct way, R don't give any warning message. matrix(1:20, ncol - 4) [,1] [,2] [,3] [,4]

Re: [R] Fitting a Triangular Distribution to Bivariate Data

2010-12-23 Thread Jinsong Zhao
2.3523724 b 23.627448 1.9804026 c 13.00 0.1107073 Loglikelihood: -62.41994 AIC: 130.8399 BIC: 133.8271 Correlation matrix: a b c a 1. -0.14537297 -0.01203898 b -0.14537297 1. -0.01439500 c -0.01203898 -0.01439500 1. HTH ... Jinsong

[R] Does R has a similar way as DATA in SPSS?

2011-10-22 Thread Jinsong Zhao
Hi there, In SPSS, small piece of data can be input as following: DATA LIST LIST /x1 x2 x3 x4 x5 . BEGIN DATA 5700 12.8 2500 270 25000 1000 10.9 600 10 1 3400 8.8 1000 10 9000 3800 13.6 1700 140 25000 4000 12.8 1600 140 25000 8200 8.3 2600 60 12000 1200 11.4 400

[R] set different font family for strings in mtext or text?

2011-10-26 Thread Jinsong Zhao
Hi there, Is it possible to set different font family for strings in mtext or text? For example, on windows platform with windows() device: plot(1:10, type = n) text(5,5, Chinese (English)) #Chinese for Chinese characters it will give the correct Chinese and English characters with two

Re: [R] set different font family for strings in mtext or text?

2011-10-26 Thread Jinsong Zhao
Thank you very much for the quick reply. On 2011-10-26 18:24, Prof Brian Ripley wrote: See ?par: check the 'family' paramater. You can select 'family' for each call to mtext or text. Yes, I can select 'family' for each call to mtext or text. however, when it's necessary to put both Chinese

[R] how to define the bound between parameters in nls()

2011-11-17 Thread Jinsong Zhao
Hi there, I have read the help page of nls(), there is lower or upper for defining the bounds of parameters. For example, nls(y ~ 1-a*exp(-k1*x)-(1-a)*exp(-k2*x), data=data.1, start=list(a=0.02, k1=0.01, k2=0.0004), upper=c(1,1,1), lower=c(0,0,0)) I hope to define k1 k2, but I don't find

[R] Ask for help on Error() model

2011-11-19 Thread Jinsong Zhao
Hi there, I have a experimental design as following: P A B Y 1 1 1 1 -0.18524045 2 1 1 2 -1.64226232 3 2 2 1 -0.51342697 4 2 2 2 -0.29684874 5 3 3 1 0.71566733 6 3 3 2 -1.06097480 7 4 4 1 0.05772670 8 4 4 2 0.99316677 9 5 1 1 -0.61860414 10 5 1 2 0.50257548

[R] multiple comparison of interaction of ANCOVA

2011-12-11 Thread Jinsong Zhao
Hi there, The following data is obtained from a long-term experiments. mydata - read.table(textConnection( +y year Trt + 9.37 1993 A + 8.21 1995 A + 8.11 1999 A + 7.22 2007 A + 7.81 2010 A +10.85 1993 B +12.83 1995 B +13.21 1999 B +

[R] how to assign a value?

2011-12-11 Thread Jinsong Zhao
Hi there, I hope to modify values in a vector or matrix in the following code: for (i in 1:9) { assign(paste(a., i, sep = ), 1:i) get(paste(a., i, sep = ))[i] - i+50 } I get the following error message: Error in get(paste(a., i, sep = ))[i] - i + 50 : target of assignment expands to

Re: [R] how to assign a value?

2011-12-11 Thread Jinsong Zhao
On 2011-12-12 0:00, David Winsemius wrote: On Dec 11, 2011, at 10:27 AM, Jinsong Zhao wrote: Hi there, I hope to modify values in a vector or matrix in the following code: for (i in 1:9) { assign(paste(a., i, sep = ), 1:i) get(paste(a., i, sep = ))[i] - i+50 } Just one matrix? Then you

Re: [R] how to assign a value?

2011-12-11 Thread Jinsong Zhao
(a., i, sep = ))[i] - i+50 to assign(get(paste(a., i, sep = ))[i], i+50) however, error message: Error in assign(get(paste(a., i, sep = ))[i], i + 50) : invalid first argument I don't know why... Regards, Jinsong On 11/12/2011 15:27, Jinsong Zhao wrote: Hi there, I hope to modify values

Re: [R] how to assign a value?

2011-12-11 Thread Jinsong Zhao
On 2011-12-12 10:58, David Winsemius wrote: On Dec 11, 2011, at 9:07 PM, Jinsong Zhao wrote: On 2011-12-12 0:00, David Winsemius wrote: On Dec 11, 2011, at 10:27 AM, Jinsong Zhao wrote: Hi there, I hope to modify values in a vector or matrix in the following code: for (i in 1:9

Re: [R] multiple comparison of interaction of ANCOVA

2011-12-12 Thread Jinsong Zhao
On 2011-12-11 22:49, Bert Gunter wrote: Inline below. -- Bert Graph the data sensibly to figure out what's going on. Statistical machinationsand anova tables with P values alone are not sufficient and can be opaque or misleading. If you do not know what sensibly is (or even if you do),

Re: [R] multiple comparison of interaction of ANCOVA

2011-12-12 Thread Jinsong Zhao
(package:HH), TukeyHSD(mydata.aov) can output the correct results. Thanks again. Regards, Jinsong Rich On Sun, Dec 11, 2011 at 7:15 AM, Jinsong Zhao jsz...@yeah.net mailto:jsz...@yeah.net wrote: Hi there, The following data is obtained from a long-term experiments. mydata

Re: [R] multiple comparison of interaction of ANCOVA

2011-12-13 Thread Jinsong Zhao
Thank you very much for the suggestions. On 2011-12-13 3:20, Richard M. Heiberger wrote: ... On Mon, Dec 12, 2011 at 7:00 AM, Jinsong Zhao jsz...@yeah.net mailto:jsz...@yeah.net wrote: Apart from the data set here, is there a way to do multiple comparison on the interaction of one way

Re: [R] How to handle Chinese character in R plot?

2012-10-11 Thread Jinsong Zhao
On 2012-10-12 10:16, Manish Gupta wrote: Hi, I am working on Chinese language plot. But names and labels are in chinese language. How can i print chineese characters as lable in R plot. 名称 类 学生 木材 2 2 表 3 4 笔 4 2 垃圾桶 5 6 杯 6

Re: [R] How to handle Chinese character in R plot?

2012-10-15 Thread Jinsong Zhao
On 2012-10-15 9:40, Manish Gupta wrote: I just noticed chinese characters are not printed by using this. Some other characters gets printed on axis as shown below for the sugested solution. x - read.csv(textConnection(名称,类,学生 木材,2,2 表,3,4 笔,4,2 垃圾桶,5,6 杯,6,3), header = TRUE) rownames(x) -

[R] why sd() can be applied to character vector?

2012-10-27 Thread Jinsong Zhao
Hi there, In the following example, sd() can be applied to a character vector. However, mean() can not be run in a similar way. Why? I have read sd() man page, however, I don't find information about that behavior. x - as.character(1:10) sd(x) [1] 3.02765 mean(x) [1] NA Warning message:

[R] apply and table

2013-05-19 Thread Jinsong Zhao
Hi there, I have the following code: z - matrix(c(A, A, B, B, C, C, A, B, C), ncol = 3) apply(z, 2, table, c(A, B, C)) which give correct results. However, the following code: apply(z[,1,drop=FALSE], 2, table, c(A, B, C)) which does not give what I expect. I have been thought it should give

Re: [R] How to read a file including strings and numbers.

2013-06-01 Thread Jinsong Zhao
On 2013/6/1 15:54, Jie Tang wrote: hi R-users, I have a file as shown below,and the first column is time information. 2012-08-07 00:00:00,4174830,5,8.1,34.5,9.5,32,14 2012-08-07 00:00:01,4174831,4.7,8.6,34.5,9.9,29,14 2012-08-07 00:00:02,4174832,4.7,8.6,34.5,9.9,29,14 2012-08-07

[R] how to convert variable name to string?

2012-08-14 Thread Jinsong Zhao
Hi there, In the following function: demo.plot - function( obj ) plot(1:5, obj, xlab = x) Then, I use this function as following: y - rnorm(5) demo.plot(y) It will produce a plot with ylab = obj, however, I hope to get a plot with ylab = y. Is it possible to convert object/variable name y

[R] legend position help

2012-08-15 Thread Jinsong Zhao
Hi there, I draw a multiple figure in one plot, like the following: par(mfcol=c(1,5),mar=c(4,4,0,0)+0.2, oma=c(0,0,3,0)) plot(1:10, type = b) plot(1:10, type = b) plot(1:10, type = b) plot(1:10, type = b) plot(1:10, type = b) Now, I hope to plot the legend like the following: legend(top,

Re: [R] legend position help

2012-08-15 Thread Jinsong Zhao
, Jinsong Zhao jsz...@yeah.net wrote: Hi there, I draw a multiple figure in one plot, like the following: par(mfcol=c(1,5),mar=c(4,4,0,0)+0.2, oma=c(0,0,3,0)) plot(1:10, type = b) plot(1:10, type = b) plot(1:10, type = b) plot(1:10, type = b) plot(1:10, type = b) Now, I hope to plot the legend like

Re: [R] TukeyHSD output

2012-08-23 Thread Jinsong Zhao
On 2012-08-24 8:58, David Douterlungne wrote: Hi all, Is there a R-function that orders Tukey results with conveniant letters, similar to the SPSS output (A, AB, ABC, C, etc.) . library(multcompView)

[R] for loop optimization help

2012-08-26 Thread Jinsong Zhao
Hi there, In my code, there is a for loop like the following: pmatrix - matrix(NA, nrow = 99, ncol = 1) qmatrix - matrix(NA, nrow = 99, ncol = 3) paf - seq(0.01, 0.99, 0.01) for (i in 1:1) { p.r.1 - rnorm(1000, 1, 0.5) p.r.2 - rnorm(1000, 2, 1.5) p.r.3 -

Re: [R] for loop optimization help

2012-08-27 Thread Jinsong Zhao
On 2012-08-27 9:35, David Winsemius wrote: On Aug 26, 2012, at 5:06 PM, Jinsong Zhao wrote: Hi there, In my code, there is a for loop like the following: pmatrix - matrix(NA, nrow = 99, ncol = 1) qmatrix - matrix(NA, nrow = 99, ncol = 3) paf - seq(0.01, 0.99, 0.01) for (i in 1

Re: [R] for loop optimization help

2012-08-27 Thread Jinsong Zhao
On 2012-08-27 22:25, David Winsemius wrote: On Aug 27, 2012, at 1:53 AM, Jinsong Zhao wrote: On 2012-08-27 9:35, David Winsemius wrote: On Aug 26, 2012, at 5:06 PM, Jinsong Zhao wrote: Hi there, In my code, there is a for loop like the following: pmatrix - matrix(NA, nrow = 99, ncol

[R] path analysis help

2012-08-30 Thread Jinsong Zhao
Hi there, I searched R-help list with path analysis as keyword, and learn that sem package can do it. However, I don't figure out a way to construct the model for the path diagram as Fig. 1. in Huang et al. (2002)[1]. I try the following code: huang.cor - readMoments(diag=FALSE,

[R] How to plot? stack line plot with different Y axis

2014-03-17 Thread Jinsong Zhao
Hi there, I just find a fancy plot like the following: http://www.nature.com/nature/journal/v505/n7481/images_article/nature12784-f2.jpg I am wondering how to plot something like that in R. Which package will be convenient for doing such things. BTW, the link that points to R graph gallery

Re: [R] How to plot? stack line plot with different Y axis

2014-03-17 Thread Jinsong Zhao
On 2014/3/17 1:12, Jim Lemon wrote: On 03/17/2014 05:07 PM, Jinsong Zhao wrote: Hi there, I just find a fancy plot like the following: http://www.nature.com/nature/journal/v505/n7481/images_article/nature12784-f2.jpg I am wondering how to plot something like that in R. Which package

[R] is it possible to get the coordinate of mtext()?

2014-03-17 Thread Jinsong Zhao
Hi there, I hope to rotate the Y label of axis(4) with -90 degree. I can typeset the Y label using text() with srt = -90. However, I cannot get the coordinate of the position that mtext() used. In other words, I hope to convert: mtext(Y label, side = 4, at = 0, line = 2) to text(x, 0, Y

Re: [R] is it possible to get the coordinate of mtext()?

2014-03-17 Thread Jinsong Zhao
On 2014/3/17 15:32, Jim Lemon wrote: On 03/18/2014 09:18 AM, Jinsong Zhao wrote: Hi there, I hope to rotate the Y label of axis(4) with -90 degree. I can typeset the Y label using text() with srt = -90. However, I cannot get the coordinate of the position that mtext() used. In other words, I

[R] vector density plot

2014-03-29 Thread Jinsong Zhao
Hi there, Is there a function in R that can draw vector density plot? The vector density plot example can be found here: http://reference.wolfram.com/mathematica/ref/VectorDensityPlot.html As for the vector field plot, I found a function that has been posted in this mailing list:

[R] Size of win.metafile

2014-05-26 Thread Jinsong Zhao
Hi there, I hope to use the emf plot produced by R in Word. However, I have problems with setting the plot size. Here is a mini-example code: win.metafile(abcd.emf, height =4, width=4) plot(1:10) dev.off() I hope to get a emf plot with size 4x4in and pointsize 12pt. However, I got a plot

Re: [R] Size of win.metafile

2014-05-27 Thread Jinsong Zhao
for you. Jean On Mon, May 26, 2014 at 2:34 PM, Jinsong Zhao jsz...@yeah.net mailto:jsz...@yeah.net wrote: Hi there, I hope to use the emf plot produced by R in Word. However, I have problems with setting the plot size. Here is a mini-example code: win.metafile(abcd.emf, height

Re: [R] Size of win.metafile

2014-05-27 Thread Jinsong Zhao
size is same as the one produced by ``win.metafile'' and inserted into Word. Now, it regresses to my original question. Best, Jinsong On May 27, 2014, at 12:28, Jinsong Zhao jsz...@yeah.net wrote: Jean, Thank you for checking the problem. I have the same software with you. If I created

Re: [R] Size of win.metafile

2014-05-27 Thread Jinsong Zhao
with the size of emf file. However, when setting it to 72 by windows.options, only the display size in screen has been changed. It don't affect the actual plot size when saving it as emf file. It also 384x384px instead of 288x288px. Best, Jinsong On May 27, 2014, at 13:49, Jinsong Zhao jsz...@yeah.net

[R] legend for the plot with type = b

2013-09-22 Thread Jinsong Zhao
Hi there, I plot a simple plot with the following code: plot (rnorm(1:10), type = b) legend(top, test, lty = 1, pch = 21) The result is something wired for the line crosses the point in the legend while the line does not cross the point in the main plot. Is there possibility to draw the

Re: [R] legend for the plot with type = b

2013-09-23 Thread Jinsong Zhao
On 2013/9/23 17:11, Jim Lemon wrote: On 09/23/2013 01:54 PM, Jinsong Zhao wrote: Hi there, I plot a simple plot with the following code: plot (rnorm(1:10), type = b) legend(top, test, lty = 1, pch = 21) The result is something wired for the line crosses the point in the legend while the line

Re: [R] legend for the plot with type = b

2013-09-23 Thread Jinsong Zhao
On 2013/9/23 12:52, David Winsemius wrote: On Sep 22, 2013, at 10:54 PM, Jinsong Zhao wrote: Hi there, I plot a simple plot with the following code: plot (rnorm(1:10), type = b) legend(top, test, lty = 1, pch = 21) ?par plot (rnorm(1:10), type = b) legend(top, test, lty = 69, pch = 21

[R] text position with offset

2013-10-03 Thread Jinsong Zhao
Hi there, I have draw a scatter plot. Now, I hope to label the points in the plot. For example: plot(1:10) text(1:10, 1:10, LETTERS[1:10]) In the above line, I can set position for each labels with pos, e.g.: text(1:10, 1:10, LETTERS[1:10], pos = sample(1:4, 10, replace = TRUE)) as what

[R] anova() interpretation and error message

2011-02-06 Thread Jinsong Zhao
Hi there, I have a data frame as listed below: Ca.P.Biomass.A P Biomass 1 334.5567 0.287 2 737.5400 0.571 3 894.5300 0.639 4 782.3800 0.5836667 5 857.5900 0.600 6 829.2700 0.588 I have fit the data using logistic, Michaelis–Menten, and linear model, they all

[R] Confidence interval based on MLE

2011-02-06 Thread Jinsong Zhao
Hi there, I have fitted a sample (with size 20) to a normal and/or logistic distribution using fitdistr() in MASS or fitdist() in fitdistrplus package. It's easy to get the parameter estimates. Now, I hope to report the confidence interval for those parameter estimates. However, I don't find

Re: [R] Confidence interval based on MLE

2011-02-07 Thread Jinsong Zhao
On 2011-2-6 22:56, Ben Bolker wrote: Jinsong Zhaojszhaoat yeah.net writes: Hi there, I have fitted a sample (with size 20) to a normal and/or logistic distribution using fitdistr() in MASS or fitdist() in fitdistrplus package. It's easy to get the parameter estimates. Now, I hope to report

[R] Error in colnames: target of assignment expands to non-language object

2011-03-06 Thread Jinsong Zhao
Hi there, I cannot find a detailed explanation to the following error message: colnames(matrix(1:10, ncol = 2)) - c(X, Y) Error in colnames(matrix(1:10, ncol = 2)) - c(X, Y) : target of assignment expands to non-language object However, when I do the following things, the error message

[R] cursor after txtProgressBar

2013-03-25 Thread Jinsong Zhao
Hi there, I am using R 2.15.2 under Win7 64. I hope to display progress bar when I am running a loop. After the loop exit, the cursor is at the right margin of the window. How can I make it to the left margin? Here is the minimal example code. combn.bar - function(n, m) { n - choose(n,

[R] efficient way to replace a range of numeric with a integer in a matrix

2014-08-11 Thread Jinsong Zhao
Hi there, I hope to replace a range of numeric in a matrix with a integer. For example, in the following matrix, I want to use 1 to replace the elements range from 0.0 to 1.0, and all larger than 1. with 2. (m - matrix(runif(16, 0, 2), nrow = 4)) [,1] [,2] [,3] [,4]

Re: [R] efficient way to replace a range of numeric with a integer in a matrix

2014-08-11 Thread Jinsong Zhao
TIBCO Software wdunlap tibco.com Thank you very much. I think findInterval() is what I want. Regards, Jinsong On Mon, Aug 11, 2014 at 2:40 PM, Jinsong Zhao jsz...@yeah.net wrote: Hi there, I hope to replace a range of numeric in a matrix with a integer. For example, in the following matrix, I

[R] loading saved files with objects in same names

2014-08-18 Thread Jinsong Zhao
Hi there, I have several saved data files (e.g., A.RData, B.RData and C.RData). In each file, there are some objects with same names but different contents. Now, I need to compare those objects through plotting. However, I can't find a way to load them into a workspace. The only thing I can

Re: [R] principle component values on PCA plots do not match

2014-08-18 Thread Jinsong Zhao
Hi, There is a scale factor associated with biplot when plotting the PCA result. Please read the help page of biplot.princomp or/and the source code of this function. HIH, Jinsong On 2014/8/18 16:31, John Romansic wrote: Hi all, I am using prcomp to do Principle Components Analysis and

Re: [R] loading saved files with objects in same names

2014-08-18 Thread Jinsong Zhao
Thank you very much. It is what I want. new.environment() is not defined in R 3.1.1. There is new.env(). Best, Jinsong On Mon, Aug 18, 2014 at 5:30 PM, Jinsong Zhao jsz...@yeah.net wrote: Hi there, I have several saved data files (e.g., A.RData, B.RData and C.RData). In each file, there are some

Re: [R] loading saved files with objects in same names

2014-08-22 Thread Jinsong Zhao
? Best, Jinsong On Mon, Aug 18, 2014 at 5:30 PM, Jinsong Zhao jsz...@yeah.net wrote: Hi there, I have several saved data files (e.g., A.RData, B.RData and C.RData). In each file, there are some objects with same names but different contents. Now, I need to compare those objects through

[R] depth of labels of axis

2014-09-01 Thread Jinsong Zhao
Hi there, With the following code, plot(1:5, xaxt = n) axis(1, at = 1:5, labels = c(expression(E[g]), E, expression(E[j]), E, expression(E[t]))) you may notice that the E within labels of axis(1) are not at the same depth. So the vision of axis(1) labels is something like wave. Is there a

Re: [R] depth of labels of axis

2014-09-03 Thread Jinsong Zhao
On 2014/9/1 20:39, David Winsemius wrote: On Sep 1, 2014, at 4:40 PM, Jinsong Zhao wrote: Hi there, With the following code, plot(1:5, xaxt = n) axis(1, at = 1:5, labels = c(expression(E[g]), E, expression(E[j]), E, expression(E[t]))) you may notice that the E within labels of axis(1

Re: [R] depth of labels of axis

2014-09-03 Thread Jinsong Zhao
University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jinsong Zhao Sent: Monday, September 1, 2014 6:41 PM To: r-help@r-project.org Subject: [R] depth of labels of axis Hi there, With the following code

Re: [R] depth of labels of axis

2014-09-03 Thread Jinsong Zhao
On 2014/9/3 21:33, Jinsong Zhao wrote: On 2014/9/2 11:50, David L Carlson wrote: The bottom of the expression is set by the lowest character (which can even change for subscripted letters with descenders. The solution is to get axis() to align the tops of the axis labels and move the line up

Re: [R] depth of labels of axis

2014-09-05 Thread Jinsong Zhao
On 2014/9/4 12:24, David Winsemius wrote: On Sep 3, 2014, at 10:05 PM, Jinsong Zhao wrote: On 2014/9/3 21:33, Jinsong Zhao wrote: On 2014/9/2 11:50, David L Carlson wrote: The bottom of the expression is set by the lowest character (which can even change for subscripted letters

Re: [R] depth of labels of axis

2014-09-05 Thread Jinsong Zhao
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Thursday, September 4, 2014 2:25 PM To: Jinsong Zhao Cc: r-help@r-project.org Subject: Re: [R] depth of labels of axis On Sep 3, 2014, at 10:05 PM, Jinsong Zhao

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=你好) to R

  1   2   >