Good morning, i'm new in R and i have two questions, i hope someone could help me please: 1) For example if i put alfa<-X*Y, is there any way that when i put "run line on selection" (or ctrl+R) the result appears without having to write again "alfa" and then again "run line on selection" to see the result? 2) When i select a column vector, for example Y<-datos[,2] ("datos" is in spanish, it means "data"), R doesnt recognize that column as a vector; if i put dim(Y) it says "null". What i do is to transplant the variable twice and put Y<-t(t(Y)), and then R recognize the column as a vector. Is there a way to make R recognize the vectors as vector in a first place (and avoid to do what i do)? Many many thanks and sorry for my english! AgustÃn [[alternative HTML version deleted]]
Your English isn't the problem. It's your failure to do your homework first: Please read "An Introduction to R," the tutorial that ships with R, or one of the many tutorials on the web (including in your native language, very likely), so search. Here also is another possible resource: http://cran.r-project.org/other-docs.html Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Tue, Mar 11, 2014 at 8:41 AM, agustin purciariello <apurciariello at hotmail.com> wrote:> > > > Good morning, > > i'm new in R and i have two questions, i hope someone could help me please: > > 1) For example if i put alfa<-X*Y, is there any way that when i put "run > line on selection" (or ctrl+R) the result > appears without having to write again "alfa" and then again "run line on > selection" to see the result? > > 2) When i select a column vector, for example Y<-datos[,2] ("datos" is in > spanish, it means "data"), R doesnt > recognize that column as a vector; if i put dim(Y) it says "null". What i do > is to transplant the variable twice and put Y<-t(t(Y)), and then R recognize > the column as a vector. Is there a way to make R recognize the vectors as > vector in a first place (and avoid to do what i do)? > > Many many thanks and sorry for my english! > Agust?n > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help at 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.html > and provide commented, minimal, self-contained, reproducible code. >
1. (alfa <- X*Y) # Sends the result of the expression to print() 2. Y <- datos[,2, drop=FALSE] # see the bracket manual page: ?"[" ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of agustin purciariello Sent: Tuesday, March 11, 2014 10:42 AM To: r-help at r-project.org Subject: [R] novice questions Good morning, i'm new in R and i have two questions, i hope someone could help me please: 1) For example if i put alfa<-X*Y, is there any way that when i put "run line on selection" (or ctrl+R) the result appears without having to write again "alfa" and then again "run line on selection" to see the result? 2) When i select a column vector, for example Y<-datos[,2] ("datos" is in spanish, it means "data"), R doesnt recognize that column as a vector; if i put dim(Y) it says "null". What i do is to transplant the variable twice and put Y<-t(t(Y)), and then R recognize the column as a vector. Is there a way to make R recognize the vectors as vector in a first place (and avoid to do what i do)? Many many thanks and sorry for my english! Agustmn [[alternative HTML version deleted]]