Re: [R] how to remove the 'promise' attribute of an R object (.Random.seed)?

2012-05-22 Thread Prof Brian Ripley
On 22/05/2012 22:26, Yihui Xie wrote: I did not use delayedAssign() directly; I was using lazyLoad() and .Random.seed was saved in a database. The real story out there is the caching of my knitr package -- lazyLoad() was used to speed up the compilation of Sweave documents. I know lazyLoad() is

Re: [R] Menus - best practices?

2012-05-22 Thread Greg Snow
The tkexamp function in the TeachingDemos package can be used to create a tcltk based GUI for your own functions. On Fri, May 18, 2012 at 5:45 PM, Noah Silverman wrote: > Hello, > > I need to design a fairly simple front-end for someone to use an R script > system that I've built.  My thought wa

Re: [R] How to evaluate R things from Visual Studio?

2012-05-22 Thread Michael Sumner
FWIW, I got the R.NET example to work on Windows 7 (64-bit OS) with Visual Studio 10 Express (32-bit only) with their example program here: http://rdotnet.codeplex.com/ I downloaded this file, and set the VS reference to it: http://rdotnet.codeplex.com/downloads/get/211446 I used R-2.12.

Re: [R] R Memory Issues

2012-05-22 Thread Paul Johnson
Dear Emiliano: When they say to read the posting guide, mostly they mean read the posting guide. But I'll tell you the short version. 1. Include a full runable R program that causes the trouble you are concerned about. Include the data or a link to the data, usually the smallest possible example

Re: [R] how to remove the 'promise' attribute of an R object (.Random.seed)?

2012-05-22 Thread luke-tierney
I believe it would be better if the internal code forced the promise at this point. I'll have a look; there may be a few other similar instances worth looking at. luke On Tue, 22 May 2012, Yihui Xie wrote: Thanks! That is exactly what I did (https://github.com/yihui/knitr/blob/master/R/cache.

Re: [R] Deleting row labels in dataframe

2012-05-22 Thread David Winsemius
On May 22, 2012, at 10:01 PM, arun wrote: HI David, My intention was to get the output in the format: Price Floor Area Rooms Age Cent.heat 52 111 830 5 5.2no 54 128 710 5 6.2no 57 101 1000 5 3.8no 57 138 690 5 4.5no

Re: [R] Deleting row labels in dataframe

2012-05-22 Thread arun
HI David, My intention was to get the output in the format:  Price Floor Area Rooms Age Cent.heat     52   111  830 5 5.2    no     54   128  710 5 6.2    no     57   101 1000 5 3.8    no     57   138  690 5 4.5    no     59    93  780 5 6.8   yes which w

[R] Linear Interpolation help please

2012-05-22 Thread Andras Farkas
Dear experts   I have gotten this far with the question I have posted the other day, but wonder if someone could help me refine it. The following command will do the interpolationand plot it for the file attached:   data <- read.csv("C:\\Users\\andras\\Documents\\Subject1.csv") x <-data$x y <-dat

Re: [R] how to remove the 'promise' attribute of an R object (.Random.seed)?

