Re: [R] evaluation of equations from Ryacas

2013-06-19 Thread Søren Højsgaard
Dear Erin, Not exactly elegant, but > e<-expression(list(R == 100 * (1 - 2 * y/1))) > ee <- e[[1]][2] > ee (R == 100 * (1 - 2 * y/1))() > eval(parse(text=(substring(paste(ee), 5))), list(y=5)) [1] 99.9 Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailto:

[R] Problems in Constructing Two way Matrix

2013-06-19 Thread Fazli Raziq
Hello, Where is the problem in this programming. I want two way matrix, but it gives problem. The program is given below: Thanks in advance. Regards Fazli Raziq rep = 2 genes = 5 pred = c() iter   = array (dim = c(rep, pred)) pred = array(dim = c(1, genes)) m = c() l = 1 w = 1 for(m in 1:rep)

Re: [R] Problems in Constructing Two way Matrix

2013-06-19 Thread Berend Hasselman
On 19-06-2013, at 09:30, Fazli Raziq wrote: > Hello, > > Where is the problem in this programming. I want two way matrix, but it gives > problem. What is the problem? What are you expecting and what are you getting? > The program is given below: > > Thanks in advance. > > Regards > Fazli R

[R] knitr without R studio

2013-06-19 Thread AlexPiche
Hello folks, I`m using knitr on R studio, which make it easy to use, but a coworker of mine would like to run it on "simple" R. So I was wondering if you know what is the equivalent of the button "knit HTML" in RStudio in R. I tried knit2HTML( Graph 1 <#location1> Graph

Re: [R] Problems in Constructing Two way Matrix

2013-06-19 Thread Berend Hasselman
I'm cc'ing this to the R-help list. Please reply to the list and privately. You will get more response that way. Your reply does not address the issue I mentioned. Berend On 19-06-2013, at 10:29, Fazli Raziq wrote: > Dear Mr. Berend, > > I want to construct "Two way Matrix". The Algorithm i

Re: [R] Problems in Constructing Two way Matrix

2013-06-19 Thread Berend Hasselman
On 19-06-2013, at 10:32, Berend Hasselman wrote: > > I'm cc'ing this to the R-help list. > > Please reply to the list and privately. Sorry. I meant NOT privately. Berend __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

[R] I am facing problems in Two way Matrix

2013-06-19 Thread Fazli Raziq
Hello all, I want to construct "Two way Matrix". The Algorithm is like: 1)  Data of time with censoring or events 2)  Predictor variables (genes) 3)  Resample original data in step 1 and 2 by WR 4)  Apply Coxph Model to resample data. (Apply Surv function to each Predictor variable, individually

[R] (senza oggetto)

2013-06-19 Thread Ludovico Frate
Hi all! I am using this script to automatically generate txt file (raster map in ASCII format) from a big txt file x<-read.table("test.txt",header=T) # if headers are present in "test.txt" or x<-read.table("test.txt") # Actually, read.table() command skips the blank lines. n<-256 for (i in

Re: [R] hist function in a for loop

2013-06-19 Thread Rui Barradas
Hello, Your code doesn't work because you are calling a non-function: hist(singlefile$CL1( ... )) # here singlefile$CL1 is not a function. For us to be able to help you please do the following. 1. paste the output of the command below in a post dput(head(singlefile, 50)) 2. Post a call to h

[R] how to get growth rate of a (time series) data?

2013-06-19 Thread Yanyuan Zhu
Hello all, now I'm trying to switch from Excel to R to deal with the data, and as a newbie i got the problem as follows. suppose I have a data named "test" test<- data.frame(year=c(1996:2011), Y=c(74163.6,81658.5,86531.6,91125.0,98749.0,109028.0,120475.6,136613.4,160956.6,187423.5,222712.5,266599.

Re: [R] how to get growth rate of a (time series) data?

2013-06-19 Thread R. Michael Weylandt
On Wed, Jun 19, 2013 at 12:04 PM, Yanyuan Zhu wrote: > Hello all, now I'm trying to switch from Excel to R to deal with the data, > and as a newbie i got the problem as follows. > > suppose I have a data named "test" > test<- data.frame(year=c(1996:2011), > Y=c(74163.6,81658.5,86531.6,91125.0,9874

Re: [R] how to get growth rate of a (time series) data?

2013-06-19 Thread Joshua Ulrich
On Wed, Jun 19, 2013 at 6:24 AM, R. Michael Weylandt wrote: > On Wed, Jun 19, 2013 at 12:04 PM, Yanyuan Zhu wrote: >> Hello all, now I'm trying to switch from Excel to R to deal with the data, >> and as a newbie i got the problem as follows. >> >> suppose I have a data named "test" >> test<- data

Re: [R] knitr without R studio

2013-06-19 Thread Ista Zahn
Hi Alex, Have you read the ?knit or ?knit2html documentation? I don't believe there is a kit2HTML function (notice the uppercase), and the input should be the path to a file. Please do read the documentation. Best, Ista On Wed, Jun 19, 2013 at 3:53 AM, AlexPiche wrote: > Hello folks, > > I`m us

