Displaying 15 results from an estimated 15 matches for "testfram".
Did you mean:
testframe
2012 Jun 10
3
Data.frames can not hold objects...What can be done in the following scenario?
...t data.frames can hold elements of type double, string
etc but NOT objects (such as a matrix etc). This is not convenient for
me in the following situation. I have a function that takes 2 inputs
and returns a vector:
testfun <- function (x,y) seq(x,y,1)
I have a data.frame defined as follows:
testframe<-data.frame(xvalues=c(2,3),yvalues=c(4,5))
I would like to apply testfun to every row of testframe and then
create a new column in the data.frame which holds the returned vectors
as objects. Why do I want this? Because the returned vectors are an
intermediate step towards further calculations....
2005 Mar 29
2
strange error with rw2010dev
...to have a look I can provide an RData file
with the problematic data frame.
Doesn't seem to be necessary, the following simulated example
generates the error:
> testmat <- matrix(1:80, 20,4)
> dim(testmat)
[1] 20 4
> str(testmat)
int [1:20, 1:4] 1 2 3 4 5 6 7 8 9 10 ...
> testframe <- data.frame(testmat=I(testmat),
x=rnorm(20), y=rnorm(20), z=sample(1:20))
> str(testframe)
`data.frame': 20 obs. of 4 variables:
$ testmat: int [1:20, 1:4] 1 2 3 4 5 6 7 8 9 10 ...
..- attr(*, "class")= chr "AsIs"
$ x : num 0.768 -0.462 0.450 0....
2011 May 23
1
Applying boxplot.stats to multiple value lists
Hello all R gurus,
I have a following problem which I hope someone will help me to solve.
I have a data.frame in form similar to below. > testframe<-data.frame("Name"=c("aa","aa","aa","aa","aa","bb","bb","bb","bb","bb"),"Value"=c(1,100,1,1,1,100,100,100,100,1))
Name Value
1 aa 1
2 aa 100
3 aa 1
4...
2012 Jun 09
1
Applying a function to a column of a data frame
Apologees the novice question. Currently climbing up the learning curve of R.
Suppose I have the following function and the data.frame:
testfun<-function(x=1,y=2) x+y
testframe=data.frame(col1=c(1,2),col2=c(3,4))
When evaluating testfun, I want to use the default value for y (which
is 2) and for x, I want to feed (one by one) the values in col2 of
testframe. How can I achieve this please? Not having much success with
apply()
Thanks for any help.
2001 Oct 05
1
nls() fit to a lorentzian - can I specify partials?
...all who helped me with my question about rescaling axes
on the fly. Using unlist() and range() to set the axis ranges in advance
worked well. I've since plotted about 300 datasets with relative ease.
Now I'm trying to fit a lossy oscillator resonance to (the square root of)
a lorentzian (testframe$y is oscillator amplitude, testframe$x is drive
frequency):
lorentz <- nls( y ~ a0 / (Q*sqrt((1-(x/f0)^2)^2 + ((x/f0) * 1/Q)^2)),
data = testframe,
start = list (a0=1.4, f0=84321.6, Q=600000))
and am running into lots of convergence trouble (singular derivatives,...
2003 Jul 18
2
create a vector looping over a frame
Hello,
I have a data.frame
> names(popA)
[1] "Year" "Series" "Age" "WM" "WF" "HM" "HF" "BM"
[9] "BF" "IM" "IF" "AM" "AF" "Yr"
how do i loop over a subset of variables in this frame to create a vector of
2008 May 11
2
instabilities in wxRuby 1.9.6
...rame")
viewMenu = Wx::Menu.new
viewMenu.append(Wx::ID_CLOSE, "Close\tCtrl-W", "Close this window")
evt_menu(Wx::ID_CLOSE) { show false }
menuBar = Wx::MenuBar.new
menuBar.append(viewMenu, "&View")
set_menu_bar menuBar
end
end
class TestFrame < Wx::Frame
def initialize
super(nil, -1, "Test Frame")
menu = Wx::Menu.new
menuItem = Wx::MenuItem.new(menu, -1, "Show child")
menu.append_item menuItem
evt_menu(menuItem) { ChildFrame.new(self).show }
menuBar = Wx::MenuBar.new
menuBar.append...
2008 May 20
0
[ wxruby-Bugs-20255 ] Instabilities on Linux - 1.9.7
...rame")
viewMenu = Wx::Menu.new
viewMenu.append(Wx::ID_CLOSE, "Close\tCtrl-W", "Close this window")
evt_menu(Wx::ID_CLOSE) { show false }
menuBar = Wx::MenuBar.new
menuBar.append(viewMenu, "&View")
set_menu_bar menuBar
end
end
class TestFrame < Wx::Frame
def initialize
super(nil, -1, "Test Frame")
menu = Wx::Menu.new
menuItem = Wx::MenuItem.new(menu, -1, "Show child")
menu.append_item menuItem
evt_menu(menuItem) { ChildFrame.new(self).show }
menuBar = Wx::MenuBar.new
menuBar.append...
2004 Aug 27
4
SWIG Bug
...9;initialize'' take a first argument, but
because ''initialize'' is static there isn''t a self value there, shifting
all arguments over one. One way to demonstrate this is with the
following sample:
require ''wx''
#begin sample
include Wx;
class TestFrame < Frame
def initialize()
super(nil,-1,"Test",Point.new(100,100),Size.new(100,100))
@win = Window.new(self,-1,Point.new(0,0),Size.new(100,100))
end
end
class TestApp < App
def on_init()
TestFrame.new().show(true)
end
end
TestApp.new().main...
2011 Jan 13
1
s3 methods on S4 objects
...file directory
listing
with a column named filename, size, time, etc.
And then I have methods for doing various things with this object.
I then tried to tackle the problem of coercing this S4 object to a
data.frame. Again just a learning exercise.
The goal would be able to make a call like this
testFrame <- as.data.frame(x)
where x, was an object of class "df"
If I try to define "as.data.frame" as a S4 method, then I can make it work,
but I then destroy the S3 functionality
of as.data.frame, so that if I were to try to coerce a matrix to a
data.frame it would work.
So,...
2004 Jun 02
13
wxGrid Question
When operating with a wxGrid is there a way to get a reference to the
TextCtrl field that is created when you start typing in a cell.
Also is there a way to get mouse events to work with a wxGrid, so far I
can''t get any of them to work. I had tried various combo''s of:
@grid.evt_left_down(){ |event|
puts "Left mouse is down"; }
using evt_left_down, evt_left_up,
2009 Sep 24
2
Running code after a modal dialog is shown
...ems to do nothing
at all, at least in my environment (Ruby 1.9.1 on Win32, wxruby 2.0.1.)
Here''s a very simple (non-modal) example, which fails to print ''Created!''
as I''d (perhaps naively) expect it to:
--------------------------
require "wx"
class TestFrame < Wx::Frame
def initialize(*args)
super(*args)
puts ''In Initialize!''
evt_window_create { puts ''Created!'' }
end
end
class TestApp < Wx::App
def on_init
TestFrame.new(nil, -1, ''Test!'').show()
end
end
TestApp.new.ma...
2004 May 24
9
Combo Box
...ethod is actually working, but only
in the
>example code that comes with wxRuby one-click install for Windows.
@combo.get_label seems to work for me.
See sample code below.
HTH,
Assaph
----- CODE -----
require ''wxruby''
include Wx
ID_DRIVES_BOX = 1
ID_BTN1 = 2
class TestFrame < Frame
def initialize
super(nil, -1, "Test App")
dlgSizer = BoxSizer.new(VERTICAL)
drives = `subst`.split("\n").collect {|d|
md = d.match(/(.:).* => .*\\(.*)/)
"#{md.captures[0]} (#{md.captures[1] })"
}...
2009 Sep 05
5
Filling Wx::ListCtrl with contents
Hi all,
I''ve got a question concerning ListCtrl_virtual of wxRuby since I see no
way filling the list with dynamic contents. I''m new to Ruby so I maybe
have to apologise for my request.
The problem is, that I have to define the on_get_item_text(item, col)
function. There I would like to use the item and col variables to read
data from a two-dimensional array. My very problem
2010 Dec 19
3
monthly median in a daily dataset
Hello,
I have a multi-year dataset (see below) with date, a data value and a flag
for the data value. I want to find the monthly median for each month in this
dataset and then plot it. If anyone has suggestions they would be greatly
apperciated. It should be noted that there are some dates with no values and
they should be removed.
Thanks
Emily
> print ( str(data$flow$daily) )