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
programming, because they are often used to delimit the end of strings, and
so allowing you to read it in directly can be used for various code
injection exploits.)

To read the new data files, you need some way of dealing with the file as a
raw stream, and stripping out all the nul characters before converting back
to character. Investigate ?readBin...

Zhou

--
View this message in context: 
http://r.789695.n4.nabble.com/Could-incomplete-final-line-found-be-more-serious-than-a-warning-tp4630932p4630944.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 computations. But I think
avoiding for loops whenever you can is a good rule of thumb in R coding.

--
View this message in context: 
http://r.789695.n4.nabble.com/For-calculation-is-so-slow-tp4630830p4630897.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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

2012-05-22 Thread Zhou Fang
For loops are really, really slow in R. In general, you want to avoid them
like the plague. If you absolutely must insist on using them in large,
computationally intense and complex code, consider implementing the relevant
parts in C, say, and calling that from R.

Staying within R, you can probably considerably speed up that code by
storing gx and gy as a multi-dimensional arrays. (e.g. for sample data,
something like

rawGy = sample( 1:240, 240^2* 241, replace = T)
rawGx = sample( 1:240, 240^2 *241, replace = T)
gx = array(rawGx, dim = c(length(s) - 1, 240,  max(rawGx)+1  ) )
gy = array(rawGy, dim = c(length(s) - 1, 240,  max(rawGy)+1 ) )

 ), in which case, you can easily do the computation without loops by

gxa = (gx[ ,a,1]+ 1)
gya =(gy[ ,a, 1] +1)
uv = gx[cbind(1:(length(s) - 1) , b, gxa)] / gx[cbind(1:(length(s) - 1) , a,
gxa)]  - gy[cbind(1:(length(s) - 1) ,b, gya)]/gy[cbind(1:(length(s) - 1) ,a,
gya)]

or similar, which will be enormously faster (on my computer, there's an over
30x speed up). With a bit of thought, I'm sure you can also figure out how
to let it vectorise in a, as well...

Zhou

--
View this message in context: 
http://r.789695.n4.nabble.com/For-calculation-is-so-slow-tp4630830p4630855.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Remove a number from a vector

2012-05-11 Thread Zhou Fang
Better yet, remove the which altogether, and it'll run a slight bit faster
and maybe look a little neater.
x <- x[x!="bobo"] 

--
View this message in context: 
http://r.789695.n4.nabble.com/Remove-a-number-from-a-vector-tp851865p4626413.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] registry vulnerabilities in R

2012-05-10 Thread Zhou Fang
What about using a Portable Apps style packaging of R? That might solve some
of the issues.

--
View this message in context: 
http://r.789695.n4.nabble.com/registry-vulnerabilities-in-R-tp4619217p4623388.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Seek() on windows - safe use cases?

2012-05-08 Thread Zhou Fang
So, I'm maintaining some else's code, which is as always, a fun thing. One
feature of this code is the use of the 'seek' command.

In ?seek:

  We have found so many errors in the Windows implementation of file
  positioning that users are advised to use it only at their own
  risk, and asked not to waste the R developers' time with bug
  reports on Windows' deficiencies.

So, yeah. I guess my question would be this: are there any 'safe' use cases
of seek? I assume that doing anything unusual with it would be pretty bad,
but in this case, the file input is absolutely predictable, and so seek
seems a lot more convenient than the alternatives. 

Would, in particular, using seek to skip the first N bytes of an
uncompressed text file file being read in be consistent and reliable? The
references to seek problems in the dev mailing list seem mostly limited to
compressed files, or reading and writing files at the same time.

Zhou

--
View this message in context: 
http://r.789695.n4.nabble.com/Seek-on-windows-safe-use-cases-tp4617858.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] What is the most cost effective hardware for R?

2012-05-08 Thread Zhou Fang
How many data points do you have?

--
View this message in context: 
http://r.789695.n4.nabble.com/What-is-the-most-cost-effective-hardware-for-R-tp4617155p4617187.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Binary operators in packages and documentation?