Re: [R] how to get growth rate of a (time series) data?

2013-06-19 Thread Blaser Nello
diff(test$Y)/(test$Y)[-1] calculates (Y(t)-Y(t-1))/Y(t). To get (Y(t)-Y(t-1))/Y(t-1) instead, use diff(test$Y)/(test$Y)[-length(test$Y)] or better diff(test[,"Y"])/test[-nrow(test), "Y"] -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behal

[R] Simple example of variables decorrelation using the Cholesky decomposition

2013-06-19 Thread Xavier Prudent
Dear all, I made a simple test of the Cholesky decomposition in the package 'Matrix', by considering 2 variables 100% correlated. http://blogs.sas.com/content/iml/2012/02/08/use-the-cholesky-transformation-to-correlate-and-uncorrelate-variables/ The full code is below and can be simply copy&paste

Re: [R] how to get growth rate of a (time series) data?

2013-06-19 Thread Gabor Grothendieck
On Wed, Jun 19, 2013 at 7:04 AM, Yanyuan Zhu wrote: > Hello all, now I'm trying to switch from Excel to R to deal with the data, > and as a newbie i got the problem as follows. > > suppose I have a data named "test" > test<- data.frame(year=c(1996:2011), > Y=c(74163.6,81658.5,86531.6,91125.0,98749

[R] nls singular gradient ..as always..

2013-06-19 Thread pakoun
Hi all. Sorry for posting again such a topic but I went through previous posts but couldn't find a solution. I use the following code to fit an exponential model to my data. I have 4 different datasets. For 3 datasets nls seems to work fine and I have no error messages. But for 1 dataset I am get

[R] p values of lmer

2013-06-19 Thread meng
Hi all: I met a question about lmer. fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) summary(fm1) ... Fixed effects: Estimate Std. Error t value (Intercept) 251.405 6.825 36.84 Days 10.467 1.5466.77 ... My question: Why p values of (Intercept) an

[R] quantile

2013-06-19 Thread Francesco Miranda
Hello,How do I extract only the value from the quantile function?example:quantile (x, probs = 0.10) 10%-1.83442I want to add salt only the number -1.83442 SincerelyFrancesco Miranda [[alternative HTML version deleted]]

[R] Linear combination of time series for approximating another one

2013-06-19 Thread Francisco Javier Santos Alamillos
Dear R community, I would like to approximate a time serie as linear combination of a set of many time series, minimizing the number of the time series involved in the linear combination. Can you recommend to me any method for this? Any paper about this? I will appreciate much your suggestions.

Re: [R] write a function to do pairwise calculation

2013-06-19 Thread arun
Hi, Even if you have 15 matrices, you should be able to do it in the same way. For example in the case of 5 matrices: set.seed(24) A<- matrix(sample(1:50,20,replace=TRUE),ncol=4) B<- matrix(sample(40:60,20,replace=TRUE),ncol=4) C<- matrix(sample(1:60,20,replace=TRUE),ncol=4) D<- matrix(sample(1:30

Re: [R] quantile

2013-06-19 Thread arun
Hi, May be this helps: set.seed(28)  x<- sample(1:40,20,replace=TRUE)  qx<-quantile(x,probs=0.10)  qx #10% #3.8  qx+1 #10% #4.8 attr(qx,"names")<-NULL qx #[1] 3.8  qx+1 #[1] 4.8 A.K.   - Original Message - From: Francesco Miranda To: "r-help@r-project.org" Cc: Sent: Wednesday, J

Re: [R] p values of lmer

2013-06-19 Thread Rune Haubo
Try library(lmerTest) fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) summary(fm1) Linear mixed model fit by REML Formula: Reaction ~ Days + (Days | Subject) Data: sleepstudy AIC BIC logLik deviance REMLdev 1756 1775 -871.8 17521744 Random effects: Groups NameV

Re: [R] p values of lmer

2013-06-19 Thread R. Michael Weylandt
On Wed, Jun 19, 2013 at 10:27 AM, meng wrote: > Hi all: > I met a question about lmer. > > fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy) > summary(fm1) > > ... > > Fixed effects: > Estimate Std. Error t value > (Intercept) 251.405 6.825 36.84 > Days 10.467

