Displaying 20 results from an estimated 1000 matches similar to: "Problems plotting a function defined as a product"
2006 Jun 15
1
Compact sums in functions definitions
I'm trying to make more compact the definition
of a function as for example:
f <- function(x) 2/x+3/x
by simply defining the array of coefficients
arr = c(2,3)
and setting:
g <- function(x) sum((arr/x))
Everything seems to work fine because the values returned
by f and g result coincident for different values of their
argument, but when I try to plot the function g using:
x =
2006 Aug 03
1
levels of an array (strings and numbers)
Reading a csv file (db.csv) as:
yes,full
no,full
no,empty
I can use the command 'levels' to extract
the different values appearing for each
column as follows:
> d<-read.csv("db.csv")
> levels(d[,2])
which returns
> [1] "empty" "full"
while, doing the same with a numerical csv file as:
1,6
0,6
0,7
the same instruction returns an empty
2011 Jun 20
1
Can I disable Cairo?
On Linux 2.13 by default links cairo, so png() uses it for rendering.
One of my users has performance problem, so ask if it possible to
temporary disable cairo during png() rendering so it reverts to grGraphics.
My workaround for now is to configure R without cairo, but this affects
all users that are forced to load and use CairoDevice if they wants
better quality.
I want to avoid this, is it
2009 May 28
1
How could I terminate a script (without leaving R)?
Good morning!
Which is the preferred method to leave a sourced script and returning back to the '>' prompt?
For example I search for certain files to be processed, but nothing should be done if they
are not present. Normally I do in my script:
f<-dir(pattern="qq")
if(length(f) > 0) {
...process file list...
}
# script end
But I don't like those {} encompassing
2010 Jan 18
1
density() vs. KernSmooth::bkde
Any advice when to use denstity() and when the KernSmooth package bkde()
to smooth a histogram?
No specific problem to use either one, but I'm curious why there are two
so similar implementations.
Thanks!
mario
--
Ing. Mario Valle
Data Analysis and Visualization Group |
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60
v.
2011 Jan 14
0
Fwd: Re: [R-sig-hpc] Working doSNOW foreach openMPI example
Whas missing the R in the command line:
"mpirun -n --hostfile /home/hostfile R --no-save -f rtest.R"
Hope this helps
mario
On 13-Jan-11 22:08, Justin Moriarty wrote:
> Hi,
> Just wanted to share a working example of doSNOW and foreach for an openMPI cluster. The function eddcmp() is just an example and returns some inocuous warnings. The
2003 May 07
1
levels
Hello,
Thanks to all for the previus answer. I want to be more detailed:
I have a dataset called gm20011231 with 1304 observations (or records).
I want to create a subset with the followin command
j2<-gm20011231[1:10,"V4"]
the levels of "V4" is 1304 and the and the length(j2) is 10.
Do you know how to obtain a j2 with level 10?
Thank you
Fabrizio
2009 Jun 12
1
FBI Homicide data?
Dear all,
do you know if it's available and where the "FBI Homicide" dataset?
It has at least the following columns: "victim age", "homicide age".
A scatterplot of this data is visible here:
http://www.uml.edu/gallery/main.php?g2_itemId=6016
Thanks for your help!
mario
--
Ing. Mario Valle
Data Analysis and Visualization Group |
2009 Jul 21
1
Subsample points for mclust
Hi all!
I have an ordered vector of values. The distribution of these values can
be modeled by a sum of Gaussians.
So I'm using the package 'mclust' to get the Gaussians's parameters for
this 1D distribution. It works very well, but, for input sizes above
100.000 values it starts taking really forever. Unfortunately my dataset
has around 4.6M values...
My question: is it
2009 Sep 22
0
snowfall: missing MPI node
Hello,
I don't know if the question pertains to Rmpi, snow or snowfall.
I run my job by:
mpirun -np N -hostfile $PBS_NODEFILE RMPISNOW -f my-script.r --slave
In the snowfall sfInit call I have to specify one less CPU respect to
the mpirun call
sfInit(parallel=TRUE, cpus=N-1, type="MPI")
otherwise I receive an error similar to: "cluster size N-1 already
2009 Sep 22
0
snowfall: sfExport apparently harmless error
I'm running my script using mpirun -mp 4 and using snowfall+Rmpi on
Linux 64bits. I receive the following error, but apparently without
consequences on the results.
Any idea?
I'm able to reproduce it with a minimal script (below). Seems the
critical issue is the for loop. Without it no error.
Thanks for your help!
TERM: Undefined variable.
TERM: Undefined variable.
TERM: Undefined
2009 Sep 22
0
(correction) snowfall+Rmpi: sfExport error
Sorry for wasting your time with an incorrect diagnosis in my previous mail!
I'm running my script using mpirun -mp 4 and using snowfall+Rmpi on
Linux 64bits. I receive the following error, that terminates the run.
Any idea?
I'm able to reproduce the problem with a minimal script (below).
If n < 16371 it completes 9 iterations without problems. Already at
16371 it dies at iteration 7
2010 Apr 21
1
Unexpected warning from matplot
n <- 63
a <- 1:n
x <- a-1
y <- outer(x,a)
matplot(x,y,type='l')
Warning message:
In matplot(x, y, type = "l") :
default 'pch' is smaller than number of columns and hence recycled
Why is it complaining if I specifically ask for type="l", so no pch
involved?
Annoyance or feature?
The fix (if needed) is simple. In the matplot code change:
if
2011 Apr 18
1
Location of libraries in Windows
I'm preparing to install 2.13, so I need a clarification about package
location on disk.
On window the packages I have installed are under
C:\Users\mvalle\R\win-library\2.12
and the ones that come with R are under "C:\Program Files\R\library"
If I execute update.packages() from the R gui, it fails because it finds
e.g. Matrix as a package that should be updated
but the process
2003 May 06
2
Sum by categorical variable
Dear R-list,
I have two variables (numerical and categorical) and would like to have the
sum (and maybe some other statistics) of the numerical variable by the
categorical one.
Can you help me,
Thank you,
Fabrizio
---------------------------------------------------------------
Fabrizio De Amicis
IT Department
Generali Information Technologies - (GIT)
Centro Galleria 2,
Via Cantonale
CH -
2011 Mar 30
1
How to put line linking two plots
Hello!
Suppose I have three charts like below. The top chart is a general
overview and the bottom charts are related so some point of this chart.
To make clear this relationship I want to draw a line between (4,0.9) in
the top chart and (10,1) in the bottom-left one.
Currently I add it manually using Inkscape on the resulting pdf file.
Is it possible to add it inside R? Should I switch to other
2003 Apr 29
2
easy question
Dear R.List,
I am starting to use R. I have an easy question. In a dataset of 15
variables, I am not able run correctly the index i of the do loop.
Do you have any suggestion?
NC <- function(x)
for (i in 1:15) {
print(dim(table(dt[,"Vi"])))
}
Thank you in advance,
Fabrizio
---------------------------------------------------------------
Fabrizio De Amicis
IT
2010 Jul 14
1
FYI: matrix surprise
Some time ago someone asked for things that make R difficult to
master. Here I want to record one R behavior that took me off-guard
yesterday. Moral of the story: vectorialize, but don't exaggerate.
Hope it helps
mario
### A very simple data frame
tc <- textConnection(
"prefix idx val
A 1 11
A 2 22
B 1 33
B 2 44")
s <- read.table(tc,
2003 May 06
3
FW: Sum by categorical variable
Another easy(/stupid) question:
with the following command
j2<-xf1[1:10,"V4"]
I have
> j2
[1] CHROMOLI LINEAGERMAI RINALDI GIUNTIMA
AUTOSTELLA
[6] CAIZZONE CENTRO B PEL E C SNC CONSORZI MAN NORD
PDM
1304 Levels: MACHIAVELLI Snc MENARINI MANUFACTURERS LOGISTICS SERVICES
... ZUCCHERIFICIO
2012 Mar 09
6
unir 2 dataframe con con igual caso pero distinto valor en igual variable
Estimados usarios de R:
Tengo una base de datos madre en formato .sav de SPSS y la quiero
modificar usando datos de otras base de datos .sav y otra en .csv a
las que llamare hijos.
No tengo problema en convertirlas en data.frame.
Todos los archivos tienen en comĂșn una variable que es Ășnica.
En aquellos casos que les falta un valor a una variable en el archivo
madre lo relleno con el valor del