similar to: The L Word

Displaying 20 results from an estimated 6000 matches similar to: "The L Word"

2011 Apr 17
5
cube root
This is some interesting: > -8^(1/3) [1] -2 > x=(-8:8) > y=x^(1/3) > y [1] NaN NaN NaN NaN NaN NaN NaN NaN 0.000000 1.000000 [11] 1.259921 1.442250 1.587401 1.709976 1.817121 1.912931 2.000000 So, can anybody explain this?! (Why is x[1]^(1/3)=y[1]=NaN, but -8^(1/3)=-2?) Thx!!! [[alternative HTML version deleted]]
2011 Aug 24
3
Efficient way to Calculate the squared distances for a set of vectors to a fixed vector
I am pretty new to R. So this may be an easy question for most of you. ? I would like to calculate the squared distances of a large set (let's say 20000) of vectors (let's say dimension of 5) to a fixed vector. ? Say I have a data frame MY_VECTORS with 20000 rows and 5 columns, and one 5x1 vector y. I would like to efficiently calculate the squared distances?between each of the 20000
2011 Mar 14
2
*Building* a covariance matrix efficiently
deaRs, I want to build a covariance matrix out of the data from a binary file, that I can read in chunk by chunk, with each chunk containing a single observation vector X. I wonder how to do that most efficiently, avoiding the calculation of the full symmetric matrices XX'. The trivial non-optimal approach boils down to something like: Q <- matrix(rnorm(100000),ncol=200) M <-
2011 Feb 08
2
Plot colour according to column
Hi, I am trying to plot several columns in different graphs in columns and rows. The first column of my data file is the time, and the third is the 'elevation angle' with 19 different numbers. I would like to plot the rest of the columns with the x axis as time and the individual angles in different colours. Here is the code I am using right now. It plots the different columns with time,
2010 Jul 09
3
apply is slower than for loop?
I thought the "apply" functions are faster than for loops, but my most recent test shows that apply actually takes a significantly longer than a for loop. Am I missing something? It doesn't matter much if I do column wise calculations rather than row wise ## Example of how apply is SLOWER than for loop: #rm(list=ls()) ## DEFINE VARIABLES mu=0.05 ; sigma=0.20 ; dt=.25 ; T=50 ;
2011 Aug 29
3
replacing elements of a zoo object
Why doesn't this work? x = zoo(1:5, as.Date('2001-01-01')+1:5) x[as.Date('2001-01-05')] x[as.Date('2001-01-05')] = 0 x I think this is especially bad because it doesn't cause an error. It lets you do something to x, but then you can't see x again to see what it did. [[alternative HTML version deleted]]
2011 Sep 06
2
Possible to access a USB volume by name in windows
On the Mac it's pretty easy to get to a USB drive by name. For example the following command works if you have a USB drive named "MYUSB" setwd('/Volumes/MYUSB') Is there a way to do the same thing in Windows (without knowing the drive letter)? Thanks! [[alternative HTML version deleted]]
2011 Dec 06
2
read.table performance
** Disclaimer: I'm looking for general suggestions ** I'm sorry, but can't send out the file I'm using, so there is no reproducible example. I'm using read.table and it's taking over 30 seconds to read a tiny file. The strange thing is that it takes roughly the same amount of time if the file is 100 times larger. After re-reviewing the data Import / Export manual I think
2010 Apr 19
2
How to pass a list of parameters into a function
Does anyone know how to pass a list of parameters into a function? for example: somefun=function(x1,x2,x3,x4,x5,x6,x7,x8,x9){ ans=x1+x2+x3+x4+x5+x6+x7+x8+x9 return(ans) } somefun(1,2,3,4,5,6,7,8,9) # I would like this to work: temp=c(x3=3,x4=4,x5=5,x6=6,x7=7,x8=8,x9=9) somefun(x1=1,x2=2,temp) # OR I would like this to work: temp=list(x3=3,x4=4,x5=5,x6=6,x7=7,x8=8,x9=9)
2012 Mar 14
3
Creating 250 submatrices from a large single matrix with 2500 variables using loops
Dear all, I have a large matrix with about 2500 variables, and 100 rows. I would like to calculate the means of the every 10 variables starting from 1:2500 and saving the results as a vector or matrix. How can I do that? Alternatively, How can I create 250 subset matrices in the order of variables 1:2500 in groups of 10 from the single matrix which had initially 2500 variables ? I guess I have
2011 Dec 07
1
RSPython installation
Does anyone know if Is there a way to manually install RSPython? I get this error when I try to run the script from my DOS prompt. V:\>R CMD INSTALL -c C:/Users/gene.leynes/Downloads/RSPython_0.7-1.tar.gz * installing to library 'C:/Users/gene.leynes/Documents/R/win-library/2.13' * installing *source* package 'RSPython' ... **********************************************
2011 Sep 26
4
Testing for arguments in a function
I don't understand how this function can subset by i when i is missing.... ## My function: myfun = function(vec, i){ ret = vec[i] ret } ## My data: i = 10 vec = 1:100 ## Expected input and behavior: myfun(vec, i) ## Missing an argument, but error is not caught! ## How is subsetting even possible here??? myfun(vec) Is there a way to check for missing function arguments, *and*
2012 Feb 15
3
built a lower triangular matrix from dataframe
Hello! I'm trying to build a lower triangular matrix (with zeros in the diagonal) from a particular dataframe. The matrix I have to construct has 203 rows and 203 columns and that makes 20503 values to be included within (that's why I can't do it manually). To illustrate the dataframe I have, I'll give you an example of a dataframe and matrix with dimensions 6x6 (to make it
2011 Dec 07
2
curve fitted ... how to retreive data
Dear R users, I have now managed to fit the curve using the thin plate spline as follows: library(mgcv) b <- gam(y~s(x1,x2,k=100),data =dat) vis.gam(b) What I want now is to get the fitted data for y and copy it so that I use it for further analysis. Many thanks in advance mintewab
2011 Feb 13
4
A Math question
Dear all, I admit this is not anything to do R and even with Statistics perhaps. Strictly speaking this is a math related question. However I have some reasonable feeling that experts here would come up with some elegant suggestion to my question. Here my question is: What is sum of all Integers? I somewhere heard that it is Zero as positive and negative integers will just cancel each other out.
2009 Jul 22
3
How to replace NAs in a vector of factors?
# Just when I thought I had the basic stuff mastered.... # This has been quite perplexing, thanks for any help ## Here's the example: db1=data.frame( olditems=c('soup','','','','nuts'), prices=c(4.45, 3.25, 4.42, 2.25, 3.98)) db2=data.frame( newitems=c('stew','crackers','tofu','goatsmilk','peanuts'))
2012 Jul 31
1
Ubuntu installation
I just followed the instructions on CRAN<http://cran.r-project.org/bin/linux/ubuntu/README> to install R on an Ubuntu instance. sudo apt-get install r-base Why does it install an old version of R? Can I install version 15.1? I changed my sources.list to be a current cran mirror. I believe that I have entered the URL correctly because at first I had it wrong (there was a trailing
2011 Jan 13
1
PBSmodelling: Change the "edit" option of a widget
Is it possible to toggle the "edit" option of a widget? I would like to make it so that when a user clicks on a boolean (like "use constraints") it will lock or unlock the field in which they would enter the constraints. I can imagine redrawing the whole GUI using a function attached to the boolean, but that's clunky and slow. I tried changing the .PBSmod variable... but
2012 Aug 03
2
Recursive function calls
My apologies, I know that this is not a new problem, but I'm not sure how to find the answer I want to recursively loop over an object and trim trailing white space. When I use this function on a list of data.frame I get output like this: [1] "c(\" many spaces \", \" many spaces \")" "c(\" many spaces \", \" many spaces
2011 Jan 12
2
Require
I think that the "quietly" argument in "require" isn't working > require('JumboShrimp', quietly=TRUE) Warning in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called 'JumboShrimp' > By the way, the behavior is the same with options(warn=0) or options(warn=1) I'm using R 2.12