[R] knitr: side-by-side figures in R markdown

2013-06-19 Thread Michael Friendly
I've read all the docs on knitr and some blogs on this topic, but can't figure out how to produce side-by-side figures in R markdown, except by composing a single figure in R with par(mfrow=c(1,2)). I know this can be done easily with the LaTeX engine, but why not with HTML output? A small te

Re: [R] Elementary Help

2013-06-19 Thread arun
HI, Probably, this is the case.  It is better to provide a reproducible example data as mentioned in the posting guide. set.seed(24) dat1<- data.frame(ID=c(1:3,5:8,10:14),value=sample(1:40,12,replace=TRUE))  IDs<- 1:14  #the possible ID list setdiff(IDs,dat1$ID) #[1] 4 9 length(setdiff(IDs,dat1$ID

Re: [R] How to combine and transpose lists

2013-06-19 Thread arun
Hi, Please use ?dput().  If `lst1` is the list. do.call(rbind,lapply(lst1,t)) #  Estimate  Std. Error   t value   Pr(>|t|) #card1  0.000577912 0.003956905 0.1460515 0.88388493 #card2  0.005164347 0.003311546 1.5594972 0.11892405 #card3  0.002682773 0.003683422 0.7283372 0.46643165 #card

Re: [R] How to combine and transpose lists

2013-06-19 Thread arun
You could also use: t(data.frame(lst1)) #  Estimate  Std. Error   t value   Pr(>|t|) #card1  0.000577912 0.003956905 0.1460515 0.88388493 #card2  0.005164347 0.003311546 1.5594972 0.11892405 #card3  0.002682773 0.003683422 0.7283372 0.46643165 #cardva 0.003123452 0.002727940 1.1449856 0.25

[R] T test for Single Mean

2013-06-19 Thread Sparks, John James
Dear R Helpers, I am stuck on some syntax and I thought that I was following one of the examples that I found out there quite faithfully. I just want to know how to do a t test on a single mean for whether or not it is greater than a specific value. So I am using the data set sleep and I want to

Re: [R] Retrieving Labels from vars/cols

2013-06-19 Thread Adams, Jean
I'm not sure what you mean by the $variables.label property. Are you just looking for the column names? If your data frame is called "df", try names(df) Jean On Tue, Jun 18, 2013 at 2:16 PM, Lívio Cipriano wrote: > Hi, > > How can I read/retrieve the Labels strings of the $variables.label

Re: [R] T test for Single Mean

2013-06-19 Thread Bert Gunter
(Re-) Read the docs (e.g. Intro to R, R Language Definition) . ... arguments have to be named! t.test(sleep$extra,mu=0, alt = "greater") ## works -- Bert On Wed, Jun 19, 2013 at 6:50 AM, Sparks, John James wrote: > Dear R Helpers, > > I am stuck on some syntax and I thought that I was followin

Re: [R] (senza oggetto)

