search for: mytabl

Displaying 20 results from an estimated 121 matches for "mytabl".

Did you mean: mytable
2015 Oct 22
2
C_LogLin (stats/loglin)
...d (line by) line but in the implemented ?loglin? function? 3. Is it possible to isolate the ?C_LogLin? function so I can use it in other scripts or programming languages e.g. Matlab? Thank you in advance for your help, Kai -------------------------------------------- #Sample # Example data mytable = array(0,dim=c(3,4,5)) mytable[1,,1] = c(35,26,36,29); mytable[2,,1] = c(21,12,26,27); mytable[3,,1] = c(9,26,23,38); mytable[1,,2] = c(43,26,89,26); mytable[2,,2] = c(78,42,32,9); mytable[3,,2] = c(34,39,42,51); mytable[1,,3] = c(51,72,62,21); mytable[2,,3] = c(6,52,71,32); mytable[3,,3] =...
2013 Mar 14
1
error: object of type 'closure' is not subsettable
Hi all, when i run this script: >read.table("Angelika.txt",header=T,sep="\t") >mytable=read.table("Angelika.txt",header=T,sep="\t") >for ( dye in c("A","B","C","F","G","K","L","M")) + { + for (cond in 1:8) + { + measurement = table[mytable[,"bed&quo...
2012 Feb 26
6
loop for a large database
Yes, I am a newbie. I have a data.frame (MyTable) of 1445846 rows and 15 columns with character data. And a character vector (MyVector) of 473491 elements. I want simply to get a data.frame with the count of how many times each element of MyVector appears in MyTable. I've tried a loop with : for (i in 1 : length (myvector)) sum (MyTab...
2010 Jul 26
4
using string variable as order() function argument
...uld like to use a loop, which sorts the dataframe according to different columns, pointed by the string variable. id col1 col2 col3 1 10 0 4 8 2 11 1 2 2 3 12 0 8 3 4 13 0 5 5 Usually the order() function can be used like this: sorted = mytable**[order(column3) , ] which results in properly sorted table: ** id col1 col2 col3 2 11 1 2 2 3 12 0 8 3 4 13 0 5 5 1 10 0 4 8 **But when trying to use a string variable instead of "column3" name: columnname = "column3&qu...
2001 Apr 06
0
Subscript out of bounds- (my) problem with expansion of expression?
Hi, I have this problem (R 1.2.2 on Pentium, OS WinNT4 SP6) : mytable is a 3D (n*p*2) table of non-negative "integers". There is a need to do n times chisq.test (rbind(mytable[i,,1], mytable[i,,2])) #on p*2 tables Columns with zero value in the first row should be omitted, for example chisq.test (rbind(mytable[i,-c(3,4,6),1], mytable[i,-c(3,4,6),2]))...
2015 Oct 22
0
C_LogLin (stats/loglin)
...? function? > 3. Is it possible to isolate the ?C_LogLin? function so I can use it in > other scripts or programming languages e.g. Matlab? > > Thank you in advance for your help, > Kai > > -------------------------------------------- > #Sample > > # Example data > mytable = array(0,dim=c(3,4,5)) > mytable[1,,1] = c(35,26,36,29); mytable[2,,1] = c(21,12,26,27); > mytable[3,,1] = c(9,26,23,38); > mytable[1,,2] = c(43,26,89,26); mytable[2,,2] = c(78,42,32,9); > mytable[3,,2] = c(34,39,42,51); > mytable[1,,3] = c(51,72,62,21); mytable[2,,3] = c(6,52,71,3...
2009 Oct 16
1
Frequencies, proportions & cumulative proportions
...Below is the table I need. Is there a function that already does it? Thanks, Bob > # Generate some test scores > myValues <- c(70:95) > Score <- ( sample( myValues, size=1000, replace=TRUE) ) > head(Score) [1] 77 71 81 88 83 93 > > # Get frequencies & proportions > myTable <- data.frame( table(Score) ) > myTable$Prop <- prop.table( myTable$Freq ) > myTable$CumProp <- cumsum( myTable$Prop ) > > # Print result > myTable Score Freq Prop CumProp 1 70 44 0.044 0.044 2 71 42 0.042 0.086 3 72 40 0.040 0.126 4 73 4...
2006 Mar 06
4
Contingency table and zeros
...ssume I have a vector of integers : > myvector <- c(1, 2, 3, 2, 1, 3, 5) My purpose is to obtain the cumulative distribution of these numerical data, i.e. something like : value nb_occur. <=1 2 <=2 4 <=3 6 <=4 6 <=5 7 For this, I create a table with ; > mytable <- table(myvector) 1 2 3 5 2 2 2 1 However, table() returns an array of integers, mytable[4] returns the occurence number of the "5" item, which makes this table hard to index. I would prefer to have a data structure where mytable[4] could return 0, as there is no "4" in...
2007 May 12
4
Multiply and format with thousands separator
...tabase, multiply them together and display them in a list with a comma for the thousands separator. This would be very easy to do in a spreadsheet, so I assumed it would be easy to do in Ruby on Rails but I can''t work out how. I have a list.rhtml with a code snipet like <td><%=h mytable.send(:value1)*mytable.send(:value2) %></td> which does the multiply, but how do I do the formating? I found this link to some Ruby code that might do this, but where would I put it and how would I use it? http://wiki.rubygarden.org/Ruby/page/show/NumericFormat Thanks Alan -- Posted...
2007 Apr 20
2
Caching of database values
If do something like this: dbObj = MyTable.find_by_id(5) a = dbObj.name b = dbObj.name How many times will an SQL call be made to get the value of MyTable.name for id 5? In other words, are the values for dbObj cached in the object? Is there a way of controlling that? (I can imagine that sometimes you might not want to cache th...
2009 Nov 22
3
Define return values of a function
I have created a function to do something: i <- factor(sample(c("A", "B", "C", NA), 793, rep=T, prob=c(8, 7, 5, 1))) k <- factor(sample(c("X", "Y", "Z", NA), 793, rep=T, prob=c(12, 7, 9, 1))) mytable <- function(x){ xtb <- x btx <- x # do more with x, not relevant here cat("The table has been created, see here:\n") print(xtb) list(table=xtb, elbat=btx) } tbl <- table(i, k) mytable(tbl) # (1) z <- mytable(tbl) # (2) str(z) # (3) (1) Wanted: outputs th...
2006 Nov 08
0
Fw: data frames re-ordering and naming columns
...2 240 > I have two questions: > 1. what is the purpose of the numbers on the LHS, and how > can I reorder them so that they read in ascending order? They are row names. They seem to be in ascending order to me. See ?order for sorting. Row names can be set, for example by: row.names(myTable) <- 1:nrow(myTable) > 2. how can I extract the line "freq size" and make it the > column names? If your original had the headings on the first line this could have been easily effected by the header=TRUE argument to read.table(). Now, you could try: names(myTable) <- my...
2009 Jun 04
0
ROracle: cannot insert several columns
...sion. my.df<-data.frame(prd_id=c(123,456),vol_factor=c(.123,.456)) > my.df prd_id vol_factor 1 123 0.123 2 456 0.456 > library(ROracle) Loading required package: DBI > conn<-dbConnect("Oracle","***/***@***") > dbGetQuery(conn,"create table mytable (prd_id number, vol_factor number)") > dbGetQuery(conn,"insert into mytable (prd_id,vol_factor) values(123,.123)") > dbGetQuery(conn,"insert into mytable (prd_id,vol_factor) values(456,.456)") > dbGetQuery(conn,"select * from mytable") PRD_ID VOL_FACTO...
2012 Mar 06
1
frequency count by row
...dog animal 0 0 3 girl boy 0 0 0 4 knife fork spoon 0 0 and I want to count how many values different from 0 are in each row, and get the output count in a vector that is as long as length(MyTable). For the above example it would be c (4,3,2,3). I've tried sum (MyTable != "0") but it gives the total amount of values different from 0 in all the data.frame. And sum(MyTable [1,] != "0") obviously gives only the first row, even if I repeat it throughout all length(MyTa...
2005 Oct 31
2
nlme error message
...: NA/NaN/Inf in foreign function call (arg 1)". If I change the correlation structure to corAR1, then no error. I have no clue how to solve this problem. I would highly appreciate any help. Thanks in advance and looking forward to any help. JY I attached my data and codes here: # data: mytable mytrait myloc RIL A1 0.590950330 0 1 A2 -0.315469846 -1 2 A3 -0.265690115 0 3 A4 0.342885046 0 4 A5 0.007613402 1 5 A6 0.285997884 0 6 A7 0.333841975 0 7 A8 -0.599817735 -1 8 A9 0.242621036 0 9 A10 0.518959588 1 10 cs<-corCompSymm(0.5, form=~1|RIL, fixed=T) model<-lme(mytrait~mylo...
2006 May 25
5
CSS Effects? (javascript?)
Is there a way to assign a CSS style to an element I am not currently interacting with? For instance, if I have two TD elements of a table. I click on one of them, and I want to have a style change in the other element. Is this possible? I''m guessing script.aculo.us might be able to help me.... but considering how nothing on their site is loading for me right now I have no way of
2007 May 06
1
simple table ordering question
Hi all, I'm sure this is simple but I don't get it. I have a table mytable<-c(rep("Disagree",37),rep("Agree",64)) table(mytable) this gives me Agree Disagree 64 37 but I didn't ask for it to be in alphabetic order. How can I get it in original order? Disagree Agree 37 64 Thanks, Jeff Jeffrey. M. Miller,...
2008 Oct 14
2
Getting frustrated with RMySQL
...to find is how to deal with parameterized queries or how to do a simple insert (but not of a value known at the time the script is written - I ultimately want to put my script into a scheduled task, so the analysis can be repeated on updated data either daily or weekly). Using "INSERT INTO myTable (a) VALUES (1)" is simple enough, but what if I want to insert a sample number (using, e.g. WEEK(sample_date) as a sample identifier) along with the rate parameter estimated using fitdistr to fit an exponential distribution to a dataset, along with its sd? If I were using Perl or Java, I'...
2009 Apr 07
2
newbie query: simple crosstabs
...ng around with various table tools, trying to construct a fairly simple cross-tab. It shouldn't be hard, but for some reason it turning out to be (for me). If I want to see how many men and how many women agree with a agree/disagree question (coded 1,0), I can do this: >attach(mydata) >mytable <- table(male, q1.bin) # gender and a binary response variable >prop.table(mytable, 1) # row percentages q1.bin male 0 1 0 0.3988 0.6012 1 0.2879 0.7121 I can repeat that for each of the items I want gender breakdowns for (q2, q3, q4 ....). But what I really want is a...
2006 Apr 10
1
Add Column After Column in Migrations
Adding a column to a table just places the column at the end, but I like to keep related columns together. Is there a way to specify where the column is added in a table with migrations? For example, in MySQL you can do: ALTER TABLE my_table ADD COLUMN new_column INT AFTER other_column I was hoping migrations would support something like this: add_column :my_table, :new_column, :integer,