similar to: Creating and Using Objects in R

Displaying 20 results from an estimated 7000 matches similar to: "Creating and Using Objects in R"

2011 Feb 25
2
Visualizing Points on a Sphere
Dear All, I need to plot some points on the surface of a sphere, but I am not sure about how to proceed to achieve this in R (or if it is suitable for this at all). In any case, I am not looking for really fancy visualizations; for instance you can consider the images between formulae 5 and 6 at http://bit.ly/hOgK9h Any suggestion is appreciated. Cheers Lorenzo
2010 Jan 07
0
setting different environments
Hallo, I have a set of S4 and S3 classes together in one script. While running this script I create a lot of new functions and objects An example for S3 and S4 classes: ## S3 classes pt <- list(x=1,y=2) class(pt) <- "xypoint" xpos <- function(x, ...) UseMethod("xpos") xpos.xypoint <- function(x) x$x ypos <- function(x, ...) UseMethod("ypos")
2002 Oct 17
0
Polar plot, circular plot (angular data)
Dear R-users, Hereby a polar plot function for plotting angular data. I hope it will be usefull for some of you. I had a need to plot frequencies of wind-directions. The not-that-cheap SigmaPlot software did not allow me to change the orientation of the angular axis to clockwise orientation (what is used for meteorological observations). I even tried the latest version availible at the time
2012 Oct 05
2
Test for Random Points on a Sphere
Dear All, I implemented an algorithm for (uniform) random rotations. In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian coordinates. The result is supposed to be a set of random, uniformly distributed, points on a sphere (not the point of the algorithm, but a way to test it). This is what the points look like when I plot them, but other then eyeballing them, can anyone
2010 Sep 15
2
Using feather.plot to try and generate a stick plot of current velocity data (and having issues)
Hello All, I am attempting to use the feather.plot function from the plotrix package to graph current velocity data as I have speed and direction. I let "r" be the first 10 rows of current speed data and "theta" be the first 10 rows of directional data in radians. I had tried this with 10 measurements, but keep getting the following error message: >
2011 Nov 17
1
How to Fit Inflated Negative Binomial
Dear All, I am trying to fit some data both as a negative binomial and a zero inflated binomial. For the first case, I have no particular problems, see the small snippet below library(MASS) #a basic R library set.seed(123) #to have reproducible results x4 <- rnegbin(500, mu = 5, theta = 4) #Now fit and check that we get the right parameters fd <- fitdistr(x4, "Negative
2018 Oct 15
2
sys.call() inside replacement functions incorrectly returns *tmp*
Kia Ora > Although I'm not sure what problem it would solve... Given that you asked, I was interested in writing a multiple assignment function as a replacement function, so something like: massign (x, y, z) = construct.some list () Obviously, that's not possible. Probably the best example I can think of is converting cartesian coordinates to polar coordinates. Then we might have
2019 Jul 09
3
[R] Curl4, Quantmod, tseries and forecast
Hi Ralf, I tried the following > install.packages("RCurl") which went OK, but then same story when I tried to install tseries. > sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 10 (buster) Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0 LAPACK:
2013 Mar 24
3
Parallelizing GBM
Dear All, I am far from being a guru about parallel programming. Most of the time, I rely or randomForest for data mining large datasets. I would like to give a try also to the gradient boosted methods in GBM, but I have a need for parallelization. I normally rely on gbm.fit for speed reasons, and I usually call it this way gbm_model <- gbm.fit(trainRF,prices_train, offset = NULL, misc =
2013 Feb 09
3
Addressing Columns in a Data Frame
Dear All, Probably a one liner, but I am banging my head against the floor. Consider the following DF <- data.frame( x=1:10, y=10:1, z=rep(5,10), a=11:20 ) mn<-names(DF) but then I cannot retrieve a column by doing e.g, DF$mn[2] I tried to play with the quotes and so on, but so far with no avail. Any suggestion is welcome. Cheers Lorenzo
2012 Dec 30
3
Odds Ratio and Logistic Regression
Dear All, I am learning the ropes about logistic regression in R. I found some interesting examples http://bit.ly/Vq4GgX http://bit.ly/W9fUTg http://bit.ly/UfK73e but I am a bit lost. I have several questions. 1) For instance, what is the difference between glm.out = glm(response ~ poverty + gender, family=binomial(logit), data=mydata) and glm.out = glm(response ~ poverty * gender,
2009 Jul 20
3
Histograms on a log scale
Dear All, I would like to be able to plot histograms/densities on a semi-log or log-log scale. I found several suggestions online http://tolstoy.newcastle.edu.au/R/help/05/09/12044.html https://stat.ethz.ch/pipermail/r-help/2002-June/022295.html http://www.harding.edu/fmccown/R/#histograms Now, consider the code snippet taken from http://www.harding.edu/fmccown/R/#histograms # Get a random
2011 Dec 15
3
From Distance Matrix to 2D coordinates
Dear All, I am struggling with the following problem: I am given a NxN symmetric matrix P ( P[i,i]=0, i=1...N and P[i,j]>0 for i!=j) which stands for the relative distances of N points. I would like use it to get the coordinates of the N points in a 2D plane. Of course, the solution is not unique (given one solution, I can translate or rotate all the points by the same amount and generate
2007 Aug 08
2
Relocating Axis Label/Title --2
Apologies for the previous mail (I sent it off too early by mistake). This is the correct example: rm(list=ls()) D_mean<-seq(-5,5,length=100) y<-exp(-D_mean^2/5) pdf("my.pdf") plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black", ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))), xlab = expression(paste(D[agg],"
2012 Oct 26
2
Stata Database & R
Dear All, I am given some data to analyze. The data is in the form of a Stata database (.dta file). What is the best way to import it into an R dataframe? Is there any particular caveat I should be aware of? Many thanks Lorenzo
2013 Mar 25
2
Reassign Multiple Factors to same Factor Value
Dear All, Probably something very easy, but I am looking for the most efficient ways to achieve this. Consider the following snippet y<-c('a','b','c','d','e','f','g') x<-rnorm(length(y)) df<-data.frame(y,x) leading to > df$y [1] a b c d e f g Levels: a b c d e f g Now, I would like to replace levels
2003 Aug 15
0
Re: [R} stars graphs
I thought about that star graph again, and realized that it would be quite a handy thing for visualizing cyclic data like time or compass direction. Here is a cleaned up (and renamed) version to do a polar plot that starts at the right and goes counterclockwise or a 24 hour clock plot that starts at the top and goes clockwise. There are probably other varieties that would be interesting. Jim
2013 Jan 28
1
RandomForest and Missing Values
Dear All, I would like to use a randomForest algorithm on a dataset. The set is not particularly large/difficult to handle, but it has some missing values (both factors and numerical values). According to what I found https://stat.ethz.ch/pipermail/r-help/2005-September/078880.html https://stat.ethz.ch/pipermail/r-help/2007-January/123117.html the randomForest package has a problem with missing
2016 Apr 19
3
Problem with X11
Dear All, I have never had this problem before. I run debian testing on my box and I have recently update my R environment. Now, see what happens when I try the most trivial of all plots > plot(seq(22)) Error in (function (display = "", width, height, pointsize, gamma, bg, : X11 module cannot be loaded In addition: Warning message: In (function (display = "", width,
2010 Feb 26
3
Plotting a Trivial Matrix
Dear All, Consider a matrix (N x N) where each entry is either zero or one (can hardly get any simpler). Now, I would like to plot it as a 'chessboard' where every matrix entry is a black (1) or white (0) square. Whatever tool I use to plot it, it should not try to interpolate the data at all. I found some online references http://www.phaget4.org/R/image_matrix.html but probably I can