2009-11-25 Thread Zhou Fang
Hi,

I'm trying to make a package defining a new (S3?) class. Part of this
involves a custom version of a binary operator. e.g. "*.foo", so I can
do obj.foo * bar, or things like that.

Now, I think to makes this work with a NAMESPACE, I can do

S3method("*", foo)

in the NAMESPACE file, right? The question I was wondering was what
the appropriate way to document this operator is. i.e. What should I
put in the \usage section, etc?

'Writing R Extensions' doesn't seem to see much about this, but maybe
I'm missing something obvious.

Thanks,

Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Replace is leaking?

2009-05-27 Thread Zhou Fang

Oh hang on, I've figured it out.

Rounding error, doh. Somewhere along the line I got lazy and took the 
weighted average of two values that are equal. as.integer truncates, so, 
yeah. Never mind.


Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Replace is leaking?

2009-05-27 Thread Zhou Fang
Okay, someone explain this behaviour to me:

Browse[1]> replace(rep(0, 4000), temp1[12] , temp2[12])[3925]
[1] 0.4462404
Browse[1]> temp1[12]
[1] 3926
Browse[1]> temp2[12]
[1] 0.4462404
Browse[1]> replace(rep(0, 4000), 3926 , temp2[12])[3925]
[1] 0

For some reason, R seems to shift indices along when doing this replacement.

Has anyone encountered this bug before? It seems to crop up from time
to time, seemingly at random. Any idea for a fix? Reassigning the
variables seems to preserve the magicness of the numbers. It all seems
very bizarre and worrying.

If anyone is interested in a R workspace to reproduce this, email me.
This is running in R 2.9.

Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Scaled MPSE as a test for regressors?

2009-03-23 Thread Zhou Fang
Hi,

This is really more a stats question than a R one, but

Does anyone have any familiarity with using the mean prediction
squared error scaled by the variance of the response, as a 'scale
free' criterion for evaluating different regression algorithms.

E.g.

Generate X_train, Y_train, X_test, Y_test from true f. X_test/Y_test
are generated without noise, maybe?

Use X_train, Y_train and the algorithm to make \hat{f}

Look at var(Y_test - \hat{f}(X_test))/var(Y_test)

(Some of these var maybe should be replaced with mean squared values instead.)


It seems sort of reasonable to me. You get a number between zero and
one out of it, with 1 the solution for constant fits. Anyone seen
anything like this, or know anything about properties? Has it got a
name?

Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Bias correction for random forests?

2009-03-11 Thread Zhou Fang

Hi,

Way back in 2004, an update to randomForest added an option 'corr.bias'. 
The explanation was a bit vague, but it turns out it improves RF's 
predictive fit with my data substantially. But I am having trouble 
understanding it.


Does anyone know what this 'bias correction' actually does? Or what the 
justification for it is? Or when it would be necessary? Is there a paper 
I can look at?


And is the feature likely to emerge from 'experimental' any time soon?

Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fast ave for sorted data?

2009-02-15 Thread Zhou Fang
Thanks! That does exactly what I want. (Heck, maybe this should be
included as a default sorted alternative to ave.)

I was thinking of doing it another way using cumsums, but maybe this
method is faster.

Zhou

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fast ave for sorted data?

2009-02-15 Thread Zhou Fang

Hi,

This is probably really obvious, by I can't seem to find anything on it.

Is there a fast version of ave for when the data is already sorted in 
terms of the factor, or if the breaks are already known?


Basically, I have:
X = 0.1, 0.2, 0.32, 0.32, 0.4, 0.56, 0.56, 0.7...
Y = 223, 434, 343, 544, 231 etc
of the same, admittedly large length.

Now note that some of the values of X are repeated. What I want to do 
is, for those X that are repeated, take the corresponding values of Y 
and change them to the average for that particular X.


So, ave(Y,X) will work. But it's very slow, and certainly not suited to 
my problem, where Y changes and X stays the same and I need to 
repeatedly recalculate the averaging of Y. Ave also does not take take 
advantage of the sorting of the data.


