[R] Linear Discriminant Analysis
Hello, I want to make a linear discriminant analysis for the dataset olive, and I get always this error:# Warning message: variables are collinear in: lda.default(x, grouping, ...) ## Loading Data library(MASS) olive - url( http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R;) print(load(olive)) y - 1:572 x - sample(y) y1 - x[1:286] train - olive[y1,-11] test - olive[-y1,-11] summary(train) summary(test) table(train$Region) table(test$Region) # Linear Discriminant Analysis z - lda(Region ~ . , train) predict(z, train) z - lda(Region ~ . , test) predict(z, test) Thanks in advance! -- Mit freundlichen Grüssen / Best Regards Soare Marcian-Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linear Discriminant Analysis
Thanks for explaining... Im just sitting at the homework for 6 hours after taking for one week antibiotica, because i had an amygdalitis... I just wanted some tipps for solving this homework, but thanks, I will try to get help on another way :) I think i solved it, but I still get this Error :( ## Loading Data library(MASS) olive - url( http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R;) print(load(olive)) dim(olive) summary(olive) index - sample(nrow(olive), 286) train - olive[index,-11] test - olive[-index,-11] summary(train) summary(test) table(train$Region) table(test$Region) # Linear Discriminant Analysis z - lda(Region ~ . , train) zn - predict(z, newdata=test)$class mean(zn != test$Region) 2007/6/6, Uwe Ligges [EMAIL PROTECTED]: So what about asking your teacher (who seems to be Peter Filzmoser) and try to find out your homework yourself? You might want to think about some assumptions that must hold for LDA and look at the class of your explaining variables ... Uwe Ligges Soare Marcian-Alin wrote: Hello, I want to make a linear discriminant analysis for the dataset olive, and I get always this error:# Warning message: variables are collinear in: lda.default(x, grouping, ...) ## Loading Data library(MASS) olive - url( http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/olive.R ) print(load(olive)) y - 1:572 x - sample(y) y1 - x[1:286] train - olive[y1,-11] test - olive[-y1,-11] summary(train) summary(test) table(train$Region) table(test$Region) # Linear Discriminant Analysis z - lda(Region ~ . , train) predict(z, train) z - lda(Region ~ . , test) predict(z, test) Thanks in advance! __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Mit freundlichen Grüssen / Best Regards Soare Marcian-Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] canoncial correlation
hello, Does nobody know what the problem could be? : 2007/5/26, Soare Marcian-Alin [EMAIL PROTECTED]: Hello, I have a problem with the function concar: data set: http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/world2.R source(world2.R) world[,8] - log(world[,8]) world[,9] - log(world[,9]) x - world[,-c(1,2)] x - scale(x) a - cancor(x[,-c(6:9)],x[,-c(1:5)]) attributes(a) a How do I plot the first two canonial variables of a? And I want to take the rownames of world as pch ... plot(..., pch=rownames(world), col=as.numeric(world[,1])) Thanks in advance! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] confidence band
Hello, I made a function, which calculates the confidence interval and the prediction interval, but if I want to plot it, then it plots only the regressionline. Maybe somebody can help me: conf.band - function(x,y) { res.lsfit - lsfit(x,y) xi - seq(from=40, to=160, length=200) n - length(x) MSE - sqrt(sum(res.lsfit$residuals^2)/(n-2)) # confidence interval band - sqrt(2*qf(0.95,2,n-2)) * MSE * sqrt(1/n+(xi-length(x))^2/(var(x)*(n-1))) uiv - res.lsfit$coef[1] + res.lsfit$coef[2]*xi - band oiv - res.lsfit$coef[1] + res.lsfit$coef[2]*xi + band # prediction interval band - sqrt(2*qf(0.95,2,n-2)) * MSE * sqrt(1+1/n +(xi-mean(x))^2/(var(x)*(n-1))) uip - res.lsfit$coef[1] + res.lsfit$coef[2]*xi - band oip - res.lsfit$coef[1] + res.lsfit$coef[2]*xi + band # creating the graphik plot(x, y, xlab=colnames(x), ylab=colnames(y), pch=19) abline(res.lsfit, col=1) matlines(xi, cbind(uiv,oiv), col=3, lty=2, lwd=2) matlines(xi, cbind(uiv,oip), col=2, lty=3, lwd=2) } -- Mit freundlichen Grüssen / Best Regards Soare Marcian-Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] canoncial correlation
Hello, I have a problem with the function concar: data set: http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/world2.R source(world2.R) world[,8] - log(world[,8]) world[,9] - log(world[,9]) x - world[,-c(1,2)] x - scale(x) a - cancor(x[,-c(6:9)],x[,-c(1:5)]) attributes(a) a How do I plot the first two canonial variables of a? And I want to take the rownames of world as pch ... plot(..., pch=rownames(world), col=as.numeric(world[,1])) Thanks in advance! -- Mit freundlichen Grüssen / Best Regards Soare Marcian-Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Excel data into R
library(xlsReadWrite) ?read.xls KR, Alin Soare 2007/5/12, Ozlem Ipekci [EMAIL PROTECTED]: Hello to all, How can I make R read the data from an Excel sheet? thanks, ozlem [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Biplot
Hello everybody, How could I extract the components of of a PCA to plot it into a biplot? I want to make pairwise biplots of the first three main components: biplot(princomp(x, cor=TRUE)) biplot(princomp(x[,c(1,2)], cor=TRUE)) biplot(princomp(x[,c(1,3)], cor=TRUE)) biplot(princomp(x[,c(2,3)], cor=TRUE)) Is this the only way, how I could plot them? I thought, that it could be possible to extract them of the full PCA .. KR, Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Value at Risk
Oh sry, I forgot to add the R-help list. Thanks a lot for your help Guarav! 2007/5/11, [EMAIL PROTECTED] [EMAIL PROTECTED]: Hi Saore ***Please always mark a copy to the R-help list, it may be helpfull to many, you have forgotten twice*** *** Do Reply to all with history *** :-) cheers YOU ARE THE BEST :) I have some problems understanding R, but R and I will be friends in the future hehe :) I have another problem with investing in one of this stockfonds. Lets say I would invest in the europe stockfonds on 2.5.2006 1000 dollar. What would be the 99%VaR/1 day under historical simulation? The same as above? @@@ So what do you think, -2.86 number means Lets investigate suppose you have invested 1000, one way to realize is 100*ln(Tommorow/Todays) = -2.86 (out return) where Todays = 1000 hence Tommorow = 1000*exp(-2.86/100) = 971.8051 , therefore Loss = 1000 - 971.8051 = 28.19489 I hope this would make your understanding much better and clear about VaR :-) HTH KR, Alin 2007/5/11, [EMAIL PROTECTED] * [EMAIL PROTECTED]* [EMAIL PROTECTED] [EMAIL PROTECTED]: reply is inline Hello Gaurav, The function: VaR(tstock[,2],alpha=0.01) # gives the same VaR as above with historical simulation VaR -2.86 but i tried this function for normal distribution: VaR.norm (tstock[,2],p=0.99)$VaR Error in VaR.norm(tstock[, 2], p = 0.99) : Negative value in parameter 'ydat' @@@ if you have seen the help manual then you mus have got that you dont need to give the retun series. R is trying to calucate the logarithm of a negative number which is why it is throwing you error. try this instead XXX-VaR.norm(stock$ESPA.STOCK.EUROPE,p=0.01) XXX$VaR [1] -3.11079 I dont understand the way with the normal distribution :( Maybe you can help me a littble bit. Cheers :-) KR, Alin Soare 2007/5/11, [EMAIL PROTECTED] [EMAIL PROTECTED] * [EMAIL PROTECTED] [EMAIL PROTECTED]: reply is inline - Regards, \\\|/// \\ -- // ( o o ) oOOo-(_)-oOOo | | Gaurav Yadav | Assistant Manager, CCIL, Mumbai (India) | Mob: +919821286118 Email: [EMAIL PROTECTED] *[EMAIL PROTECTED] | Man is made by his belief, as He believes, so He is. | --- Bhagavad Gita |___Oooo oooO( ) ( ) ) / \ ((_/ \_ ) Hello Mr. Gaurav Yadav, Hi Soare, 1. I want to calculate the 99%VaR/1 day for the stock fonds, after sorting the values the 5th or 6th value is it? In Historical simulation it is the 5th value.. because it tells you to be more cautious that a higher loss 'may' be there, secondly VaR only shows the possibility and not the maximum loss which you can incur :-) cheers 2. How do I calculate it under normal distribution aproximation? Well there is also a normal method or variance - covariance method which assumes normal distribution :-) if you want to incorporate recency effect then you can also see boudhouks method try this paper which will give you very good understanding of various methods of VaR * **http://papers.ssrn.com/sol3/papers.cfm?abstract_id=51420#PaperDownload *http://papers.ssrn.com/sol3/papers.cfm?abstract_id=51420#PaperDownload ++ apply(tstock,2,function(x) VaR(x,alpha=0.01)) # are these the right VaR's for the stockfonds? @@@ you can yourself see it, you have around 579 observation and 1% of it mean 5.79th observation Thus if you become risk averse then you take the 5th smallest value and otherwise 6th value. So just sort the returns in ascending order and then see the 5th and the 6th values sorted_espa_stock_europe-sort(tstock[,2]) sorted_espa_stock_europe[5] [1] -2.86 sorted_espa_stock_europe[6] [1] -2.74 your code gives -2.86 thus you can get the rest :-) cheers DISCLAIMER AND CONFIDENTIALITY CAUTION: This message and any attachments with it (the message) are confidential and intended solely for the addressees. Unauthorized reading, copying, dissemination, distribution or disclosure either whole or partial, is prohibited. If you receive this message in error, please delete it and immediately notify the sender. Communicating through email is not secure and capable of interception, corruption and delays. Anyone communicating with The Clearing Corporation of India Limited (CCIL) by email accepts the risks involved and their consequences. The internet can not guarantee the integrity of this message. CCIL shall (will) not therefore be liable for the message if modified. The recipient should check this email and any attachments for the presence of viruses. CCIL accepts no liability for any damage caused by any virus transmitted by this email. DISCLAIMER
[R] Value at Risk
Hello, I have a problem with calculating the VaR of stockfonds. Here the stockfonds dataset: http://www.ci.tuwien.ac.at/~weingessel/FStat2006/stockfonds.csv library(VaR) library(fPortfolio) library(e1071) stock - read.table(stockfonds.csv, header=TRUE, sep=,) tstock = ts(impute(stock[,2:6]), start=c(2004, 1), end=c(2006, 68), frequency=256) # imputing the NA's plot(tstock) tstock - diff(tstock) apply(tstock,2,function(x) VaR(x,alpha=0.01)) # are these the right VaR's for the stockfonds? apply(tstock,2,function(x) VaR.norm(x,p=0.99)$VaR) # this doesnt work :( I want to calculate the same VaR as above, but under normal distribution And I also have a problem with the historical simulation. If I would invest 1000 dollars in one of these stockfonds on 2.5.2006, what would be the 99%VaR/1day under historical simulation. Is there a function for calculating this? I cant find something usefull on google :( KR, Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How do i calculate emp Returns
Hello, I want to build empirical Returns of stockfonds, but I cant find a function in R, which calculate this. Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Sharpe-Ratio
Hello, Is there any possibility how i can calculate the Sharpe Ratio of a ts? KR, Alin Soare [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simulate values
Hello, Yes I tried arima.sim and everything works fine. Thanks for the help! Alin Soare 2007/4/25, Leeds, Mark (IED) [EMAIL PROTECTED]: he's just being a wise guy bcause I'm sure you meant to have an epsilon_t on the end. And he Surely knows that also. Did you Check out ?arima.sim. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Uwe Ligges Sent: Wednesday, April 25, 2007 3:15 AM To: Soare Marcian-Alin Cc: R-help@stat.math.ethz.ch Subject: Re: [R] simulate values Soare Marcian-Alin wrote: Hello, I want to simulate 100 values of the ARMA Process with this function: x[i] = 0.5 * x[i-1] + 0.2 * x[i-2] + x[i] + 0.9 * x[i-1] + 0.2 * x[i-2] + 0.3 * x[i-3] There is no kind of noise in your model, hence no need to do any simulation so far ... Uwe Ligges which possibilities do I have? Alin Soare [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation. Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers. This is not research and is not from MS Research but it may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this. Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls. You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions. We cannot guarantee that any such requests received via e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules). [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Log-Returns
Hello, I have a Problem to make Log-Returns of the dataset EuStockMarkets. Is there any function which could calculate it for me? data(EuStockMarkets) Thanks! Alin Soare [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] simulate values
Hello, I want to simulate 100 values of the ARMA Process with this function: x[i] = 0.5 * x[i-1] + 0.2 * x[i-2] + x[i] + 0.9 * x[i-1] + 0.2 * x[i-2] + 0.3 * x[i-3] which possibilities do I have? Alin Soare [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] robust correlation
Hello, How do I calculate a robust correlation in R? I want to compare it to the pearson method. library(mvoutlier) data(chorizon) cor(log10(chorizon$Al), log10(chorizon$Na), method=c(pearson)) KR, Alin Soare [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] distance-distance plot and multivariate outliers
Hello, I want to make a distance-distance plot of the classical covariance and the robust covariance. How can I create a distance-distance plot? And by the distance-distance plot I want to look for multivariate outliers, how can I do it? With identify? Kind Regards, Alin Soare [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Change the mode of a list
Hello, I dont know if it works, but try: storage.mode(xxx) = numeric Alin 2007/4/20, Felix Wave [EMAIL PROTECTED]: Hello, can anybody tell me a easy way to change the mode of an aggregate list to numeric? I found a solution but I looks cruel. Thank's Felix PS: In the past you have asked what I am doing. I have to evaluate measures of two gauges of our university. The aim is to get an answer which one is better. mode(MEAN) [1] list mode(MEASURE) [1] numeric MEAN- aggregate(INPUT[,3], by=list(INPUT[,2],INPUT[,1]), FUN=mean) MODE - matrix(c(MEAN[,2],MEAN[,1],MEAN[,3]), ncol=3, byrow=FALSE ) x - MODE[,1] -1 y - (MODE[,2] -1) / 10 MEASURE - matrix(c(MODE[,2],MODE[,1],MODE[,3]), ncol=3, byrow=FALSE ) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] print command
Hello Corinna, NullPointRevertante=plan1[3,2] #0.859 cat(null-pint measurement Revertante:, NullPointRevertante ,\n) Have Fun! Kind Regards, Soare Alin 2007/4/19, Schmitt, Corinna [EMAIL PROTECTED]: Dear R-Experts, I have the following command lines: NullPointRevertante=plan1[3,2] #0.859 print(null-pint measurement Revertante: ) print(NullPointRevertante) The result looks like: [1] null-pint measurement Revertante: [1] 0.859 It is ok but I achieve the following outlook: [1] null-pint measurement Revertante: 0.859 How can I achieve this? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] print command
Yes :) \t ... tabulator Alin 2007/4/19, Schmitt, Corinna [EMAIL PROTECTED]: Thanks! If I want to add a new line behind I need the command cat(null-pint measurement Revertante:, NullPointRevertante ,\n\n) Right? Corinna -- *Von:* Soare Marcian-Alin [mailto:[EMAIL PROTECTED] *Gesendet:* Donnerstag, 19. April 2007 10:46 *An:* Schmitt, Corinna; R-help@stat.math.ethz.ch *Betreff:* Re: [R] print command Hello Corinna, NullPointRevertante=plan1[3,2] #0.859 cat(null-pint measurement Revertante:, NullPointRevertante ,\n) Have Fun! Kind Regards, Soare Alin 2007/4/19, Schmitt, Corinna [EMAIL PROTECTED]: Dear R-Experts, I have the following command lines: NullPointRevertante=plan1[3,2] #0.859 print(null-pint measurement Revertante: ) print(NullPointRevertante) The result looks like: [1] null-pint measurement Revertante: [1] 0.859 It is ok but I achieve the following outlook: [1] null-pint measurement Revertante: 0.859 How can I achieve this? Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Filtering
Hello Everybody, How can I filter a dataset? Im trying to filter the dataset EuStockMarkets monthly and quarter. data(EuStockMarkets) ftse = EuStockMarkets[,4] Alin [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] importing excel-file
Hello Everybody, Install the package: install.packages(xlsReadWrite) Load it: library(xlsReadWrite) testfile = read.xls(TesFile.xls) Have Fun! Kind Regards, Soare Marcian-Alin PS: If dont works, then install also the package xtable, but it should work without installing it! 2007/4/18, John C Frain [EMAIL PROTECTED]: To avoid complications, save your file as comma separated and use one of the instructions for reading delimited files. If you are using a comma as a decimal point you are probably using ; as a separator. If this is so use read.csv2. Please see the help files for read.table. Best Regards John On 18/04/07, Schmitt, Corinna [EMAIL PROTECTED] wrote: Dear R-experts, It is a quite stupid question but please help me. I am very confuced. I am able to import normal txt ant mat-files to R but unable to import .xls-file I do not understand the online help. Can please anyone send me the corresponding command lines? The .xls-file is attached. In my file we use commas for the decimal format (example: 0,712), changes might be needed. Thanks, Corinna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John C Frain Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How do I print a string without the initial [1]?
Hello Steve, You can print strings in R with the method cat() \n . new line \t . tabulator Try: name - c(Steve) age=22 cat(\tHello my name is, name ,and I am, age ,years old.\n) Have Fun! Kind Regards, Soare Marcian-Alin 2007/4/18, steve [EMAIL PROTECTED]: If I print a sting I get an initial [1]: xx=a xx [1] a How do I get it to print just a with no [1]? I tried looking this up, but I don't know what the initial [1] is called. Steve __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Use of argument '...'
Dear Juan, You have to define your function like this: fun - function (x,y=0, ...) { x+y } The ... means that u can use the other parameters in par! The variables, which you want to use, these you have to define in your function! In this function i put y=0 on a standard value zero, if u try now fun(2), the result will be: 2 if u try fun(2,4), then the result will be: 6 Kind Regards, Alin Soare 2007/4/17, Juan Lewinger [EMAIL PROTECTED]: Dear R list, I've read the function writing sections on both An introduction to R and R language Definition manuals but still don't understand why the following gives an error message: fun - function(x, ...) x + y fun(1, y=2) I get: Error in fun(1, y = 2) : object y not found I'd appreciate any help in understanding this. R version 2.4.1 (2006-12-18) i386-pc-mingw32 ... Juan Pablo Lewinger Department of Preventive Medicine Keck School of Medicine University of Southern California 1540 Alcazar Street, CHP-220 Los Angeles, CA 90089-9011, USA __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.