2012-05-22 Thread Yihui Xie
Thanks! That is exactly what I did (https://github.com/yihui/knitr/blob/master/R/cache.R#L44) but I was wondering if .Random.seed could be better recognized when it is lazy loaded. Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State Universi

[R] Build error on RedHat EL 5.5: byte-compiling package 'compiler'

2012-05-22 Thread Paul Johnson
Greetings R-help! In case anybody has worked on an old Redhat system lately, can you remember what is the cause of this problem? I don't think this is a fatal problem, because I can get around it by uninstalling all of the R RPM packages and re-running the build. But if R is installed, the build

Re: [R] Deleting row labels in dataframe

2012-05-22 Thread David Winsemius
On May 22, 2012, at 6:30 PM, Peter Ehlers wrote: On 2012-05-22 13:55, arun wrote: Dear R group, I was working on an example dataset to see if the row labels can be deleted. I know that header=TRUE could be used when we use read.table. In the data.frame, I tried to delete row labels 1

Re: [R] Deleting row labels in dataframe

2012-05-22 Thread arun
Thanks Peter.  The code worked. I was trying to print it in the console without rownames. A.K. - Original Message - From: Peter Ehlers To: arun Cc: R help Sent: Tuesday, May 22, 2012 6:30 PM Subject: Re: [R] Deleting row labels in dataframe On 2012-05-22 13:55, arun wrote: > Dear

[R] How to read a function from keyboard?

2012-05-22 Thread zgu9
Hi everyone, I have an R problem about Input. I want to read an arbitrage function from keyboard. But I don't know how. I tried scan(), readLines() but fail to make the output as a function, or a list that I can use as.function to transform. Is it possible for R to do so? Thank you. Eric -- Vi

Re: [R] write data using xlsReadWrite

2012-05-22 Thread diyanah
Hi Ive come up with this code to read my file, but receive an error that I ve no idea how to fix. can some one help. > read<-read.xlsx("D:\\FYP\\image\\Cropped > Images\\user227\\user227forger.xlsx", sheetName="Sheet1", rowIndex="1", > colIndex="varLH2y", colClasses="character", row.names=TRUE) >E

Re: [R] LM with summation function

2012-05-22 Thread Peter Ehlers
Robbie, Here's what I *think* you are trying to do: 1. y is a cubic function of x: y = b1*x + b2*x^2 + b3*x^3 2. s is the cumsum of y: s_i = y_1 + ... + y_i 3. Given a subset of x = 1:n and the corresponding values of s, estimate the coefficients of the cubic. If that is the correct und

Re: [R] how to remove the 'promise' attribute of an R object (.Random.seed)?

2012-05-22 Thread Duncan Murdoch
On 12-05-22 12:22 PM, Yihui Xie wrote: Hi, The problem arises when I lazyLoad() the .Random.seed from a previously saved database. To simplify the process of reproducing the problem, see the example below: ## this assignment may not really make sense, but illustrates the problem delayedAssign('

Re: [R] write.xls

2012-05-22 Thread Nurdiyanah Jambari
Hi can you please help me with this. Ive come up with this code to read my file, but receive an error that I ve no idea how to fix. > read<-read.xlsx("D:\\FYP\\image\\Cropped Images\\user227\\user227forger.xlsx", sheetName="Sheet1", rowIndex="1", colIndex="varLH2y", colClasses="character", row.nam

Re: [R] In R, how do I execute a script that sets environment variables within the same shell session?

2012-05-22 Thread Duncan Murdoch
On 12-05-22 1:24 PM, Michael wrote: In R, how do I execute a script that sets environment variables within the same shell session? Hi all, Could you please shed some lights on how to do this? In a shell, I launched the R session. But then in R, I realized that some environment variables need

Re: [R] utils:::menuInstallLocal()

2012-05-22 Thread Duncan Murdoch
On 12-05-22 11:55 AM, Emiliano Zapata wrote: Hello R, I'm trying to install a package (class) locally; in windows 7, 64 bits machine. The only massage I see on the R Console is: utils:::menuInstallLocal() nothing else. What does this means, shouldn't I got some source of massage on the Console

Re: [R] ReName

2012-05-22 Thread Duncan Murdoch
On 12-05-22 4:08 AM, HAOLONG HOU wrote: Dear list, The name of R-language is too short and is not friendly to search engines. Do you think it can be renamed to something like "Rsio" or "Radio" ? Thank you so much for this useful software! You use gmail, so I assume you're familiar with Google.

Re: [R] ¨Time series and variables with different lengths

2012-05-22 Thread R. Michael Weylandt
i) Yes, R does factors "smartly" so don't worry about that. ii) Well, you'll need to toss off one observation of the variable you don't difference -- the choice on which end you want to do this should probably reflect how the time is encoded: (i.e., if you have data for May 22, does that reflect w

Re: [R] Naming dimnames in an array using the results of an expression

2012-05-22 Thread R. Michael Weylandt
I think you may be making this too hard, but before I venture a guess, what does your "result" object look like -- can you dput() it for us? Looking at the line you tried: dimnames(diag.data)<-list(names(result[1])=rownames(diag.data),names(result[[1]][2])=colnames(diag.data)) there seems to be

[R] help r error "the integral is probably divergent"

2012-05-22 Thread jlmdanderson
I constructed a likelihood function and then use optim to slove the mle. It gave the error like: > LBCE.est<-optim(c(2,2,1),LBCE,hessian=T) Error in integrate(LBCE.fc.4.1, lower = 0, upper = Inf) : the integral is probably divergent However, when I checked the the function of LBCE.fc.4.1, it

Re: [R] Working directory

2012-05-22 Thread jalantho...@verizon.net
I renamed all the .RData and .Rhistory files I could find, and then things started working. [[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

Re: [R] Working directory

2012-05-22 Thread jalantho...@verizon.net
I have R installed at c:/.  In Rprofile.site I have added the following function: .First <- function() {    setwd("c:/Users/little/Documents")    cat("\nRprofile.site --- Welcome at", date(), "\n") } However, I have discovered that the cat statement is not printing out, so there must be another

Re: [R] Creating functions with a loop.

2012-05-22 Thread R. Michael Weylandt
You can do what you want with the get() and assign() functions, though it might be easier and better to use match.fun() than get() Much better though would be to build your functions in a list and call the n-th element of the list with syntax like f.list[[3]](4) will call the function in the thi

Re: [R] Deleting row labels in dataframe

2012-05-22 Thread Peter Ehlers
On 2012-05-22 13:55, arun wrote: Dear R group, I was working on an example dataset to see if the row labels can be deleted. I know that header=TRUE could be used when we use read.table. In the data.frame, I tried to delete row labels 1,2,..5, but so far not successful. Is there a neat way

Re: [R] How to evaluate R things from Visual Studio?

2012-05-22 Thread Michael Sumner
On Wed, May 23, 2012 at 6:57 AM, Giannis Mamalikidis wrote: > I’ve already tried R.NET (http://rdotnet.codeplex.com/ ) Version 1.4 (stable) > and 1.4.1 (Change Set: 6d2c3f161801 ). > This does seem wonderful and it doesn’t have StaconnDCOM’s ridiculous > restrictions, BUT it refuses to work on m

Re: [R] Median computation

2012-05-22 Thread Preeti
Thanks Henrik! Here is the one-liner that I wrote: dfmed<-lapply(unique(colnames(df)), function(x) rowMedians(as.matrix(df[,colnames(df) == x]),na.rm=TRUE)) Thanks again! On Tue, May 22, 2012 at 3:23 PM, Henrik Bengtsson wrote: > See rowMedians() of the matrixStats package for replacing apply(x

Re: [R] How to evaluate R things from Visual Studio?

2012-05-22 Thread Giannis Mamalikidis
I understand what you're saying, but I know the mere basic stuff of programming. I am unable to exploit the so called "itch" because of my lack of knowledge. also, do you really have to get stuck on semantics??? it's just a sentence "what is that difficult?". A mere sentence. I've done a great

[R] Deleting row labels in dataframe

2012-05-22 Thread arun
Dear R group, I was working on an example dataset to see if the row labels can be deleted.   I know that header=TRUE could be used when we use read.table.  In the data.frame, I tried to delete row labels 1,2,..5, but so far not successful.  Is there a neat way to do it. Thanks. A.K. HousePri

Re: [R] pad leading zeros in front of strings

2012-05-22 Thread Rui Barradas
Hello, I believe there's nothing OS dependent about this: # pad with zeros padz <- function(x, n=max(nchar(x))) gsub(" ", "0", formatC(x, width=n)) padz(c(1, 10, 100), 5) padz(c("a", "aa")) padz(c("a", "aa"), 5) Rui Barradas Michael Weylandt wrote > > I think once upon a time this was found t

Re: [R] how to remove the 'promise' attribute of an R object (.Random.seed)?

2012-05-22 Thread Yihui Xie
I did not use delayedAssign() directly; I was using lazyLoad() and .Random.seed was saved in a database. The real story out there is the caching of my knitr package -- lazyLoad() was used to speed up the compilation of Sweave documents. I know lazyLoad() is supposed to be used only by R itself, bu

Re: [R] Median computation

2012-05-22 Thread Henrik Bengtsson
See rowMedians() of the matrixStats package for replacing apply(x, MARGIN=1, FUN=median). /Henrik On Tue, May 22, 2012 at 12:34 PM, Preeti wrote: > Hi, > > I have a 250,000 by 300 matrix. I am trying to calculate the median of > those columns (by row) with column names that are identical. I would

Re: [R] Median computation

2012-05-22 Thread Petr Savicky
On Tue, May 22, 2012 at 01:34:45PM -0600, Preeti wrote: > Hi, > > I have a 250,000 by 300 matrix. I am trying to calculate the median of > those columns (by row) with column names that are identical. I would like > this to be efficient since apply(x,1,median) where x is created by choosing > only

Re: [R] Is there a way to save EVERYTHING in R?

2012-05-22 Thread Jeff Newmiller
No. Write a script that reconstructs the working environment. Some differences may remain due to incompleteness of your script. The rest may be due to differences in the hardware or software environment. Such differences can only be minimized by choosing stable numerical algorithms or avoiding

Re: [R] simple, unidimensional heat map

2012-05-22 Thread Dimitri Liakhovitski
Thanks a lot, Sarah! Dimitri On Mon, May 21, 2012 at 5:23 PM, Sarah Goslee wrote: > Hi Dmitri, > > On Mon, May 21, 2012 at 5:06 PM, Dimitri Liakhovitski > wrote: >> I was wondering if someone could point in the direction of a package >> that could generate not heatmaps, but something like a unid

Re: [R] How to evaluate R things from Visual Studio?

2012-05-22 Thread Jeff Newmiller
Things tend to get done in the open-source world because someone has an itch to scratch. Giannis, you seem to be the one with the itch, and it doesn't appear to be an itch others on this list share. There exists documentation and example code for embedding R within other compiled environments, a

Re: [R] scatterplot x axis specifications

2012-05-22 Thread jhartsho
Thank you so much! I sat here staring forever and just couldn't see it. That's what a fresh pair of eyes are for!! Thanks! -- View this message in context: http://r.789695.n4.nabble.com/scatterplot-x-axis-specifications-tp4630952p4630978.html Sent from the R help mailing list archive at Nabble

[R] trouble with png image creation in R v2.14.0 on Red Hat 6

2012-05-22 Thread sean mcgee
Hello, Is anyone having trouble with png image generation with 2.14.0 on Red Hat 6? We recently updated our pipeline to Red Hat 6 (from 5) and R 2.14.0 (up from 2.9.0) and R shell scripts that worked fine before are now breaking in an unusual way. The source of the problem seems to be centered a

[R] Median computation

2012-05-22 Thread Preeti
Hi, I have a 250,000 by 300 matrix. I am trying to calculate the median of those columns (by row) with column names that are identical. I would like this to be efficient since apply(x,1,median) where x is created by choosing only those columns with same column name and looping on this is taking a

Re: [R] scatterplot x axis specifications

2012-05-22 Thread David Winsemius
On May 22, 2012, at 1:59 PM, jhartsho wrote: I have created a scatter plot that has come out okay but I am having trouble with the x axis. My data consists of 4 treatments but these treatments are days so R keeps reading them as numeric and making my x axis continuous. Here is what I hav

Re: [R] Working directory

2012-05-22 Thread Uwe Ligges
On 22.05.2012 20:28, jalantho...@verizon.net wrote: I am not experienced at R but have searched the manuals. . . . I have tried placing a setwd command in the Rprofile.site and Rprofile files. But it does not seem to work. It always reverts to a particular directory I have been using (save

Re: [R] package grid: mirror grob objects along an axis

2012-05-22 Thread baptiste auguie
Oops, sent too early; this obviously just a rotation, not a mirror image. It illustrates the problem though ;) b. On 23 May 2012 07:32, baptiste auguie wrote: > You can rotate the viewport to flip around the horizontal axis, > > library(grid) > grid.text("Chiral") > grid.text("Chiral", vp=viewpo

Re: [R] Is there an inverse function of Sys.getenv()

2012-05-22 Thread Uwe Ligges
On 22.05.2012 20:48, Michael wrote: Using "Sys.getenv()", I got a list of 380 environment variables... Now I open a new R session, how do I set those environment variables in my new R session using "Sys.setenv()"? There is no batch function for "Sys.setenv()"? Is there an import/export env

Re: [R] package grid: mirror grob objects along an axis

2012-05-22 Thread baptiste auguie
You can rotate the viewport to flip around the horizontal axis, library(grid) grid.text("Chiral") grid.text("Chiral", vp=viewport(angle=180, y=unit(0.5,"npc")-unit(1,"line"))) HTH, b. On 23 May 2012 05:34, Thomas Zumbrunn wrote: > Maybe my question was not concise enough. I was referring to ob

Re: [R] pad leading zeros in front of strings

2012-05-22 Thread Sarah Goslee
On Tue, May 22, 2012 at 3:12 PM, Hui Du wrote: > > Thanks all. I am trying to cleaning up user-inputted zip code. Most of them > are pure numeric values but someone put characters in zipcode field, so I > have to treat that field as a string rather than number. But a padded invalid zip code, is

Re: [R] scatterplot x axis specifications

2012-05-22 Thread Sarah Goslee
After fixing the error in your plot statement, this works for me: plot(pair$MC~pair$Day, pch=c(19,24)[as.factor(pair$Cookie)], xaxt="n", main='Paired t Test', xlab='Days in Field', ylab='Moisture Content (Percent)', xlim=c(0,45)) axis(1, c(0, 15, 30, 45)) I also added

Re: [R] Is there a way to save EVERYTHING in R?

2012-05-22 Thread Uwe Ligges
On 22.05.2012 20:23, Albert-Jan Roskam wrote: Hi Michael, check ?save No, it can't save environment variables! Uwe Ligges Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, win

Re: [R] scatterplot x axis specifications

2012-05-22 Thread jhartsho
Bolt Day CookieMC 1 MCA01 0 Bottom 60.28 2 MCB01 0 Bottom 83.63 3 MCC01 0 Bottom 48.34 4 MCB02 0 Bottom 84.52 5 MCA05 0 Bottom 74.92 6 MCA01 0Top 65.35 7 MCB01 0Top 88.68 8 MCC01 0Top 29.19 9 MCB02 0Top 82.63 10 MCA05 0Top 77.61 MC151 1

[R] Working directory

2012-05-22 Thread jalantho...@verizon.net
I am not experienced at R but have searched the manuals. . . . I have tried placing a setwd command in the Rprofile.site and Rprofile files.  But it does not seem to work.  It always reverts to a particular directory I have been using (saved in workspace image?) for a while.  However, I can pri

Re: [R] pad leading zeros in front of strings

2012-05-22 Thread Hui Du
Thanks all. I am trying to cleaning up user-inputted zip code. Most of them are pure numeric values but someone put characters in zipcode field, so I have to treat that field as a string rather than number. HXD -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail

Re: [R] pad leading zeros in front of strings

2012-05-22 Thread R. Michael Weylandt
I get "00123" and "00abc" respectively. Agreed it's perhaps odd, but c'est la OS. M On Tue, May 22, 2012 at 2:57 PM, Sarah Goslee wrote: > Michael, I'm curious: if you pass sprintf() a string, it still pads > with zeros? What's the output of: > > sprintf("%05s", "123") > sprintf("%05s", "abc")

Re: [R] pad leading zeros in front of strings

2012-05-22 Thread Sarah Goslee
Michael, I'm curious: if you pass sprintf() a string, it still pads with zeros? What's the output of: sprintf("%05s", "123") sprintf("%05s", "abc") On linux, sprintf() pads strings with spaces, as you'd expect. Padding strings with zeros is... odd. Sarah > sessionInfo() R version 2.15.0 (2012-0

Re: [R] pad leading zeros in front of strings

2012-05-22 Thread R. Michael Weylandt
Please do reply to the list -- I'm not on Windows so someone else will have to pick the question up to help you out. It's not great, but you could do something like zeroPad <- function(str, len.out, num.zeros = len.out[1] - nchar(str)){ paste0(paste(rep("0", num.zeros), collapse = ""), str) }

Re: [R] pad leading zeros in front of strings

2012-05-22 Thread Sarah Goslee
Hi, I think it's because " " is used to pad strings, while 0 is used to pad numbers*. If your values are always numeric, but stored as strings, you could use: > x <- "123" > sprintf("%05d", as.numeric(x)) [1] "00123" * From ?sprintf: ‘0’ For numbers, pad to the field width with leading zero

Re: [R] pad leading zeros in front of strings

2012-05-22 Thread R. Michael Weylandt
I think once upon a time this was found to be OS-dependent since it calls the system's C sprintf() -- I get the leading zeros on Mac. I presume you're on Windows? Michael On Tue, May 22, 2012 at 2:41 PM, Hui Du wrote: > Dear All, > > This question sounds very simple but I don't know where I am

[R] Is there an inverse function of Sys.getenv()

2012-05-22 Thread Michael
Using "Sys.getenv()", I got a list of 380 environment variables... Now I open a new R session, how do I set those environment variables in my new R session using "Sys.setenv()"? There is no batch function for "Sys.setenv()"? Is there an import/export environment variables function? Basically

[R] pad leading zeros in front of strings

2012-05-22 Thread Hui Du
Dear All, This question sounds very simple but I don't know where I am wrong. I just want to pad leading zeros in some string, for example, "123" becomes "00123". What is wrong if I do following? > sprintf("%05s", "123") [1] " 123" It didn't return "00123", instead it padded with 'blank'.

Re: [R] How to evaluate R things from Visual Studio?

2012-05-22 Thread Peter Ehlers
Sorry, I have no solution for your problem, but a comment; see inline below. On 2012-05-22 08:02, Giannis Mamalikidis wrote: Hello all, I’m new here and this is actually my very first post. My name is Giannis and I am an undergraduate student. I am programming in Microsoft’s Visual Studio 2010

Re: [R] scatterplot x axis specifications

2012-05-22 Thread Uwe Ligges
On 22.05.2012 19:59, jhartsho wrote: I have created a scatter plot that has come out okay but I am having trouble with the x axis. My data consists of 4 treatments but these treatments are days so R keeps reading them as numeric and making my x axis continuous. Here is what I have so far: pl

Re: [R] Is there a way to save EVERYTHING in R?

2012-05-22 Thread Albert-Jan Roskam
Hi Michael, check ?save   Regards, Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever don

Re: [R] Is there a way to save EVERYTHING in R?

2012-05-22 Thread Uwe Ligges
On 22.05.2012 19:50, Michael wrote: Is there a way to save EVERYTHING in R? Hi all, Could you please shed some lights on me about this? I am trying to see if there is a way to save EVERYTHING in R to a file, something like "save.image"... But "save.image" doesn't save environment variables

[R] scatterplot x axis specifications

2012-05-22 Thread jhartsho
I have created a scatter plot that has come out okay but I am having trouble with the x axis. My data consists of 4 treatments but these treatments are days so R keeps reading them as numeric and making my x axis continuous. Here is what I have so far: plot(pair$MC~pair$Day, pch=c(19,24)[as.fac

Re: [R] Creating functions with a loop.

2012-05-22 Thread Etienne Larrivée-Hardy
Michael's method seems to be working but I still can't get to wrap it in a loop since I cannot get the loop to dynamically change the functions' name, i.e. ff1, ff2, ff3, ... In other words, I would need the first iteration to create the function ff1, the second to create the function ff2, ... Furt

Re: [R] Could "incomplete final line found" be more serious than a warning?

2012-05-22 Thread Zhou Fang
If you look at the new file in raw mode, you'll see that it's chock full of ASCII nuls, while the old file has none. This is probably what's giving you the problems, because R does not allow strings containing embedded nul characters. (I believe this is because Nul in strings is pretty dangerous in

[R] Naming dimnames in an array using the results of an expression

2012-05-22 Thread Dr Bob Phillips
dear all i'm struggling with naming in an array diag.data is one of a series of 2x2 diagnostic testing arrays, with 'Outcome' columns (true/false) and 'Test' rows (High-risk, Low-risk), drawn from a larger list object of 'results' i can hard-code the names of the array using dimnames; diag.dat

Re: [R] Adding Text to a Plot

2012-05-22 Thread Peter Ehlers
On 2012-05-22 07:51, David Winsemius wrote: On May 22, 2012, at 9:10 AM, Canto Casasola, Vicente David wrote: I'm pretty sure I'm missing something about this. Is there a smart way of typping hat(R)^2 and it's value from a linear regression? I've just found this tricky one: # Sample data x<

[R] Is there a way to save EVERYTHING in R?

2012-05-22 Thread Michael
Is there a way to save EVERYTHING in R? Hi all, Could you please shed some lights on me about this? I am trying to see if there is a way to save EVERYTHING in R to a file, something like "save.image"... But "save.image" doesn't save environment variables such as those properties that are obtain

Re: [R] how to remove the 'promise' attribute of an R object (.Random.seed)?

2012-05-22 Thread luke-tierney
On Tue, 22 May 2012, Yihui Xie wrote: Hi, The problem arises when I lazyLoad() the .Random.seed from a previously saved database. To simplify the process of reproducing the problem, see the example below: ## this assignment may not really make sense, but illustrates the problem delayedAssign('

Re: [R] package grid: mirror grob objects along an axis

2012-05-22 Thread Thomas Zumbrunn
Maybe my question was not concise enough. I was referring to objects created with the "package "grid" (also called "grobs"), not to the function "grid" from package "graphics". For instance, let's say I have a polygon createad with grid::polygonGrob and want to mirror it along a specified axis.

Re: [R] Could "incomplete final line found" be more serious than a warning?

2012-05-22 Thread peter dalgaard
(Original below) Looks like someone had the bright idea of changing it to 16-bit UTF, so every 2nd byte is NUL. It works for me with x <- readLines(file("~/Downloads/WoS-new.txt", encoding="UTF-16")) (except that for some reason, x won't print properly although each individual line prints fin

[R] In R, how do I execute a script that sets environment variables within the same shell session?

2012-05-22 Thread Michael
In R, how do I execute a script that sets environment variables within the same shell session? Hi all, Could you please shed some lights on how to do this? In a shell, I launched the R session. But then in R, I realized that some environment variables need to be set up. Of course I can use "Sy

Re: [R] RNORM matrix based on CSV file values for MEAN and SD

2012-05-22 Thread R. Michael Weylandt
On Tue, May 22, 2012 at 12:40 PM, dcoakley wrote: > Thanks Michael, > > This seems to get me half-way towards a solution. However, I am still having > some difficulty in getting the out.csv exactly as I would like. I should > probably explain the issue a bit further. > > I am reading in a csv file

Re: [R] RNORM matrix based on CSV file values for MEAN and SD

2012-05-22 Thread dcoakley
Thanks Michael, This seems to get me half-way towards a solution. However, I am still having some difficulty in getting the out.csv exactly as I would like. I should probably explain the issue a bit further. I am reading in a csv file containing a list of 'n' parameters. I have attached a csv ( h

Re: [R] How to remove square brackets, etc. from address strings?

2012-05-22 Thread arun
Hi,  text <- "[Swidsinski, Alexander; Loening-Baucke, Vera; Lochs, Herbert] Charite Humboldt Univ, Innere Klin, D-10098 Berlin, Germany; [Hale, Laura P.] Duke Univ, Med Ctr, Dept Pathol, Durham, NC 27710 USA"  gsub("\\[.+?]","",text) A.K. - Original Message - From: Sabina Arndt To:

Re: [R] R Memory Issues

2012-05-22 Thread Emiliano Zapata
As a continuation to my original question, here is the massage that I get: Error in glm.fit(x = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, : cannot allocate memory block of size 2.1 Gb The model "glm.fit" is a logistic type (in the family of GLM) model. Maybe this is not enough informa

[R] utils:::menuInstallLocal()

2012-05-22 Thread Emiliano Zapata
Hello R, I'm trying to install a package (class) locally; in windows 7, 64 bits machine. The only massage I see on the R Console is: utils:::menuInstallLocal() nothing else. What does this means, shouldn't I got some source of massage on the Console. EZ [[alternative HTML version delete

[R] Could "incomplete final line found" be more serious than a warning?

2012-05-22 Thread Michael Bärtl
Dear all, I've been successfully reading Web of Science-data from tab-delimited text files into a data.frame using an R-script based on readLines(). With new data I just downloaded I suddenly get this warning: incomplete final line found I know this warning has already been discussed numero

Re: [R] LM with summation function

2012-05-22 Thread R. Michael Weylandt
Ahh sorry -- I didn't understand that x was supposed to be an index so I was using the row number an index for the summation -- yes, my proposal probably won't work without further assumptions[I.e., you could assume linear growth between observations, but that will bias something some direc

Re: [R] LM with summation function

2012-05-22 Thread Robbie Edwards
I don't think I can. For the sample data d <- data.frame(x=c(1, 4, 9, 12), s=c(109, 1200, 5325, 8216)) when x = 4, s = 1200. However, that s4 is sum of y1 + y2 + y3 + y4. Wouldn't I have to know the y for x = 2 and x = 3 to get the value of y for x = 4? In the previous message, I created two

Re: [R] LM with summation function

2012-05-22 Thread R. Michael Weylandt
But if I understand your problem correctly, you can get the y values from the s values. I'm relying on your statement that "s is sum of the current y and all previous y (s3 = y1 + y2 + y3)." E.g., y <- c(1, 4, 6, 9, 3, 7) s1 = 1 s2 = 4 + s1 = 5 s3 = 6 + s2 = 11 more generally s <- cumsum(y) Th

[R] how to remove the 'promise' attribute of an R object (.Random.seed)?

2012-05-22 Thread Yihui Xie
Hi, The problem arises when I lazyLoad() the .Random.seed from a previously saved database. To simplify the process of reproducing the problem, see the example below: ## this assignment may not really make sense, but illustrates the problem delayedAssign('.Random.seed', 1L) typeof(.Random.seed)

Re: [R] Syntax for lme function to model random factors and interactions

2012-05-22 Thread Joshua Wiley
See inline On Mon, May 21, 2012 at 11:17 AM, i_like_macs wrote: > Hello Joshua, > > Many thanks for your help, especially from a fellow Bruin (I went there as > an undergrad!). > > I understand that there is another forum for mixed models. If my problem > can't be solved within this thread, I'll

Re: [R] Graph to visualize paired t test

2012-05-22 Thread Richard M. Heiberger
tmp <- data.frame(A=sample(20,10), B=sample(20, 10)) with(tmp, t.test(A, B)) matplot(t(tmp), type="b") This does what you asked for. I don't understand the legend on your plot. For future queries, PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] Graph to visualize paired t test

2012-05-22 Thread R. Michael Weylandt
If I understand what you are looking for, this should get you started: https://www.stat.math.ethz.ch/pipermail/r-help/2012-May/312287.html Michael On Tue, May 22, 2012 at 11:14 AM, jhartsho wrote: > http://r.789695.n4.nabble.com/file/n4630909/pfaff_fig1.gif > > I have run the statistics and fou

Re: [R] RNORM matrix based on CSV file values for MEAN and SD

2012-05-22 Thread R. Michael Weylandt
No CSV came through so I'll just assume you get in a data.frame from read.csv() that looks something like this params <- data.frame(mean = c(1,4,7), sd = c(2,2,5)) and you want 10 samples from each. If you're on memory constraints, you can simply loop over rows and append to a growing CSV. for(i

Re: [R] LM with summation function

2012-05-22 Thread Robbie Edwards
Hi all, Thanks for the replies, but I realize I've done a bad job explaining my problem. To help, I've created some sample data to explain the problem. df <- data.frame(x=c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), y=c(109, 232, 363, 496, 625, 744, 847, 928, 981, 1000, 979, 912), s=c(109, 341, 704

Re: [R] Creating functions with a loop.

2012-05-22 Thread R. Michael Weylandt
Interpreting your question slightly differently, where ff.k(x) is a function call. Suppose you want to get a list of functions like x^2 x^2 -1 x^2 - 3 x^2 - 6 It's perfectly possible with something like this: NextFunc <- function(f, i) { # Takes in a function f and returns # a different f

[R] How to evaluate R things from Visual Studio?

2012-05-22 Thread Giannis Mamalikidis
Hello all, I’m new here and this is actually my very first post. My name is Giannis and I am an undergraduate student. I am programming in Microsoft’s Visual Studio 2010 (VB.NET mostly) and I want to create a program for the research group I am in. I merely want to evaluate actions and use s

[R] Graph to visualize paired t test

2012-05-22 Thread jhartsho
http://r.789695.n4.nabble.com/file/n4630909/pfaff_fig1.gif I have run the statistics and found no significance in my pairwise t test. I want to create a graph similar to the one I included showing similar slopes/lines for my data points. For my data a correlation graph is not appropriate and lo

[R] RNORM matrix based on CSV file values for MEAN and SD

2012-05-22 Thread dcoakley
This should (hopefully) be a pretty simple task. What I'd like to do is read in a csv file containing means and standard deviations for a large number of 'n' parameters (up to 2000). The list would be in the following format (see attached read.csv): Paramter(1), mean, standard dev., Paramter(2), m

[R] RE : Creating functions with a loop.

2012-05-22 Thread Etienne Larrivée-Hardy
I must say I'm new here and I don't quite know how things work so you will have to excuse me. The first part of my problem is that it would help me greatly to have a loop creating all the functions. Here is an example of how the 10th function would need to look like: ff10 <- function (q, alph

Re: [R] as.function parameters

2012-05-22 Thread R. Michael Weylandt
Jumping in from a finance perspective... You really don't want to actually use nested lists for this -- the overhead and index-book-keeping will quickly become quite annoying. Instead use a 2D array (I assume you're using the CRR Binomial Tree model for an American Option) where the column number

Re: [R] Creating functions with a loop.

2012-05-22 Thread David Winsemius
On May 22, 2012, at 10:06 AM, Etienne Larrivée-Hardy wrote: Hi I am trying to create n functions where each function is defined in function one step before, i.e. something like ff.k(x) = ff.j(x) - sum(1:j), for j=k-1 There is a cumsum function: > cumsum(1:10) [1] 1 3 6 10 15 21

Re: [R] Adding Text to a Plot

2012-05-22 Thread David Winsemius
On May 22, 2012, at 9:10 AM, Canto Casasola, Vicente David wrote: I'm pretty sure I'm missing something about this. Is there a smart way of typping hat(R)^2 and it's value from a linear regression? I've just found this tricky one: # Sample data x <- sample(1:100,10) y <- 2+3*x+rnorm(10) # R

Re: [R] getting a Likert plot from a data frame

2012-05-22 Thread Liviu Andronic
On Tue, May 22, 2012 at 4:00 PM, Richard M. Heiberger wrote: > out-of-phase problem > > Update to HH_2.3-15 that was published on CRAN yesterday. > Thanks! It works nicely now. Liviu > In HH_2.2-23 you needed to use a slightly longer name > plot.likert() instead of likert() > > On Tue, May 22,

Re: [R] “For” calculation is so slow

2012-05-22 Thread Zhou Fang
I'm not sure what you are trying to prove with that example - the loopless versions are massively faster, no? I don't disagree that loops are sometimes unavoidable, and I suppose sometimes loops can be faster when the non-loop version e.g. breaks your memory budget, or performs tons of needless co

Re: [R] “For” calculation is so slow

2012-05-22 Thread Jeff Newmiller
Thanks, I will take that factor of 100 anytime rather than keep some syntactic familiarity from other languages. Not to say I don't ever use loops, but I always try to vectorize the inner loop, if not the inner two loops. --

Re: [R] ReName

2012-05-22 Thread Petr PIKAL
Hi > > On May 22, 2012, at 4:08 AM, HAOLONG HOU wrote: > > > Dear list, > > > > The name of R-language is too short and is not friendly to search > > engines. Did you try it? Even with plain Google something R will usually lead to quite good hit. Try e.g. linear model R Regards Petr > > Do

  1   2   >