2013-06-19 Thread Adams, Jean
Try this: for (i in 1:100){ filename <- paste("file_", i, ".txt", sep="") m <- x[((i-1)*256 + 1):(i*256), ] meta <- paste0("ncols = ", dim(m)[2], ", nrows = ", dim(m)[1], ", cell size = ???, etc.") write.table(meta, filename, row.names=FALSE, col.names=FALSE) write.table(m, filename, row.names=F

[R] to build a data.frame

2013-06-19 Thread Arnaud Michel
Hello I have the following dataframe df <- data.frame( Project=c("Abaco","Abaco","Abac","Abaco","Abaco","Abaco", "Abaco","Adaptclone","Adaptclone","Adaptclone","Adaptclone","Adaptclone", "Adaptclone","Adopt","Adopt","Adopt"), Country=c("Zimbabwe","Burkina Faso","South Africa","Madagascar","Tanz

Re: [R] Retrieving Labels from vars/cols

2013-06-19 Thread David Carlson
Perhaps you are talking about the variable.labels attribute returned by read.spss in package foreign? If so, you should try the attributes() or the attr() function: ?attributes ?attr - David L Carlson Associate Professor of Anthropology Texas A&M University Col

Re: [R] nls singular gradient ..as always..

2013-06-19 Thread Adams, Jean
What does a plot of your data look like? plot(ndat$dist, ndat$vario.dNEE) Anything remotely like a two-parameter single exponential rise to a maximum from zero as shown on this webpage, for example? http://www.graphpad.com/guides/prism/6/curve-fitting/index.htm?reg_classic_1assoc.htm Jean O

Re: [R] to build a data.frame

2013-06-19 Thread Rui Barradas
Hello, Try the following. aggregate(Project ~ Country + Iso, data = df, FUN = length) Hope this helps, Rui Barradas Em 19-06-2013 15:23, Arnaud Michel escreveu: Hello I have the following dataframe df <- data.frame( Project=c("Abaco","Abaco","Abac","Abaco","Abaco","Abaco", "Abaco","Adaptc

Re: [R] to build a data.frame

2013-06-19 Thread David Carlson
Try this: > aggregate(Project~Country+Iso, df, length) Country Iso Project 1 Burkina Faso BF 2 2 Ethiopia ET 1 3 Ghana GH 1 4 Kenya KE 2 5Madagascar MG 2 6 Mali ML 1 7Mozambique MZ 1 8 Nigeria NG

Re: [R] to build a data.frame

2013-06-19 Thread arun
Hi, May be this helps: library(plyr)  ddply(df,.(Country,Iso),summarize,NbrProj=length(Project)) #    Country Iso NbrProj #1  Burkina Faso  BF   2 #2  Ethiopia  ET   1 #3 Ghana  GH   1 #4 Kenya  KE   2 #5    Madagascar  MG   2 #6  Mali  ML   1

Re: [R] quantile

2013-06-19 Thread S Ellison
Or cast to vector: > set.seed(28) >  x<- sample(1:40,20,replace=TRUE) >  qx<-quantile(x,probs=0.10) >  qx > #10% > #3.8 > as.vector(qx) > #3.8 *** This email and any attachments are confidential. Any use...{{dropped:8}}

[R] Outputting a random survival forest to rf2rfz in windows

2013-06-19 Thread Erel JOFFE
Hi, I am writing this message for the benefit of the community.I have been working with randomForestSRC on a windows machine.I have been trying for days to output the forest to an rfz file so that I can print a graphical representation of the tree using Ishwaran and Kogalur's java GUI for visual

[R] Ryacas loads but yacas has an error

2013-06-19 Thread Erin Hodgess
Hello yet again, R People: I was working with Ryacas and yacas last night and all was well. Now this morning, I keep getting the following: > a <- Sym("a") > a Error in summary.connection(x) : invalid connection > When I go to yacas from the command line, it works fine. Any suggestions, please

Re: [R] evaluation of equations from Ryacas

2013-06-19 Thread William Dunlap
> > e<-expression(list(R == 100 * (1 - 2 * y/1))) > > ee <- e[[1]][2] > > ee > (R == 100 * (1 - 2 * y/1))() > > eval(parse(text=(substring(paste(ee), 5))), list(y=5)) > [1] 99.9 The following avoids the fragile substring(paste(expression)) business: > eval(e[[1]][[2]][[3]], list(y=5))

Re: [R] Ryacas loads but yacas has an error

2013-06-19 Thread Søren Højsgaard
Dear Erin, I don't have solution, but there is a remark on connection issues at http://code.google.com/p/ryacas/ An alternative could be to look at the rSymPy or rmathpiper packages which may do what you want. Regards Søren -Original Message- From: r-help-boun...@r-project.org [mailt

Re: [R] evaluation of equations from Ryacas

2013-06-19 Thread Gabor Grothendieck
On Wed, Jun 19, 2013 at 1:03 AM, Erin Hodgess wrote: > Hello again. > > Now I have the following: >> xx > [1] "Solve(1 - R/100==(2*y)/1,R)" >> yacas(xx) > expression(list(R == 100 * (1 - 2 * y/1))) >> Try the Ryacas Sym interface: > library(Ryacas) > > R <- Sym("R") > y <- Sym("y") > ans

Re: [R] Elementary Help

2013-06-19 Thread arun
Hi, Based on the information you provided, the solution should be the one I provided earlier.  Otherwise, I must have misunderstood your question.  In your first post, you mentioned the IDs range from 5:200.   So, the question is not clear. dat1<- read.table(text=" timeSec pupilId pupilName 13

Re: [R] Ryacas loads but yacas has an error

2013-06-19 Thread Gabor Grothendieck
On Wed, Jun 19, 2013 at 11:50 AM, Erin Hodgess wrote: > Hello yet again, R People: > > I was working with Ryacas and yacas last night and all was well. > > Now this morning, I keep getting the following: > >> a <- Sym("a") >> a > Error in summary.connection(x) : invalid connection >> > > When I go

[R] alternative to ifelse

2013-06-19 Thread Brian Perron
Greetings: I am looking for a way to avoid using the ifelse function for constructing a new variable. More specifically, assume I have a set of variables with scores ranging from 1 to 30. set.seed(12345) x <- c(1:30) x1 <- sample(x, 15, replace = TRUE) x2 <- sample(x, 15, replace = TRUE) x3 <- s

[R] sum epsilon-regression only works with certain epsilon values

2013-06-19 Thread Joao Quariguasi
Hello, I am trying to run the following piece of command: svm.linear<-svm(price~., subset = generation >0, data = trainset, cost = C, epsilon = 1, type = 'eps-regression') If epsilon = 1, the program runs fine. For larger values, e.g. 10, I get the following error: Error in predict.svm(ret, x

Re: [R] Vectorize a series of Matrix Multiplications

2013-06-19 Thread David Winsemius
On Jun 17, 2013, at 8:48 AM, G Vishwanath wrote: > Can I have some help in vectorizing a series of matrix multiplications? > Toy Example > > mat_size=2; num_matrices=3; num_users=2 > > ToyArray=array(1,dim=c(mat_size, mat_size, num_matrices, num_users)) > /* So I open an 4-dim array to store

[R] GLMM predictor variables

2013-06-19 Thread Bruce Rawlings
Hi all, I have a quick question regarding predictor variables in a GLMM analysis, a subject I am new to. I am running a study investigating multi-modal communication in primates. specifically, primate gestures that accompany vocalizations. I have measured the call rate, call duration and peak fr

Re: [R] nls singular gradient ..as always..

2013-06-19 Thread pakoun
Yes it should look like that... what i am doing is a variogram fit . But the data of course are spread almost all over.. I would guess might be problem with the data only? -- View this message in context: http://r.789695.n4.nabble.com/nls-singular-gradient-as-always-tp4669859p4669898.html Sent

Re: [R] knitr without R studio

2013-06-19 Thread Yihui Xie
knitr is not tied to RStudio, and I believe this StackOverflow post can answer your question: http://stackoverflow.com/q/10646665/559676 Regards, Yihui -- Yihui Xie Phone: 206-667-4385 Web: http://yihui.name Fred Hutchinson Cancer Research Center, Seattle On Wed, Jun 19, 2013 at 4:42 AM, Ista Z

Re: [R] alternative to ifelse

2013-06-19 Thread Richard M. Heiberger
as.numeric(x1 == 1 | x2 == 1 | x3 == 1 | x4 == 1) On Wed, Jun 19, 2013 at 9:24 AM, Brian Perron wrote: > Greetings: > > I am looking for a way to avoid using the ifelse function for > constructing a new variable. More specifically, assume I have a set > of variables with scores ranging from 1 t

Re: [R] nls singular gradient ..as always..

2013-06-19 Thread Adams, Jean
It's hard to say without seeing the data. It could be the data, it could be the starting values, it could be the model choice. Jean On Wed, Jun 19, 2013 at 10:45 AM, pakoun wrote: > Yes it should look like that... what i am doing is a variogram fit . But > the > data of course are spread almo

Re: [R] alternative to ifelse

2013-06-19 Thread Enrico Schumann
On Wed, 19 Jun 2013, Brian Perron writes: > Greetings: > > I am looking for a way to avoid using the ifelse function for > constructing a new variable. More specifically, assume I have a set > of variables with scores ranging from 1 to 30. > > set.seed(12345) > x <- c(1:30) > x1 <- sample(x, 15,

Re: [R] alternative to ifelse

2013-06-19 Thread Marc Schwartz
On Jun 19, 2013, at 8:24 AM, Brian Perron wrote: > Greetings: > > I am looking for a way to avoid using the ifelse function for > constructing a new variable. More specifically, assume I have a set > of variables with scores ranging from 1 to 30. > > set.seed(12345) > x <- c(1:30) > x1 <- sam

Re: [R] alternative to ifelse

2013-06-19 Thread Marc Schwartz
On Jun 19, 2013, at 8:24 AM, Brian Perron wrote: > Greetings: > > I am looking for a way to avoid using the ifelse function for > constructing a new variable. More specifically, assume I have a set > of variables with scores ranging from 1 to 30. > > set.seed(12345) > x <- c(1:30) > x1 <- sam

Re: [R] alternative to ifelse

2013-06-19 Thread Marc Schwartz
On Jun 19, 2013, at 1:23 PM, Marc Schwartz wrote: > > On Jun 19, 2013, at 8:24 AM, Brian Perron wrote: > >> Greetings: >> >> I am looking for a way to avoid using the ifelse function for >> constructing a new variable. More specifically, assume I have a set >> of variables with scores rangi

Re: [R] alternative to ifelse

2013-06-19 Thread Marc Schwartz
On Jun 19, 2013, at 1:23 PM, Marc Schwartz wrote: > > On Jun 19, 2013, at 8:24 AM, Brian Perron wrote: > >> Greetings: >> >> I am looking for a way to avoid using the ifelse function for >> constructing a new variable. More specifically, assume I have a set >> of variables with scores rangi

Re: [R] alternative to ifelse

2013-06-19 Thread arun
Hi, May bet this also helps: set.seed(12345) x <- c(1:30) x1 <- sample(x, 15, replace = TRUE) x2 <- sample(x, 15, replace = TRUE) x3 <- sample(x, 15, replace = TRUE) x4 <- sample(x, 15, replace = TRUE) indx<-1+2*(x1==1)+4*(x2==1)+8*(x3==1)+16*(x4==1)  as.numeric(indx!=1) #[1] 0 1 0 0 0 0 0 0 0 0 0

Re: [R] help with text patterns in strings

2013-06-19 Thread arun
HI Burnette, As this is continuation of the earlier thread, you could post it on the same thread by cc: to rhelp. Try this: res1<-sapply(vec3,function(x) length(vec2New[grep(x,vec2New)]) ) dat1<-data.frame(res1,Name=names(vec3))  dat1$Name<-factor(dat1$Name,levels=c("early","mid","late","wknd")

Re: [R] knitr: side-by-side figures in R markdown

2013-06-19 Thread Yihui Xie
You need to remove out.extra='style="display:block; margin: auto"'. In CSS, display:block; means this element stands in its own line, and no other elements can sit by its side. This is applied to individual images, so the two images will not be arranged side by side. But you will lose the center a

Re: [R] GLMM predictor variables

2013-06-19 Thread Bert Gunter
Wrong list -- Your question is not about R. Post on a statistics list like stats.stackexchange.com -- or better yet, consult a local statistician for guidance. Cheers, Bert On Wed, Jun 19, 2013 at 8:44 AM, Bruce Rawlings wrote: > Hi all, > > I have a quick question regarding predictor variables

Re: [R] how to get growth rate of a (time series) data?

2013-06-19 Thread Rolf Turner
On 19/06/13 23:24, R. Michael Weylandt wrote: On Wed, Jun 19, 2013 at 12:04 PM, Yanyuan Zhu wrote: Hello all, now I'm trying to switch from Excel to R to deal with the data, and as a newbie i got the problem as follows. suppose I have a data named "test" test<- data.frame(year=c(1996:2011), Y=

[R] Trouble with SASxport in R.3.0. under 32-bit and 64-bit Windows (both 7 and Vista)

2013-06-19 Thread Santosh
Dear Rxperts,.. I am using R 3.0 in both 32- and 64-bit Windows 7 environment and have trouble using SASxport. They seem to work fine under R.2.15.3. The error/warning messages are provided below... Following are the messages obtained when trying to read s SAS transport file (.xpt) library

[R] Returning name of dataframe?

2013-06-19 Thread Thomas Parr
I am writing a function and I would like to return the name of a data frame in a paste call, but I can't figure out how to just get the name. The names of the data frames used, won't be the same each time. I have to be overlooking the obvious. #For example: a<-replicate(5, rnorm(20)) b<-replicat

Re: [R] Returning name of dataframe?

2013-06-19 Thread jim holtman
'a' and 'b' are vectors of length 100, so the sum of them would also produce a vector of 100. So in one case, your code should look like this: > a<-replicate(5, rnorm(20)) > b<-replicate(5, rnorm(20)) > > xyz<-function(x,y){ + z<-x+y + print(paste("the sum of", x, "and", y,"is", z, sep=" "))

Re: [R] Returning name of dataframe?

2013-06-19 Thread arun
Hi, May be this helps: xyz<-function(x,y){   z<-x+y   print(paste("the sum of", deparse(substitute(x)), "and", deparse(substitute(y)),"is", sep=" "))   z } xyz(a,b) [1] "the sum of a and b is" [,1]    [,2]    [,3]    [,4]    [,5]  [1,] -1.38805146 -1.15706888 -1.0942

Re: [R] Returning name of dataframe?

2013-06-19 Thread David Winsemius
On Jun 19, 2013, at 6:27 PM, jim holtman wrote: > 'a' and 'b' are vectors of length 100, so the sum of them would also > produce a vector of 100. Just to (hopefully) clarify, R code `sum(z)` would be a vector of length:1 but `z` which is _not_ `sum(z)` but rather `x+y` would be length:100.

Re: [R] Returning name of dataframe?

2013-06-19 Thread Thomas Parr
Great, that is exactly what I am looking for. On Wed, Jun 19, 2013 at 9:39 PM, arun wrote: > Hi, > May be this helps: > > xyz<-function(x,y){ > z<-x+y > print(paste("the sum of", deparse(substitute(x)), "and", > deparse(substitute(y)),"is", sep=" ")) > z > } > > xyz(a,b) > [1] "the sum of

Re: [R] Retrieving Labels from vars/cols

2013-06-19 Thread Lívio Cipriano
On 19 June 2013 09:26:30 David Carlson wrote: > Perhaps you are talking about the variable.labels attribute returned > by read.spss in package foreign? That is it. I'll try it Thanks Lívio Cipriano __ R-help@r-project.org mailing list https://stat.et

Re: [R] Retrieving Labels from vars/cols

2013-06-19 Thread Lívio Cipriano
On 19 June 2013 09:26:30 David Carlson wrote: > variable.labels attribute returned > by read.spss in package foreign? If so, you should try the > attributes() or the attr() function: Hi, I used attr(test,"variable.labels")[i][1]) and it worked. Thanks Lívio Cipriano _

[R] how to add any extra word to existing column heading in R

2013-06-19 Thread Suparna Mitra
Hello R experts, I want to add some extra words to number to existing column header. Can anybody tell me how to do that. e.g. if I have a data.frame Height.1 Height.2 Height.6 Height.8 Height.10 Height.11 Height.17 Height.20 Height.22 Height.31 MBR174 720 104

Re: [R] how to add any extra word to existing column heading in R

2013-06-19 Thread Pascal Oettli
Hello, What did you try to do by yourself before to ask? Regards, Pascal On 20/06/13 13:56, Suparna Mitra wrote: Hello R experts, I want to add some extra words to number to existing column header. Can anybody tell me how to do that. e.g. if I have a data.frame Height.1 Height.2 He

Re: [R] how to add any extra word to existing column heading in R

2013-06-19 Thread Suparna Mitra
Hello, I was trying ways to define new column names. Or very traditional way to export the data and add names in excel. But thought there must a way, but searched with several key words in forum, but couldn't find the exact what I mean. May be my search terms are not perfect. Thanks, Mitra On

Re: [R] how to add any extra word to existing column heading in R

2013-06-19 Thread Pascal Oettli
Hello, Two keywords: "colnames" and "paste". Regards, Pascal On 20/06/13 14:09, Suparna Mitra wrote: Hello, I was trying ways to define new column names. Or very traditional way to export the data and add names in excel. But thought there must a way, but searched with several key words in f