Re: [R] how to get the numbers of factors in a matrix

2014-01-21 Thread Liu , Jun Yi
Dear YZ, I guess this is what you want: 1. http://stackoverflow.com/questions/3418128/how-to-convert-a-factor-to-an-integer-numeric-without-a-loss-of-information 2.  http://stackoverflow.com/questions/6979625/arithmetic-operations-on-r-factors/6980780#6980780 3.  http://toddjobe.blogspot.jp/201

[R] about mix type clust algorithm

2013-07-21 Thread Cheng, Yi
bigger say 10,000 rows of data, the dissimilarity matrix will be O(n^2), and out of memory will occur. I am wondering is there any better ways to do the mixed type cluster? Cheng Yi [[alternative HTML version deleted]] __ R-help@r-project.org

[R] clust algorithm for interval-typed data

2013-07-21 Thread Cheng, Yi
Hi: I am looking for clust algorithms for interval-typed data. (for example, the session data with start time and end time). I can't find it. Please help to point me to any existing. Cheng Yi [[alternative HTML version deleted]] __ R

[R] How to use "SparseM-conversions" to convert a dCgMatrix into a matrix.csr ?

2013-05-07 Thread Yi Yuan
Hi all, I want to transform a dCgMatrix from package Matrix into a matrix.csr from package SparseM, and I found out this link : http://stat.ethz.ch/R-manual/R-devel/library/Matrix/html/SparseM-conv.html But there's no informaion about usage/description/arguments, so how do I use this SparseM-co

[R] a huge sparse matrix to pass into svm

2013-05-06 Thread Yi Yuan
Hi all, I have a huge sparse matrix, it's 360K*210K. Right now I have all the nonzero elements and their indices, so I want to transform this information into a sparse matrix so that I could pass the sparse matrix into svm function. I was planning to use sparse_matrix<- as.matrix.csr(v,nrow=36

[R] R doesn't recognize utils functions, such as arrayIndex( )

2013-04-02 Thread Yi Yuan
Hi all, When I called arrayIndex(20:23, dim=c(4,3,3)), it says "Error: could not find function "arrayIndex"in R". So I called ls("package:utils") to see the functions inside: [1] "?" [2] "adist" [3] "alarm" [4] "apropos" [5] "aregexec" [6] "argsAnywhere" [7] "arrangeWindows" [8] "a

Re: [R] R doesn't recognize utils functions, such as arrayIndex( )

2013-04-02 Thread Yi Yuan
use of the quotation marks, so I thought the name must be just "utils". On Tue, Apr 2, 2013 at 9:16 AM, Sarah Goslee wrote: > Why do you think the utils package and the R.utils package are the same > thing? > > Sarah > > > On Tuesday, April 2, 2013, Yi Yuan wrote

Re: [R] ggplot2: less than equal sign