So, is there an alternative? (Presumeably avoiding loops.)

Thanks,

Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Finding a basis in a set of vectors

2009-02-06 Thread Zhou Fang
Ah ha, that does work.

What do you mean it isn't robust, though? I mean, obviously linear
dependency structures in general are not stable under small
perturbations...?

Or is it that it's platform dependent?

Zhou

On Fri, Feb 6, 2009 at 2:28 PM, Peter Dalgaard  wrote:
> Zhou Fang wrote:
>> Hi,
>>
>> Okay, I have a n x p matrix X, which I know is not full rank. In
>> particular, there may be linear dependencies amongst the columns (but
>> not that many). What is a fast way of finding a linearly independent
>> subset of the columns of X that will span the column space of X, in R?
>> If it helps, I have the QR decomposition of the original X 'for free'.
>>
>> I know that it's possible to do this directly by looping over the
>> columns and adding them, but at the very least, a solution without
>> horrible slow loops would be nice.
>
> Have a look at stats:::Thin.col(), but beware that it isn't terribly robust.
>
>> Any ideas welcome.
>>
>> Zhou Fang
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> --
>   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
> ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907
>
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Finding a basis in a set of vectors

2009-02-06 Thread Zhou Fang
Hi,

Okay, I have a n x p matrix X, which I know is not full rank. In
particular, there may be linear dependencies amongst the columns (but
not that many). What is a fast way of finding a linearly independent
subset of the columns of X that will span the column space of X, in R?
If it helps, I have the QR decomposition of the original X 'for free'.

I know that it's possible to do this directly by looping over the
columns and adding them, but at the very least, a solution without
horrible slow loops would be nice.

Any ideas welcome.

Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] for/if loop

2009-01-28 Thread Zhou Fang

