Displaying 20 results from an estimated 600 matches similar to: "apply function across two variables by mult factors"
2008 Jun 10
3
fitting periodic 'sine wave' model
I have been attempting to estimate the periodic contribution of an
effect to some data but have not been able to fit a sine wave within R.
It would be nice to start by being able to fit a sine wave with an
amplitude and frequency.
x<-seq(0,20,by=0.5)
y<-2*sin(2*pi*.5*x) #amplitude =2, frequency=0.5
# This failed to converge
r<-nls(y ~ A*sin(2*pi*F*x), start=list(A = 1, F = 1),
2009 Jun 12
2
Automate a data load and merge
Hi R list,
I would like to automate, or speed up the process from which I take
several separate datasets, stored in .csv formate, import and merge
them by a common variable. So far I have greatly sped up the loading
process but cannot think of a way to automate the merger of all
datasets into a common data.frame.
My apologies if this has been covered, any R search suggestions are
2008 Apr 11
1
polygons on scatterplot3d
Does anyone have any experience plotting complex polygons on a
scatterplot3d display? I would like to present some spatially binned
data in a 3-d type plot with background polygons (i.e.. a filled
coastline map). I can get the coastline onto the plot window as a
line type but cannot figure out how to fill the shape. I'm certain it
may be possible but might require a bit of digging
2008 Mar 15
1
Conditionals for Errors or error flags
Greetings,
I have been working on a script that conducts repeated statistics and
plots to my data. In this case it is sub-setting the dataframe by
month.
The intent is to develop a custom analysis and plotting that I can run
on a large number of data sets.
Unfortunately, a small portion of my subsets (~1%) cause an error with
one of the wrapped subroutines that results in the whole
2008 Nov 17
2
How to calculate the linear distance between 2 points
Deemed colleagues
I would appreciate your help with a sentence to calculate the linear
distance between 2 geographical points (coordinates in UTM).
In advance thnks for your attention,
--
Ricardo Bandin Llanos
rbandin@udec.cl
Estudiante - Magíster Cs. m. Pesquerías
Universidad de Concepción, Región del Bio-Bio, Chile
Celular: (0056-41) 97949957
[[alternative HTML version deleted]]
2007 Sep 27
1
crashing R through lattice
I have been crashing R while using lattice. My system consists of a Mac
Intel, R 2.5.1, lattice 0.15-5, and I plot through the default quartz.
R crashes after plotting several lattice functions. Has anyone else
encountered this problem and does anyone know the cause, or a solution?
Is this a lattice:mac, lattice:quartz, Lattice:me issue?
example...
This crashes my system after plotting.
2008 Dec 04
2
Plotting a kriging on a map
Hi list,
Well, this time I’ve a doubt with mapping generation.
I was already able to read and plot shapefiles, plot point on this map. All
this without any problems, but now I want to do something that I think, only
Golden Software Surfer is capable of.
I would like to plot a kriging result on the existing map (map script
below). Well I looked for on the net, but I was not able to be sure of
2009 Feb 10
1
lattice shingle with time and date format
Hi R-Users,
I have a time series of bivariate observations (x,y,t). I've
developed a few panel routines to explore certain aspects of the data,
and now would like to break the time series up into smaller chunks to
explore the temporal trends. I would like to know if anyone has any
experience breaking up time series with lattice.
Base graphics offers coplot, utilizing the
2008 Dec 07
1
custom panel help in lattice
Hi,
I am having an issue with a custom panel for lattice. The problem
comes when I try passing a groups argument.
Here is the custom panel, a wrapper for smooth spline. I copied
panel.loess and replaced the loess arguments with smooth.spline().
[Note: I would like to use the cross-validation fitting properties of
smooth.spline.]
library(lattice)
2008 Feb 08
1
putting mean and sd on a histogram
Hi,
I would like to put the mean and + / - the standard deviation as lines on
the x axis of a histogram. My attempts using the histogram function have
been unable to do this. My searches are unsucessful on this subject.
Any ideas are appreciated.
Thanks
stemp <- 5 6 5 5 5 5 6 5
m <-5.25
stanD <- 0.46291005
using windows xp
R 2.6
--------------------------------------------------
2007 Sep 07
1
tcl/tk help
I am running R 2.5 on a Mac platform and have a difficulty loading the
Tcl/Tk package.
Specifically:
R>library(tcltk)
Loading Tcl/Tk interface ... Error in fun(...) : couldn't connect to
display ":0"
Error : .onLoad failed in 'loadNamespace' for 'tcltk'
Error: package/namespace load failed for 'tcltk'
Is there an explanation to this problem? Thank you
2007 Oct 07
1
Old packages to updated R
I am 100% positive there is a better fix for this problem and it has been
discussed. Thank you in advance for bringing it to my attention.
When upgrading to newer versions of R the old packages are not brought
along in the process. I solved that problem by creating a list of the
packages in the old version of R, importing them to the new version via a
CSV, and re-installing into the newer R
2009 Mar 20
4
how to make aggregation in R ?
Hi,
I am trying to aggregate the sum of my test data.frame as follow:
testDF <- data.frame(v1 = c("a", "a", "a", "a", "a", "b", "b", "b", "b",
"b", "c", "c", "c", "c", "c", "d", "d", "d", "d",
2011 Mar 09
2
SQLDF - Submitting Queries with R Objects as Columns
Fellow R programmers,
I'd like to submit SQLDF statements with R objects as column names.
For example, I want to assign "X" to "var1" (var1<-"X") and then refer to
"var1" in the SQLDF statement. SQLDF needs to understand that when I
reference "var1", it should look for "X" in the dataframe.
This is necessary because my SQLDF
2008 Feb 26
1
wrapper for save function
Hello -
I would like to create a wrapper to the 'save' function in the base
package, but have a small problem with the name of the object that is
getting saved in the file. Below is a simple example illustrating my
problem.
## BEGIN SAMPLE R CODE
##################################################
## Here is the wrapper for the save function
2007 Nov 09
2
wrapper for coxph with a subset argument
Dear R-help -
Thanks to those who replied yesterday (Christos H. and Thomas L.)
regarding my question on coxph and model formula, the answers worked
perfectly.
My new question involves the following.
I want to run several coxph models (package survival) with the same
dataset, but different subsets of that dataset.
I have found a way to do this, described below in functions subwrap1 and
2011 Jan 01
3
Retrieving Factors with Levels Ordered
Hello (and Happy New Year),
When I create a factor with labels in the order I want, write the data as a text file, and then retrieve them, the factor levels are no longer in the proper order.
Here is what I do (I tried many variations):
# educ is a numeric vector with 1,001 observations.
# There is one NA
# Use educ to create a factor
feducord <- factor(educ, labels = c('Elem',
2009 Jun 22
1
Problem with storing a sequence of lmer() model fit into a list
Dear R-helpers:
May I ask a question related to storing a number of lmer model fit into a
list.
Basically, I have a for-loop (see towards the bottom of this email)
in the loop, I am very sure that the i-th model fit (i.e.,fit_i) is
successfully generated and the character string (i.e., tmp_i) is created
correctly.
The problem stems from the following line in the for-loop
#trouble making line
2007 Dec 19
1
Different labels by panel in barchart
Dear all,
I'm analysing a survey, and creating a barchart of the different responses
for each question. The questions are grouped according to a number of
categories, so I'm using lattice to create a plot with each question in a
category on it. The problem is that the response set for different
questions within the same category varies. I want to be able to draw only
the relevant
2009 Feb 20
2
Grouped bwplots?
Dear list,
I am sorry for asking you this, but I am trying to do again what I
thought I have done before, although this time it does not work.
So, given the data set:
> testdf <- data.frame(grfak=sample(c("One","Two"),size=100,replace=TRUE), panfak= sample(c("Yes","No"),size=100,replace=TRUE), xfak=