2013-03-28 Thread soon yi
list of expressions as its argument. > This approach gives you more control over the legend and choice of > fill colors at the expense of a couple of lines of code. To change the > axis and legend titles, one can use the labs() function; e.g., > > last_plot() + labs(x = "Visibili

[R] ggplot2: less than equal sign

2013-03-28 Thread soon yi
Hi I am trying to add a less than equal sign to a plot. I have previously done this using unicode but is not working in this instance. Any suggestions would be great thanks example code: library(ggplot2) df<-data.frame(vis=c(0,0,1,1) , count=c(10,15,20,10) , grp=c(0,1,0,1)) df$grp <-factor(df$g

Re: [R] Reassign Multiple Factors to same Factor Value

2013-03-25 Thread soon yi
or just levels(df$y)[5:7]<-"others" Ista Zahn wrote > Hi Lorenzo, > > On Mon, Mar 25, 2013 at 6:18 PM, Lorenzo Isella > < > lorenzo.isella@ > > wrote: >> Dear All, >> Probably something very easy, but I am looking for the most efficient >> ways >> to achieve this. >> Consider the following sn

Re: [R] Ordering a matrix by row value in R2.15

2013-03-24 Thread soon yi
or this with Pete's example orig[,order(orig[2,])] Pete Brecknock wrote > > fitz_ra wrote >> I know this is posted a lot, I've been through about 40 messages reading >> how to do this so let me apologize in advance because I can't get this >> operation to work unlike the many examples shown.

Re: [R] Combining boxplot

2013-02-25 Thread soon yi
does this work for you? df1 = data.frame(x = rnorm(100)) df1$type = ifelse(df1$x <= 0 , "type1", "type2") df1$group<-1 df2 = data.frame(x = rnorm(50,0,2)) df2$type = ifelse(df2$x <= 0 , "type1", "type2") df2$group<-2 combined.df<-rbind(df1,df2) boxplot(combined.df$x ~ combined.df$group *co

Re: [R] How can I plot graphs together?

2013-02-15 Thread soon yi
look at dev.new() to specify plot window size and then ?layout to specify number and size of each plot in the window Jiaqi.Zhang wrote > Hi, all, > > I am working on the following code to learn how to plot graphs together. I > used the par(mfrow=c(1,3)) function to try to put all three plot()

Re: [R] Why replacement has length zero? And How can I fix it?

2013-02-02 Thread soon yi
Hi for the loop section runif needs curved brackets Try IAP <-NA for (i in 1:Sample.Size){ if (DataSet$SES[i]>0) { IAP[i] <- ifelse(runif(1)>0.75, 1, 0) # High SES, higher chance to be in Treatment # } else { IAP[i] <- if

Re: [R] readJPEG function cannot open jpeg files

2013-01-14 Thread Yi Yuan
Hi, guys, my problem is solved. I used file.info(list.files(getwd(),full.names=TRUE)) and found out that the said file is listed as "kim.jpg" instead of "kim.jpeg". So kim<-readJPEG("kim.jpg") worked. Thanks for your help and sorry for my newbie question. On

Re: [R] readJPEG function cannot open jpeg files

2013-01-14 Thread Yi Yuan
) the file with mode 666, but not all permission > information is encoded in the mode. > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Beh

[R] readJPEG function cannot open jpeg files

2013-01-14 Thread Yi Yuan
Hi, r-help mailing list subscribers, I installed jpeg package and tried to use kim<-readJPEG("kim.jpeg") to read in a jpeg file, but R gave me an error: Error in readJPEG("kim.jpeg") : unable to open kim.jpeg I already put "kim.jpeg" in Rstudio's default working directory: "E:\home work\Rstudio

[R] readJPEG function cannot open jpeg files

2013-01-14 Thread Yi Yuan
I installed jpeg package and tried to use kim<-readJPEG("kim.jpeg") to read in a jpeg file, but R gave me an error: Error in readJPEG("kim.jpeg") : unable to open kim.jpeg I already put "kim.jpeg" in Rstudio's default working directory: "E:\home work\Rstudio". So I don't think it's a problem cau

Re: [R] table of list objects

2013-01-03 Thread soon yi
perfect. thanks for the quick reply soon yi wrote > Hi > > I have a list such as this > > list(c("q","w"),"r",c("r","w"),c("q","w")) > > How do i create a table to include the count of groups

[R] table of list objects

2013-01-03 Thread soon yi
Hi I have a list such as this list(c("q","w"),"r",c("r","w"),c("q","w")) How do i create a table to include the count of groups of terms please? ie so output is like / similar to q","w""r" "r","w" 211 thanks for any help -- View this message in contex

Re: [R] ggplot geom_smooth colour

2012-12-17 Thread soon yi
Thank you. Rather embarrassed. Its fair to say i had rather over comlicated my attempts to do this. sy soon yi wrote > Hi > > I am using geom_smooth to fit linear regression lines over a scatterplot > for two treatment groups. The default colour for the two lines are blue. I > h

Re: [R] ggplot geom_smooth colour

2012-12-17 Thread soon yi
them to be black. Adding colour="black" into the geom_smooth aesthetic does not change the line colour to black. thanks, sy soon yi wrote > Hi > > I am using geom_smooth to fit linear regression lines over a scatterplot > for two treatment groups. The default colour for

[R] ggplot geom_smooth colour

2012-12-17 Thread soon yi
Hi I am using geom_smooth to fit linear regression lines over a scatterplot for two treatment groups. The default colour for the two lines are blue. I have been unable to change this with the usual options. A search online has not suggested any solution / work around. Is there a solution to this?

[R] ggplot - adding regression lines

2012-12-12 Thread soon yi
Hi I am using ggplot to overlay two regression lines on a scatter plot each corresponding to a treatment group. The default plot gives a different slope for each treatment group. However, in some cases i want the lines to be parallel -ie no significant interaction. My code: ggplot(data=df,X,Y,

Re: [R] update fit (removing insignificant variables)

2012-11-21 Thread soon yi
170 predictors - perhaps try lasso regression -- View this message in context: http://r.789695.n4.nabble.com/Re-update-fit-removing-insignificant-variables-tp4650379p4650394.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

Re: [R] using ifelse to remove NA's from specific columns of a data frame containing strings and numbers

2012-11-15 Thread soon yi
#Data df<-data.frame(id=letters[1:10],var1=rnorm(10,10,5),var2=rnorm(10,5,2),var3=rnorm(10,1,1)) #Missing df$var1[2]<-df$var2[c(2,6)]<-df$var3[c(2,5)]<-NA na.replace<-seq(1:ncol(df))-1 df[,names(df)]<-sapply(1:dim(df)[2], function(ii) {ifelse(is.na(df[,ii]),na.replace[ii],df[,ii])} ) David Ro

[R] structural equations using sem package

2012-11-05 Thread Soon Yi
Hello I am using sem to look at the direct effect of one variable on another but i am uncertain if i am progressing correctly. An example: covar1<-  matrix(c(0.4,-0.2,3,-0.2 , 0.3,-2 , 3 ,-2 , 60), nrow=3,byrow=T) rownames(covar1)<-colnames(covar1)<-c("endo","exo","med") path1<-matrix(c(    "

[R] (no subject)

2012-10-04 Thread Chia-Yi Chiu
Hi I would like to learn how the R function "hclust" deals with ties. It is written in Fortran, so I cannot access the code. Thanks!! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

[R] help on "plotfit" function in package "nlstools"

2012-09-12 Thread Yi Li
I encountered this problem when I was learning nonlinear regression with R : there is this function "plotfit" in package "nlstools",which "displays a superimposed plot of the dependent variable versus one the independent variables together with the fitted model.",but when I execute the example give

[R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-28 Thread Yi
Dear all, Suppose my data frame is as follows: id price distance 1 2 4 1 35 ... 2 4 8 2 5 9 ... n 3 7 n 8 9 I would like to calculate the rank-order correlation between price and distance for each id. cor(price,distance,method = "spearman") calculate a correlation for

[R] yi sent you a movie ticket redeemable at more than 200 nation wide theatre chains

2011-03-18 Thread yi
yi has chosen to send you a free movie ticket, up to $10 value. Sit back, relax, and enjoy! In an effort to spread the word about our great products we are allowing our members to send free movie tickets to their selected friends at no charge to our members. This time yi chose you! To redeem

[R] yi sent you a movie ticket redeemable at more than 200 nation wide theatre chains

2011-03-18 Thread yi
yi has chosen to send you a free movie ticket, up to $10 value. Sit back, relax, and enjoy! In an effort to spread the word about our great products we are allowing our members to send free movie tickets to their selected friends at no charge to our members. This time yi chose you! To redeem

Re: [R] Find and replace all the elements in a data frame

2011-02-17 Thread Gong-Yi Liao
fic code that > fixes > the problem and gets the job done, that would be the most useful. > > > Thanks very much in advance for your help! > > Sincerely, > --- > Josh Banta, Ph.D > Center for Genomics and Systems Biology > New York University > 100 Washin

Re: [R] Revolution Analytics reading SAS datasets

2011-02-11 Thread Gong-Yi Liao
rise 4.2. Could somebody show > me how to import/export SAS datasets. Thanks. > -- Gong-Yi Liao Department of Statistics University of Connecticut 215 Glenbrook Road U4120 Storrs, CT 06269-4120 860-486-9478 __ R-help@r-project.org mail

Re: [R] goto blas related R segfault

2011-02-08 Thread Gong-Yi Liao
ct.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Gong-Yi Liao Department of Statistics University of Connecticut 215 Glenbrook Road U4120 Storrs, CT 06269-4120 860-486-9478 [[alternative HTML version deleted]] _

[R] different results in MASS's mca and SAS's corresp

2011-02-04 Thread Gong-Yi Liao
-1.3025-0.3499 Is MASS's mca developed with different definition to SAS's corresp ? Thank you for any comments! -- Gong-Yi Liao Department of Statistics University of Connecticut 215 Glenbrook Road U4120 Storr

[R] using Statistics::R

2010-12-11 Thread Yi-Fang Liu
Hi,ALL I want to use R in Perl, the Statistics::R module is great but I meet the problem: I don`g know how to pass one array from Perl to R, can anyone show me? Any suggestion will be appreciate~ Thank you! [[alternative HTML version deleted]] __

Re: [R] previous business day

2010-10-22 Thread Li, Jing Yi
Thanks for the info! -Original Message- From: David Scott [mailto:d.sc...@auckland.ac.nz] Sent: Friday, October 22, 2010 4:19 PM To: David Reiner Cc: Li, Jing Yi; r-help@r-project.org Subject: Re: [R] previous business day On 23/10/2010 4:59 a.m., David Reiner wrote: > Look at

Re: [R] previous business day

2010-10-22 Thread Li, Jing Yi
Great. Thanks a lot! Please follow the attached hyperlink to an important disclosure: http://www.credit-suisse.com/legal/marketcommentary -Original Message- From: David Reiner [mailto:david.rei...@xrtrading.com] Sent: Friday, October 22, 2010 11:59 AM To: Li, Jing Yi Cc: r-help@r

Re: [R] previous business day

2010-10-22 Thread Li, Jing Yi
yes. do you know the name of related functions in the timeDate package? Thanks! -Original Message- From: David Reiner [mailto:david.rei...@xrtrading.com] Sent: Friday, October 22, 2010 10:10 AM To: Li, Jing Yi; David Winsemius Cc: r-help@r-project.org Subject: RE: [R] previous business

Re: [R] previous business day

2010-10-21 Thread Li, Jing Yi
, 2010 4:34 PM To: Li, Jing Yi Cc: Clint Bowman; Henrique Dallazuanna; r-help@r-project.org Subject: Re: [R] previous business day On Oct 21, 2010, at 4:20 PM, Li, Jing Yi wrote: > Yeah, thanks Henrique for the code. It works! But I also have the > questions for the holidays. > >

Re: [R] previous business day

2010-10-21 Thread Li, Jing Yi
: Thursday, October 21, 2010 4:16 PM To: Henrique Dallazuanna Cc: Li, Jing Yi; r-help@r-project.org Subject: Re: [R] previous business day May also wish to "or" in a check for holidays. -- Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler

[R] previous business day

2010-10-21 Thread Li, Jing Yi
How to get the previous business day in R? I saw some post about using functions in timeSeries package before but can not find it anymore. Thanks! === Please access the attached hyperlink for an important el...{{dropped

Re: [R] append rows to Sybase datatable using RJDBC

2010-10-12 Thread Li, Jing Yi
yes. c(T,F) does return [1] TRUE FALSE -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Tuesday, October 12, 2010 10:00 AM To: Li, Jing Yi Cc: r-help@r-project.org Subject: Re: [R] append rows to Sybase datatable using RJDBC On Oct 12, 2010, at 9:51 AM

[R] append rows to Sybase datatable using RJDBC

2010-10-12 Thread Li, Jing Yi
Hi, Does anyone have experience using RJDBC library to write to Sybase datatable? The jdbc driver I am using is jConnect 6.0. I can successfully write into a new datatable, but have problem appending rows to existing one. It either complains "Table *** already exists" or simply overwrite the exist

[R] append rows to Sybase datatable using RJDBC function dbWriteTable

2010-10-08 Thread Li, Jing Yi
Does anyone have experience using RJDBC library to write to Sybase datatable? The jdbc driver I am using is jConnect 6.0. I can successfully write into a new datatable, but have problem appending rows to existing one. It either complains "Table *** already exists" or simply overwrite the existing o

Re: [R] Variation of predictor of linear model

2010-09-27 Thread Yi Du
quot;variance of dependent variable > based on model". Do you want its total variance, residual variance, > ___ ? > > Cheers, > > Josh > > On Mon, Sep 27, 2010 at 12:58 PM, Yi Du wrote: > > Hi folks, > > > > I use lm to run regression and I don&#

[R] Variation of predictor of linear model

2010-09-27 Thread Yi Du
Hi folks, I use lm to run regression and I don't know how to predict dependent variable based on the model. I used predict.lm(model, newdata=80), but it gave me warnings. Also, how can I get the variance of dependent variable based on model. Thanks. [[alternative HTML version deleted]]

Re: [R] How to generate integers from uniform distribution with fixed mean

2010-09-04 Thread Yi
ing...@lancaster.ac.uk> wrote: > On Thu, Sep 2, 2010 at 7:17 AM, Yi wrote: > > Hi, folks, > > > > runif (n,min,max) is the typical code for generate R.V from uniform dist. > > > > But what if we need to fix the mean as 20, and we want the values to be > > int

[R] How to generate integers from uniform distribution with fixed mean

2010-09-01 Thread Yi
Hi, folks, runif (n,min,max) is the typical code for generate R.V from uniform dist. But what if we need to fix the mean as 20, and we want the values to be integers only? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org ma

Re: [R] How to calculate the concentration

2010-08-12 Thread Yi
soda 7 0.5987654 > 3 drink soda 6 0.5987654 > 4 fruit apple 2 0.722 > 5 fruit apple 3 0.722 > 6 fruit orange 1 0.722 > > HTH, > Dennis > > On Wed, Aug 11, 2010 at 3:40 PM, Yi wrote: > >> Thank you for reminding me. &

Re: [R] How to calculate the concentration

2010-08-11 Thread Yi
tration= sum of square of share For food 1, fruit, for apple ,there are two rows, value =2 and 3; for oranget, value =1. share_apple=(2+3)/(2+3+1)=5/6 ## It is the same for the two rows share_organge=1/6 concentration_fruit= share_apple^2+sjare_orange^2=(5/6)^2+(1/6)^2 Hope this makes it easier to und

[R] How to calculate the concentration

2010-08-11 Thread Yi
Hi, folks, ## food=c('fruit','fruit','fruit','drink','drink','drink') type=c('apple','apple','orange','water','soda','soda') value=c(2,3,1,5,7,6) data=data.frame(food,type,value) share=c((2+3)/(2+3+1),5/6,1/6,5/(5+7+6),13/18,13/18) market_con=c(rep(0.833^2+0.167^2,3),rep(0.278^2+0

[R] plot the dependent variable against one of the predictors with other predictors as constant

2010-08-07 Thread Yi
mmand to generate the prediction of z with the new data.frame but there should be a better way. Thanks all. Yi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

[R] How to generate variance of a new observation based on a linear regression model

2010-07-26 Thread Yi
much larger than the values from se.fit=T. The reason why I need to know the estimations of expectation and also variance is that Y=ln(Z) and I need to know the expectation of Z. Thanks Yi [[alternative HTML version deleted]] __ R-help@r

Re: [R] Variance of the prediction in the linear regression model (Theory and programming)

2010-07-21 Thread Yi
|X*)] or say sd[log(Y|X*)]. Thanks. On Wed, Jul 21, 2010 at 3:44 PM, Dennis Murphy wrote: > Hi: > > On Wed, Jul 21, 2010 at 2:29 PM, Yi wrote: > >> Hi, folks, >> >> Here are the codes: >> >> ## >> y=1:10 >> x=c(1:9,1) >&

Re: [R] Variance of the prediction in the linear regression model (Theory and programming)

2010-07-21 Thread Yi
Sorry, for the second question. I stated in a wrong way. My aim is the mean and sd of each new observation. # mean=fitted(prediction) ## But I do not know how to get sd for each new observation. Any tips? Thanks Yi On Wed, Jul 21, 2010 at 2:29 PM, Yi wrote: > Hi, folks, >

[R] Variance of the prediction in the linear regression model (Theory and programming)

2010-07-21 Thread Yi
e value of Residual standard error from summary(lin)? Answer to either question will be appreciated! Thanks Yi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

[R] How to quick check two rows are the same?

2010-07-07 Thread Yi
Hi, folks, Suppose the data is as follows: ### x=1:10 y=2:11 z=3:12 data1=data.frame(x,y) data2=data.frame(x,z) ## In real case, how to check data1$x and data2$x are the same or not? I am using for-loop to do this. Is there a quicker way? Thanks! Yi [[alternative HTML

Re: [R] how to save summary(lm) and anova (lm) in format?

2010-07-02 Thread Yi
Hi, I attached a picture to compare the 'mess' to what I what. Maybe there is difference between computers? Thanks. On Fri, Jul 2, 2010 at 10:52 AM, David Winsemius wrote: > > On Jul 2, 2010, at 1:34 PM, Yi wrote: > > Hi, folks, >> >> I would like to copy t

[R] how to save summary(lm) and anova (lm) in format?

2010-07-02 Thread Yi
.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.7181 on 8 degrees of freedom Multiple R-squared: 0.3753, Adjusted R-squared: 0.2972 F-statistic: 4.807 on 1 and 8 DF, p-value: 0.0597 How can I get the exact ouput as shown in R but not as the above? Thanks.

Re: [R] How to delete the replicate rows by summing up the numeric columns

2010-06-29 Thread Yi
~ . , sum)) > first second (all) > 1 b Brazil 2 > 2 c China15 > 3 e England13 > 4 f France 8 > 5 j Japan 5 > 6 k Korea 4 > 7 u usa 8 > > names(ms)[3] <- 'third' > > This seems to

Re: [R] How to delete rows based on replicate values in one column with some extra calcuation

2010-06-29 Thread Yi
x,newdata2$x) names(new)=c('x','y','z','v1','v2') new Because I do not think 'aggregate' can not set z as a list and at the same time keep x and y for z. Any tips? I mean my way is too 'silly'. Thanks all in advance! Yi O

[R] How to delete the replicate rows by summing up the numeric columns

2010-06-29 Thread Yi
Hi, folks, I am sorry that I did not state the problem correctly yesterday. Please let me address the problem by the following codes: first=c('u','b','e','k','j','c','u','f','c','e') second=c('usa','Brazil','England','Korea','Japan','China','usa','France','China','England') third=1:10 data=data.

[R] How to delete rows based on replicate values in one column with some extra calcuation

2010-06-28 Thread Yi
This does not work. >< But the expected dataframe is like this: 1 uthird 8 2 bthird 2 3 ethird 13 4 kthird 4 5 jthird 5 6 cthird 15 8 fthird 8 Thanks in advance. Yi [[alternative HTML version

[R] All a column to a data frame with a specific condition

2010-06-25 Thread Yi
Hi, folks, Please first look at the codes: plan_a=c('apple','orange','apple','apple','pear','bread') plan_b=c('bread','bread','orange','bread','bread','yogurt') value=1:6 data=data.frame(plan_a,plan_b,value) library(plyr) library(reshape) mm=melt(data, id=c('plan_a','plan_b')) sum_plan_a=cast(mm,

[R] Delete rows in the data frame by limiting values in two columns

2010-06-25 Thread Yi
Hi, folks, Finally Friday~~ Here comes the question: x=c('germany','poor italy','usa','england','poor italy','japan') y=c('Spain','germany','usa','brazil','england','chile') s=1:6 z=3:8 test=data.frame(x,y,s,z) #Now I only concern the countries ('germany','england','brazil'). I would like to ke

[R] how to change the format of numeric variable

2010-06-23 Thread Yi
(1e+03, 5e+3). I would like all the data in the digit format (1000, 5000). Does any function works for this? Big thanks Yi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] count data with a specific range

2010-06-23 Thread Yi
x3 -10-02 5 1 (# points in this range) 0-10 7 9 6 ... I know the table function but I do not know how to deal with the range issue. Thanks in advance. Yi [[alternative HTML

[R] How to 'understand' R functions besides reading R codes

2010-06-22 Thread Yi
ther there is a general way to figure out how R function works and what is the underlying theory besides looking at the codes (type var or lm at the Rprompt). Because R codes are too difficult to understand. Thanks Yi [[alternative HTML version deleted]] _

[R] Verify the linear regression model used in R ( fundamental theory)

2010-06-22 Thread Yi
assumption and the model used for rlm. Thanks Yi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guid

[R] How to predict the mean and variance of the dependent variable after regression

2010-06-21 Thread Yi
Hi, folks, As seen in the following codes: x1=rlnorm(10) x2=rlnorm(10,mean=2) y=rlnorm(10,mean=10)### Fake dataset linmod=lm(log(y)~log(x1)+log(x2)) After the regression, I would like to know the mean of y. Since log(y) is normal and y is lognormal, I need to know the mean and variance of log(y)

[R] How to read data from this csv?

2010-06-18 Thread YI LIU
I am so frustrated about reading data from this sample csv file. My code is : >test=read.csv(file='test.csv',header=T) warning message: In read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on 'test.csv' >test [1] ÐÏ.à.. <0 ro

[R] Read data from .csv file and regression on dummy variables

2010-06-18 Thread YI LIU
Hi, I need to regress the population on time slot and also days in advance. A sample dataset is like this. I do not know whether I can attach a file in this mailing list or not. If you know how to do it, I will be happy to send you my data file. time slot days in advance US EURCHIN

[R] Read data from .csv file and regression on dummy variables

2010-06-18 Thread YI LIU
Hi, I need to regress the population on time slot and also days in advance. A sample dataset is like this. I do not know whether I can attach a file in this mailing list or not. If you know how to do it, I will be happy to send you my data file. time slot days in advance US EURCHINA

[R] How to calculate the robust standard error of the dependent variable

2010-06-18 Thread YI LIU
Hi, folks linmod=y~x+z summary(linmod) The summary of linmod shows the standard error of the coefficients. How can we get the sd of y and the robust standard errors in R? Thanks! [[alternative HTML version deleted]] __ R-help@r-project.org ma

[R] how to 'average' one col wrt to another one

2010-06-16 Thread YI LIU
Hi, folks, test=matrix(rep(letters[1:3],6),nrow=6,byrow=T) test[2,]=letters[5:7] test[4,]=c('e','f','i') test[1,3]='i' colnames(test)=c('leave','arrive','line') The code will generate a sample dataset. I have thousands rows of data. For the same 'leave' and 'arrive', how can I get the sum of squ

[R] how to make JAVA available for R use?

2010-06-15 Thread yi li
i've just installed the package"xlsx",which is used for read,write,format Excel 2007 files, as i loaded the package ,i was told to intall the package rJava, the problem was that i didn't have a JAVA platform on my computer, so i have to install JAVA JDK first, my problem is ,after i 've installed J

Re: [R] simultaneous plots

2010-04-06 Thread Yi Du
Hi Alex, You can try to use: par(new=TRUE) to draw the two graphs together. But keep in mind that the scale of x axis of both graphs is using the same level. Otherwise, the graph would be messed up. Yi On Tue, Apr 6, 2010 at 6:16 PM, Alexandre Serra Barreto wrote: > > Dear lis

Re: [R] Estimate ARMA model with MLE

2010-03-01 Thread Yi Du
to do that? Thanks, Yi On Mon, Mar 1, 2010 at 11:26 AM, Owe Jessen wrote: > Did you have a look at the package arima? > > HTH > Owe > >> Hi there, >> >> >> I want to fit a ARMA model with the method of MLE. Is there any package >> that >>

[R] Estimate ARMA model with MLE

2010-03-01 Thread Yi Du
Hi there, I want to fit a ARMA model with the method of MLE. Is there any package that could implement this method? Thanks, Yi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

[R] Legend's attribute

2010-02-25 Thread Yi Du
I use abline(h=0.08) to draw a horizontal line and I also want to show 0.08 in the y-axis, how can I do it? Many thanks, Yi -- Yi Du Ph. D student in Economics University of Missouri Department of Economics 118 Professional Building Columbia MO 65211 1-573-239-6467 [[alternative

[R] Ask about drawing kernel density estimation

2010-01-21 Thread Yi Du
lattice of kernelplot, But I still don't know how to draw the four years kernel in one graph. Also, I don't need the rug(age) in kernelplot, how can I delete it? Thanks. -- Yi Du [[alternative HTML version deleted]] __ R-help@r-proj

Re: [R] Ask for histogram

2010-01-13 Thread Yi Du
ifferent from SAS, perhaps SAS and R use different > breakpoints, that is, different boundaries between the histogram bars. > > -Don > > At 11:58 AM -0600 1/13/10, Yi Du wrote: > >> Hi, >> >> >> I use a vector of data to draw the histogram, but it is different from

[R] Ask for histogram

2010-01-13 Thread Yi Du
don't know where I did wrong. Thanks. -- Yi Du [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.h

[R] Ask about large data set

2010-01-12 Thread Yi Du
Hi, Is that okay to let R to read data set more than 1 rows and use it to do some kernel density estimation? Thanks. Yi -- Yi Du Ph. D student in Economics University of Missouri Department of Economics 118 Professional Building Columbia MO 65211 1-573-239-6467 [[alternative

[R] GMM estimation

2009-11-28 Thread Yi Du
ls='GMM', but I can't get the suitable results. Many thanks. Yi -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

[R] Ask about the memory size problem

2009-10-04 Thread Yi Du
Hi there, I run a loop program with R and need to save the variable in each step into a vector. After I ran the code, R told me that Error: cannot allocate vector of size 266.6 Mb. Is there any solution of this kind of problem? Thank you for your attention. Yi -- Yi Du [[alternative

[R] questions for "randomFroest" package

2009-02-09 Thread hui-yi Lin
Hi,   I try to use "randomFroest" package to run SNP data analysis. I have the following questions.    1. Can the outcome variables in Random Forests be binary or continuous? 2. Can the covariates in Random Forests be continuous or categorical? 3. How to define which variables (both outcome and

[R] Fw: Problem about Mann-Kendall trend test

2009-02-06 Thread Wang Yi
-- Forwarded Message --- From: "Wang Yi" To: Sent: Fri, 6 Feb 2009 23:30:56 +0800 Subject: Problem about Mann-Kendall trend test Dear all R-users: In my case the series is the annual number of dry spell with their length exceeding a given threshold representi

[R] Problem about Mann-Kendall trend test

2009-02-06 Thread Wang Yi
in advance Regards -- Wang Yi START Regional Center for Temperate East Asia(TEA), Institute of Atmospheric Physics(IAP), Chinese Academy of Sciences(CAS), Qijiahuozi Huayanli 40#, P.O.Box 9804, Beijing 100029,China Tel:13466795920 E-mail:wan...@tea.ac.cn

[R] KS test for gumbel distribution

2009-02-03 Thread Wang Yi
is gumble but I can't find useful information in ks.test help page. Can anyone tell me how to perform the ks test. Thanks a lot for your help. -- Wang Yi START Regional Center for Temperate East Asia(TEA), Institute of Atmospheric Physics(IAP), Chinese Academy of Sciences(CAS)

Re: [R] how to get a primitive function object

2009-01-23 Thread Yi Zhang
ncan Murdoch > Thanks. I've read all the manuals and my situation is more complicated than the external ptrs and finalizers can handle. I'll probe the R-devel list and see what I can get. -- Yi __ R-help@r-project.org mailing list https://

Re: [R] how to get a primitive function object

2009-01-23 Thread Yi Zhang
onment('package:base') unlockBinding('<-',env) assign('<-', newAssign, envir=env) .Internal(lockBinding(as.name('<-'), env)) #not using lockBinding directly because it calls '<-' It gave me this error: Error: evaluation nested too deeply

Re: [R] how to get a primitive function object

2009-01-23 Thread Yi Zhang
unting for some large resource. I guess this is already the most non-intrusive way I can think of--initially I modified R's source code, an even worse option. > > Patrick Burns -- Yi __ R-help@r-project.org mailing list https://stat.et

Re: [R] how to get a primitive function object

2009-01-22 Thread Yi Zhang
lar type of objects, but preserve its effect for other regular objects (in other words, if I do x<-5 with my new <-, x will be 5 and nothing strange happens), then what should I put in the [ ] below? old <- `<-` old(`<-`, function(x, value){ if (value is my t

Re: [R] how to get a primitive function object

2009-01-22 Thread Yi Zhang
On Thu, Jan 22, 2009 at 4:17 PM, Wacek Kusnierczyk wrote: > Duncan Murdoch wrote: >> On 1/22/2009 2:41 PM, Yi Zhang wrote: >>> Hi, >>> >>> I want to create an alias for the "<-" function and then later >>> overwrite it. Any idea ho

Re: [R] how to get a primitive function object

2009-01-22 Thread Yi Zhang
On Thu, Jan 22, 2009 at 3:06 PM, Duncan Murdoch wrote: > > get("<-") will give it to you, and > > `<-` <- function(x, y) cat("x=", x, "y=", y, "\n") > > will change it -- and will probably be the last effective thing you do in > that session, unless you're really careful: > >> x <- 1 >> x > [1] 1

[R] how to get a primitive function object

2009-01-22 Thread Yi Zhang
Hi, I want to create an alias for the "<-" function and then later overwrite it. Any idea how I can get the "<-" function object? I know for other functions it's easy, something like "f <- seq" will do; how really no clue for this one. Thanks! __ R-help

Re: [R] getting caller's environment

2009-01-21 Thread Yi Zhang
) > x <- 2 > g() # 1 > > On Wed, Jan 21, 2009 at 5:45 PM, Yi Zhang wrote: >> Hello, >> >> I'm writing a function like this: >> >> f<-function(x,y,...) { >> ... >> assign(x,y,envir=?) >> } >> >> I need the caller (of

  1   2   >