similar to: How to calculate the mean of all values in a list or dataframe

Displaying 20 results from an estimated 11000 matches similar to: "How to calculate the mean of all values in a list or dataframe"

2008 Feb 05
2
using image to show RGB image data ?
Hello all, I'm now using image() to show image data (in my case dumps of SOM weights) but would like to show RGB colour data, not just single "z" colour values. I've currently been using seq() to skip 4 values, so I can show the R, G or B channels separately as "z". But is there a way I can show all three channels simultaneously as a proper colour image? Thanks, B.
2007 Oct 22
3
How to format data for time-series analysis
Hello all, I'm using R to visualize and explore the data produced by a software system. The software generates logs for many types of events. The software runs for days on end, and can possibly generate multiple events per second. What is the appropriate time format for year, month, day, hour, minute, second, millisecond? that R can properly interpret (using zoo? or ITS?) I'll have
2008 Feb 21
2
jpeg() creating empty files with qplot() in a loop
Hello all, I'm stuck with a strange issue with writing jpegs of plots to a folder in a loop. This works: for (step in 1:length(steps)) { jpeg(filename=paste("frame_",sprintf("%05d",step),".jpg",sep="")) plot(steps[[step]]) dev.off() } But if I use qplot to generate the plot (which is my aim): for (step in 1:length(steps)) {
2007 Nov 05
2
its does not recognize POSIXct w/ both time and Date?
Hello all, I'm getting much further with my time-series work, but still getting into some problems. I'm using POSIXct time format with both date and time. I'd like to use that in an its object but It seems its only processes the date part of the POSIX time stamps: BMU_its_data <- its(data[BMUindex,2-4],dates=data[BMUindex,1]) Error in `row.names<-.data.frame`(`*tmp*`,
2005 Dec 05
1
unified meta-data handling ogg/theora/vorbis
Hey all, I'm working on a media-database art project that basically stores a bunch of sound and video files, which are then navigated based on meta-data. I'm not sure where to start asking these, questions, here seemed like a good start. So I was thinking I should use an open format, like ogg/vorbis/theora. I also thought, will all that coll meta-data stuff in ogg I should be able to
2008 Oct 15
2
Problems with R memory usage on Linux
Hello all, I'm working with a large data-set, and upgraded my RAM to 4GB to help with the mem use. I've got a 32bit kernel with 64GB memory support compiled in. gnome-system-monitor and free both show the full 4GB as being available. In R I was doing some processing and I got the following message (when collecting 100 307200*8 dataframes into a single data-frame (for plotting): Error:
2008 May 12
1
Converting qqplot2 qplot() to grammar?
Hello all, I've been using the following qplot command: qplot(pixX,pixY, data=som, geom="tile", fill=rgb) + scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY) Now I would like to convert it into the explicit ggplot grammar, so I can remove the extras: axes, labels, background, borders, facet labels, and extra white-space around the plot. (If anyone has
2007 Nov 02
1
R timeDate does not allow seconds?
Hello, Sorry if anyone gets this message twice, as my mailserver may not be working. Thanks for your response. Your idea makes a lot of sense to me, but I've been unable to get seconds to work. I ended up with this format finally: "2007-10-31_16:20:22" Problem is I am unable to get it recognized as a date using timeDate(): R>
2011 Dec 12
4
Boxplot of multiple vectors with different lengths
Hello, I'm attempting to write a code that automatically imports data from different files (with different lengths-just one variable) and makes tidy box plots for comparison. I can successfully import the data and create a list of the vectors I want to compare. But I cannot, for the life of me, figure out how to generate box plots using the "list" option. Suppose these are my data:
2009 Aug 13
2
need technique for speeding up R dataframe individual element insertion (no deletion though)
Hi fellas, I am working on a dataframe cam and it involves comparison within the 2 columns - t1 and t2 on about 20K rows and 14 columns. ### cap = cam; # this doesn't take long. ~1 secs. for( i in 1:length(cam$end_date)) { x1=strptime(cam$end_date[i], "%d/%m/%Y"); x2=strptime(cam$end_date[i+1], "%d/%m/%Y"); t1= cam$vol[i]; t2= cam$vol[i+1];
2009 Jul 23
3
Calculate weighted mean for each group
Hi R experts, I need know how calculate a weighted mean by group in a data frame. I have tried with aggragate() function: data.frame(x=c(15,12,3,10,10),g=c(1,1,1,2,2,3,3),w=c(2,3,1,5,5,2,5)) -> d aggregate(d$x,by=list(d$g),weighted.mean,w=d$w) Generating the following error: Error en FUN(X[[1L]], ...) : 'x' and 'w' must have the same length Thanks in advance [[alternative
2008 Jan 07
2
Efficient way to substract all entries in two vectors from each other
Hi all, I'm to inexperienced to come up with the matrix solution elusively appearing on the horizon for the following problem and would appreciate if you could give me a nudge ... I have two vectors a, and b and need to find the closest match for each value of a in b. How to do that efficiently? Thanks, Joh
2003 May 06
2
R vs SPSS output for princomp
Hi, I am using R to do a principal components analysis for a class which is generally using SPSS - so some of my question relates to SPSS output (and this might not be the right place). I have scoured the mailing list and the web but can't get a feel for this. It is annoying because they will be marking to the SPSS output. Basically I'm getting different values for the component
2005 Jun 26
2
chisq.test using amalgamation automatically (possible ?!?)
Dear List, If any of observed and/or expected data has less than 5 frequencies, then chisq.test (Pearson's Chi-squared Test for Count Data from package:stats) gives warning messages. For example, x<-c(10, 14, 10, 11, 11, 7, 8, 4, 1, 4, 4, 2, 1, 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1) y<-c(9.13112391745095, 13.1626482033341, 12.6623267638188, 11.0130706413029, 9.16415925139016,
2010 Feb 10
1
mean calculation within dataframe corrupted
Dear R-helpers, my little function below calculates the group score (tmpGroupMean) of an item, appends a "_mean" on its name and stores its value on this name. However, it does not calculate the mean of these scores (LVMean) in the same row correctly, as you can see in the below output which strangely also contains NAs. What is wrong?? Thanks for any hint!!! ###### ## start
2011 Apr 06
3
Calculated mean value based on another column bin from dataframe.
Dear list, I have a dataframe with two column as fellow. > head(dat) V1 V2 0.15624 0.94567 0.26039 0.66442 0.16629 0.97822 0.23474 0.72079 0.11037 0.83760 0.14969 0.91312 I want to get the column V2 mean value based on the bin of column of V1. I write the code as fellow. It works, but I think this is not the elegant way. Any suggestions?
2005 Sep 21
3
Multiple density plots on 1 graph
I want to overlay 50 denisty plots on a single plot. For each plot there are 10,000 data points and i want the empirical density of the data. I have not been able to find an easy way to achieve this (I have scoured the manula and website so sorry if I missed it!), does anyone have any suggestions? Thankyou.
2005 Nov 03
3
newbie graphics question: Two density plots in same frame ?
I swear I've scoured the help files and several texts before posting what feels like a dumb newbie question. How can I draw two kernel density plots in the same frame ? I have similar variables in two separate data frames, and I would like to show their two histograms/densities in a single picture. Same units, scale, range for both, so I'm simply trying to draw one and then add the
2006 Mar 17
4
cat(), Rgui, and support for carriage return \r...
Hi, and thanks in advance for your time. Background - I am working on a package and wish to have a routine's progress reported. The routine can take some time, and I would like to inform the user about the routine's progress. I have scoured the archives but to no avail, so would like to solicit input from this list. I am successfully using cat("\rBootstrap replication ", i,
2003 Aug 28
6
SIP and ECHO
Hello, I have read the information on echo and SIP in the FAQ and I have scoured the mailing list for possible solutions, but as yet I have not been able to get rid of this echo. I have a Sip phone, Digium 4 Port FXS, and 3 Digium FXO cards installed into an asterisk server. If I call between the Sip Phone (Budgettone-100) and the 4 FXS ports everything sounds great. If I call out to the PSTN