What are you trying to do with
> for (pp in 1:pp+1){
?

Also, note that 1:rr+1 and 1:(rr+1) mean different things.

Zhou

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to compare two regression line slopes

2009-01-27 Thread Zhou Fang

Hi,

Yes, the two methods are equivalent.

The p-value R calculates is based on the same t-statistic used in your 
manual analysis. You can see this by doing the second method:


y2 = rbind(df1, df2)
y2 = cbind(c(0,0,0,1,1,1), y2)
summary(lm(y2[,3] ~ y2[,1] + y2[,2] + y2[,2]*y2[,1]))

Look at the values you previously calculated and see where they reappear...
print(td)
print(db)
print(sd)

Looked at from the other way, the models with the D's and so on is one 
way to explain where the t-test comes from. Just do H0: b2=0 vs H1: 
b2!=0, and sprinkle some independence and normality assumptions.


It's probably preferable to use the automatic lm based method, because 
then you specify the model explicitly, while with the seemingly recipe 
based approach the actual models and hypotheses your are testing may not 
be clear. Plus you get nice diagnostic statistics and pretty graphs. The 
downside is that you might get lured into complacency...


Zhou Fang

PS: Your model equation isn't right. In both, we are also allowing the 
intercept to vary between groups. So really you want

y = c + D.b0 + b1.x + D.b2.x

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to compare two regression line slopes

2009-01-27 Thread Zhou Fang

Hi,

Yes, the two methods are equivalent.

The p-value R calculates is based on the same t-statistic used in your 
manual analysis. You can see this by doing the second method:


y2 = rbind(df1, df2)
y2 = cbind(c(0,0,0,1,1,1), y2)
summary(lm(y2[,3] ~ y2[,1] + y2[,2] + y2[,2]*y2[,1]))

Look at the values you previously calculated and see where they reappear...
print(td)
print(db)
print(sd)

Looked at from the other way, the models with the D's and so on is one 
way to explain where the t-test comes from. Just do H0: b2=0 vs H1: 
b2!=0, and sprinkle some independence and normality assumptions.


It's probably preferable to use the automatic lm based method, because 
then you specify the model explicitly, while with the seemingly recipe 
based approach the actual models and hypotheses your are testing may not 
be clear. Plus you get nice diagnostic statistics and pretty graphs. The 
downside is that you might get lured into complacency...


Zhou Fang

PS: Your model equation isn't right. In both, we are also allowing the 
intercept to vary between groups. So really you want

y = c + D.b0 + b1.x + D.b2.x

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Pausing processing into an interactive session

2009-01-26 Thread Zhou Fang
Hi all,

As a possibly silly request, is it possible to interactively pause a
R-calculation and do a browser(), say, without browser or other debug
handlers being explicitly included in the code?

Imagine the following situation:

You write up a big calculation for R to calculate. We are talking
hours here, or worse. A few hours into the calculation, you decide
that you want to check on how it's going. Unfortunately, you didn't
forsee the output you really want to check on. Oops.

What would seem ideal is something like this: as well as Ctrl-C, which
would terminate the current computation, we really want some key combo
perhaps that would pause the computation, perhaps at the next
'reasonable spot'. (Not Ctrl-Z either, as it doesn't let you look at
what's going on in the program). Then you can examine variables, for
example. Maybe even tweak them manually. And press the key to resume
the calculation.

Is this already possible somehow? Can it be made possible? Or would
there not be any point?

Thanks,

Zhou

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
Well, that isn't ideal for my purposes. (A little context - basically
I have a script that I'm running for a lot of simulations, which is
kinda buggy, and what I'm doing is I'm having the script periodically
save whatever it has done so far to an automatically named file. Then
if something odd happens in between two saves, I can run forward from
a previously saved point to find the problem and figure out why it
happened, and also I won't risk losing everything if something
catastrophic happens.)

Anyways, if anyone's interested, in .Rprofile

.First <- function(){
  if (rev(commandArgs())[2] == "ld"){
load(rev(commandArgs())[1], .GlobalEnv)
  }
}

Then e.g.

alias Rload='R --arg ld'

or make a bash script with

gnome-terminal --command "R --args ld $1"

and set some Open With options, and you'll be about to open R
workspaces from Nautilus etc by point and click.

Zhou


On Mon, Jan 12, 2009 at 3:14 PM, Gabor Grothendieck
 wrote:
> Another possibility is to have a separate directory
> for each project and place an .RData file in each.
> Now just cd to whatever directory corresponds to the
> project you wish to work on and start R normally.
> No code is needed.
>
> On Mon, Jan 12, 2009 at 10:04 AM, Zhou Fang  wrote:
>> Ok, looks like I can do what I want with --args, commandArgs() and an
>> appropiate .First.
>>
>> Thanks,
>>
>> Zhou
>>
>> On Mon, Jan 12, 2009 at 2:27 PM, David Winsemius  
>> wrote:
>>> See if this material is helpful:
>>>
>>> http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R-from-the-command-line
>>>
>>> -- David Winsemius
>>>
>>> On Jan 12, 2009, at 7:24 AM, Zhou Fang wrote:
>>>
>>>> That's not really what I meant by 'command line'. I meant, well,
>>>> loading from e.g. a bash shell, not from within an interactive R
>>>> session itself.
>>>>
>>>> Thanks anyways,
>>>>
>>>> Zhou
>>>>
>>>> (Possibly this email was sent twice. Apologies)
>>>>
>>>> On Mon, Jan 12, 2009 at 12:15 PM, Henrique Dallazuanna 
>>>> wrote:
>>>>>
>>>>> See ?load
>>>>>
>>>>> On Mon, Jan 12, 2009 at 10:12 AM, Zhou Fang  wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Is there any way to load workspaces (e.g. stuff from save.image) from
>>>>>> the command line? I'm on Linux, and would find this very helpful.
>>>>>>
>>>>>> I'm guessing this functionality can be duplicated with a skillful bash
>>>>>> script to rename the particular file to .RData (and then back once R
>>>>>> terminates), but I'm wondering if there's a better way.
>>>>>>
>>>>>> Zhou Fang
>>>>>>
>>>>>> __
>>>>>> R-help@r-project.org mailing list
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>> PLEASE do read the posting guide
>>>>>> http://www.R-project.org/posting-guide.html
>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Henrique Dallazuanna
>>>>> Curitiba-Paraná-Brasil
>>>>> 25° 25' 40" S 49° 16' 22" O
>>>>>
>>>>
>>>> __
>>>> R-help@r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
Ok, looks like I can do what I want with --args, commandArgs() and an
appropiate .First.

Thanks,

Zhou

On Mon, Jan 12, 2009 at 2:27 PM, David Winsemius  wrote:
> See if this material is helpful:
>
> http://cran.r-project.org/doc/manuals/R-intro.html#Invoking-R-from-the-command-line
>
> -- David Winsemius
>
> On Jan 12, 2009, at 7:24 AM, Zhou Fang wrote:
>
>> That's not really what I meant by 'command line'. I meant, well,
>> loading from e.g. a bash shell, not from within an interactive R
>> session itself.
>>
>> Thanks anyways,
>>
>> Zhou
>>
>> (Possibly this email was sent twice. Apologies)
>>
>> On Mon, Jan 12, 2009 at 12:15 PM, Henrique Dallazuanna 
>> wrote:
>>>
>>> See ?load
>>>
>>> On Mon, Jan 12, 2009 at 10:12 AM, Zhou Fang  wrote:
>>>>
>>>> Hi,
>>>>
>>>> Is there any way to load workspaces (e.g. stuff from save.image) from
>>>> the command line? I'm on Linux, and would find this very helpful.
>>>>
>>>> I'm guessing this functionality can be duplicated with a skillful bash
>>>> script to rename the particular file to .RData (and then back once R
>>>> terminates), but I'm wondering if there's a better way.
>>>>
>>>> Zhou Fang
>>>>
>>>> __
>>>> R-help@r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>>
>>> --
>>> Henrique Dallazuanna
>>> Curitiba-Paraná-Brasil
>>> 25° 25' 40" S 49° 16' 22" O
>>>
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
That's not really what I meant by 'command line'. I meant, well,
loading from e.g. a bash shell, not from within an interactive R
session itself.

Thanks anyways,

Zhou

(Possibly this email was sent twice. Apologies)

On Mon, Jan 12, 2009 at 12:15 PM, Henrique Dallazuanna  wrote:
> See ?load
>
> On Mon, Jan 12, 2009 at 10:12 AM, Zhou Fang  wrote:
>>
>> Hi,
>>
>> Is there any way to load workspaces (e.g. stuff from save.image) from
>> the command line? I'm on Linux, and would find this very helpful.
>>
>> I'm guessing this functionality can be duplicated with a skillful bash
>> script to rename the particular file to .RData (and then back once R
>> terminates), but I'm wondering if there's a better way.
>>
>> Zhou Fang
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Loading workspaces from the command line

2009-01-12 Thread Zhou Fang
Hi,

Is there any way to load workspaces (e.g. stuff from save.image) from
the command line? I'm on Linux, and would find this very helpful.

I'm guessing this functionality can be duplicated with a skillful bash
script to rename the particular file to .RData (and then back once R
terminates), but I'm wondering if there's a better way.

Zhou Fang

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Inserting blank lines into a file

2008-10-22 Thread Zhou Fang
Hi,

Should be a quickie:

I want to make a datafile in R for plotting in gnuplot (which has
friendlier 3D plotting options, as far as I can tell). So, I want to
create a file with contents along the lines of

#File begins
0 0 10
0 13 10
0.2 2 10

1 0 10.12
1 1 5
1 2 10

2 0 10
2 1 1
2 2 10

It's probably fairly easy to write the space-separated numbers with
write.table, sink, or similar. But what I haven't figured out is how
to get the blank lines between data blocks that I need.

Does anyone know?

Zhou

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.