Displaying 20 results from an estimated 30000 matches similar to: "Any concept of 'by reference' or 'address of' in R?"
2009 Jul 02
4
Name of data.frame as a text string?
I've passed a data.frame as an input into a function which does some
plotting on a 4x4 matrix of certain parameters within in the
data.frame. I'd like to add a small header on top of each plot with
the name of the data.frame so that it's clear as I compare these 16
things where each on came from.
So far I haven't found the right way to get the name of the data.frame
as a string
2010 May 12
6
A primitive OO in R -- where next?
Greetings All,
Out of curiosity, I've just done a very primitive experiment:
Obj <- list(Fun=sum, Dat=c(1,2,3,4))
Obj$Fun(Obj$Dat)
# [1] 10
That sort of thing (much more sophisticated) must be documented
mind-blowingly somewhere. Where?
Where I stand right now: The above (and its immediately obvious
generalisations, like Obj$Fun<-cos) is all I know about it so far.
Ted.
2018 Jun 01
2
Time-series moving average question
You are right that there are no NAs in the practice data. But there are NAs in the moving average data.
To see this, break your work into two separate steps, like this:
tnr.ma <- ma(dat3[1:28], order=3)
TNR_moving_average <- forecast(tnr.ma, h=8)
I think you will find that the warning comes from the second step.
Print tnr.ma and you will see some NAs.
-Don
--
Don MacQueen
Lawrence
2005 Apr 28
4
wine-20050419 - where to set audio driver type?
Hi,
In a completely clean account that's never run Wine before I run
wine --version. Wine installs a new .wine directory but this Wine
directory has no config file. I looked in the 3 obvious files but none
of them seem to have an option for changing between OSS, Alsa and
JAck. where do I make this setting change now?
Thanks,
Mark
2013 Sep 09
1
windowing
Is there a package or a command that does window aggregation like
select
sum(col1) over
(partition by col2, col3 order by col4
rows between unbounded preceding and current row) as sum1
from table1 ;
the above is Netezza syntax, but Postgre has same capability.
Stephen B
[[alternative HTML version deleted]]
2009 Jul 29
1
Package with function for plots with embedded hyperlinks?
Some years ago, if I recall correctly, I learned of a package that
included a function that would write a plot to a file so that one
could associate hyperlinks with elements of the plot, such as points.
Then, when the plot was displayed in a browser, one could click on
(for example) a point, and jump to wherever the hypelink pointed.
I don't remember then name of the package or function,
2013 Oct 22
2
Where is element 30?
Hi I have a vector like that
readCsvFile$V1
[1] 30 31 32 33 34 35 36 37 38 39 310 311 312 313 314 315 316 317 318
[20] 319 320 321 20 21 22 23 24 25 26 27 28 29 210 211 212 213 214 215
[39] 216 217 218 219 220 221 222 223 40 41 42 43 44 45 46 47 48 49 410
[58] 411 412 413 414 415 416 417 418 419 420 421
and I am looking to find where the number 31 is located. So I
2018 Jun 01
0
Time-series moving average question
Hi Don, wow, you are so right. I picked that piece up from the bloggers tutorial and since I am R naive yet, I thought it was all one step
moving_average = forecast(ma(tdat[1:31], order=2), h=5)
Truly, I usually print and check at every step I can, as painful as it is sometimes.
Great lesson for this novice usR.
So the first and last values are NA in each case? Do you know why? Should I replace
2018 Jun 01
2
Time-series moving average question
My guess would be that if you inspect the output from
ma(dat3[1:28], order=3)
you will find some NAs in it. And then forecast() doesn't like NAs.
But I can't check, because I can't find the ma() and forecast() functions. I assume they come from some package you installed; it would be helpful to say which package.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000
2018 Jun 01
0
Time-series moving average question
Hello Don, thank you for your response. I appreciate your help.
I am using the forecast package, originally I found it following a forecasting example on bloggers.com
https://www.r-bloggers.com/time-series-analysis-using-r-forecast-package/
And subsequently located the complete pdf https://cran.r-project.org/web/packages/forecast/forecast.pdf
Since I created this practice data using the
2003 May 29
5
Comparison Operator
Does R have a comparison operator similar to the Like function, for example:
a<-"Is a Fish"
b<-"Fish"
if(b in a){c<-TRUE}
Michael R Howard
Micron Technology Inc. Boise ID.
Fab C Engineering Software (FCES)
Software Engineer
2018 Apr 30
3
How to visualise what code is processed within a for loop
Luca,
If speed is important, you might improve performance by making d0 into a true matrix, rather than a data frame (assuming d0 is indeed a data frame at this point). Although data frames may look like matrices, they aren?t, and they have some overhead that matrices don?t. I don?t think you would be able to use the [[nm]] syntax with a matrix, but [ , nm] should work, provided the matrix has
2014 Sep 08
2
Problem with order() and I()
I have found that order() fails in a rather arcane circumstance, as in
this example:
> foo <- I( c('x','\265g') )
> order(foo)
Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed
> foo <-c('x','\265g')
> order(foo)
[1] 1 2
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
2013 Mar 04
3
What package can I use to help me categorize comment responses?
Hi,
We have comment questions from a survey that we need to categorize. What package and functions can I use in R to help do this?
Daniel Lopez
Lawrence Livermore Labs
SHRM
[[alternative HTML version deleted]]
2017 Jun 14
3
about fitting a regression line
Hi R users,
I have some data points (Xi, Yi), and they may follow such a pattern Yi =
cCOS(Xi) + d, how to find the c and d in R? which function to use? Also,
how to get the R2 and p value for this correlation? Thanks for any kind of
help.
[[alternative HTML version deleted]]
2003 Oct 17
7
datetime data and plotting
If I take the following simple data:
YEAR MONTH DAY WEIGHT.KG
2003 10 6 1.2
2003 10 12 1.2
2003 10 16 1.3
and format the date data and plot it:
dates <- strptime(paste(DAY,MONTH,YEAR),"%d%m%Y")
plot(c(min(dates),max(dates)),c(0,max(WEIGHT.KG)),
xlab="Date",ylab="Weight (kg)",type="n")
lines(dates,WEIGHT.KG)
points(dates,WEIGHT.KG)
I find that the
2009 Jun 30
2
How do I change which R Graphics Device is active?
Hello,
If I execute
X11()
plot( stuff )
X11()
plot( other stuff)
then at this point I have two windows with plots and the second
graphics window is active. I don't see the devices using ls().
1) Without destroying the second window how do I make the first window
active again?
2) How do I destroy a specific window when I'm done with it?
3) Is there some generic way to understand what
2010 Jan 13
3
Ask for histogram
Hi,
I use a vector of data to draw the histogram, but it is different from the
graph by SAS. Can you check it for me please?
b is a column vector of 4332
hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1))
rug(b)
When I used rug, I find the records are smaller than 4332. I don't know
where I did wrong.
Thanks.
--
Yi Du
[[alternative HTML version deleted]]
2001 Oct 23
2
Possible bug, Rprof() and scan(pipe()) (PR#1140)
This looks like a bug?
Unable to use scan(pipe()) while profiling.
I have no idea whether this version of R violates the
"do not use `Rprof' in an executable built for profiling"
warning in ?Rprof.
Thanks
-Don
> version
_
platform powerpc-apple-darwin1.4
arch powerpc
os darwin1.4
system powerpc, darwin1.4
status Patched
major 1
minor 3.1
year
2017 Jul 06
1
Convert date to continuous variable in R
Thanks it worked for me. I wanted to plot days since planting on
x-axis 1 and years on x-axis 3.
LAI_simulation$Date <- as.Date( LAI_simulation$Date, '%Y/%m/%d')
LAI_simulation$Date <- as.integer(LAI_simulation$Date - as.Date("2009-10-07"))
plot(LAI~Date,data=LAI_simulation,xlab="Days since Oct, 7,