similar to: Need help for loop code, thanks

Displaying 20 results from an estimated 20000 matches similar to: "Need help for loop code, thanks"

2013 Feb 15
3
datos climáticos cambio de formato
Hola!! tengo un data.frame donde cada fila corresponde a un año y cada columna a un mes (De enero a diciembre) > head(valT) V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 1941 18.0 16.3 15.2 10.1 8.1 8.3 8.8 9.2 7.9 12.2 11.9 14.6 1942 17.2 15.9 13.6 11.6 8.7 6.2 6.4 7.2 9.7 12.0 14.1 16.7 1943 17.6 17.3 13.5 12.5 10.5 7.0 8.2 7.9 -999.9 -999.9
2009 Mar 22
3
data analysis. R
so i am having this question what should i do if the give data file (.txt) has 4 columns, but different lengths? how can i read them in R? any idea for the following problem? Gas consumption (1000 cubic feet) was measured before and after insulation was put into a house. We are interested in looking at the effect of insulation on gas consumption. The average outside temperature (degrees celcius)
2011 May 30
2
Basic question about three factor Anova
Read the data using scan(): # # a1 a2 a3 a4 # ------------- ------------- ------------- ------------- # b1 b2 b3 b1 b2 b3 b1 b2 b3 b1 b2 b3 # --- --- --- --- --- --- --- --- --- --- --- --- # # c1: # 4.1 4.6 3.7 4.9 5.2 4.7 5.0 6.1 5.5 3.9 4.4 3.7 # 4.3 4.9
2018 Aug 16
1
Thanks for help with validspamobject
Hi, Thanks for all your help. The problem with an error involving validspamobject() has been resolved, as a new version of spdep (0.7-7) was just released and it seems to have stopped using the deprecated function. Ron B. [[alternative HTML version deleted]]
2010 Sep 23
3
help in density estimation
Hi, guys, I'm using kernel "density" estimation. But how can I return to a density estimation for a fixed point? For example, b<-runif(1000,0,1) f<-density(b) How can I get the value of density(b) at b=0.5? Your help is extremely appreciated. Thanks. Jay -- View this message in context: http://r.789695.n4.nabble.com/help-in-density-estimation-tp2552264p2552264.html Sent
2007 Feb 22
2
Is there better alternative to this loop?
Dear List, Thanks to those who helped with my enquiry a few days ago. I have a another question on loops, in this case I am trying to print out the row of a data frame if the previous 3 values (daily values) in col5 are in descending order. I have this loop which works, but ask whether this can be done differently (without conventional loop) in R: flag="T" d= 3 # d represents
2011 Apr 13
1
Decimals in R/SQL
Hello, When I am writing in sqldf or RSQLite I lose the decimals in my matrix. The only way I can get decimals is by multiplying by 1.00000, etc. I have tried manipulating the options, but it is only effective once I multiply by 1.0000. I appreciate any suggestions! Thanks! Example: z <- sqldf ("select ST, SUM(AGEP*PWGTP)*1.000000000/SUM(PWGTP)*1.00000000000000 as wgtage from ss09
2007 Jul 28
1
Error when using the cat function
Is the following developed in my console output a recognized bug or am I using the cat function incorrectly? Thanks, Stan > ifelse(class(data[[n]])!="factor",{print("yes")},{print("no")}) [1] "yes" [1] "yes" > ifelse(class(data[[n]])!="factor",{cat("yes")},{cat("no")}) yesError in ans[test & !nas] <-
2011 Jan 27
3
how to divide each element of a matrix by a specific value per column
Hi, I'd like to divide each element of a matrix by a specific value per column. These specific values are stored in a list. For example: > x <- c(1,2,3,4,5) > y <- matrix(c(1:30), nrow = 6) Now I want to divide each element in y[,1] by x[1], y[,2] by x[2] etc. I have tried this > my_function <- function(data, ind) data/ind > apply(y, 2, my_function, x) [,1] [,2]
2009 May 25
3
long format - find age when another variable is first 'high'
Dear R, I've got a data frame with children examined multiple times and at various ages. I'm trying to find the first age at which another variable (LDL-Cholesterol) is >= 130 mg/dL; for some children, this may never happen. I can do this with transformBy and ddply, but with 10,000 different children, these functions take some time on my PCs - is there a faster way to do this in R?
2010 Jan 05
3
R matching lat/lon pairs from two datasets?
Hello, I am trying to match lat/lon from one dataset with the lat/lon from a second dataset and use that rows data for calculations. I am using match, but this is finding the first match and not comparing the pair, how can I determine if the lat/lon are the same? See example below. Is there a better way to determine to a matching pair of lat/lon values? Example Datasets: > data2
2012 May 09
2
Problem with SQLDF - Error in sqliteExecStatement(con, statement, bind.data) : RS-DBI driver: (error in statement: no such table:
Hi All, I am having trouble executing SQL statements on a few dataframes, but the funny thing is that I am able to execute the statement on some other dataframes. To test, I have 2 very small dataframes (6 rows and some columns). One is 'lessliq', the dput is given below. > dput(head(lessliq)) structure(list(V1 = c(50464677L, 50464846L, 50432581L, 50426614L, 50504329L, 50504735L), V2
2013 Jan 03
2
Sas by function in R
Hello, It's an alternative to use SAS by function in R? I want to plot d histograms by plot.from example bellow: Thank you! plot d 1 1 16.3 2 1 25.0 3 1 57.8 4 1 17.0 5 2 10.8 13 2 96.4 17 3 76.0 18 3 32.0 19 3 11.0 20 3 11.0 24 3 106.0 25 3 12.5 21 4 19.3 22 4 12.0 26 4 15.0 27 5 99.3 32 7 11.0 36
2012 Aug 28
1
don't print object attributes
Dear all Suppose the object below: > require(Hmisc) > require(plyr) > x <- dlply(iris, .(Species), describe) How can I print the object without displaying the attributes? I inspected ?print and ?print.default with no luck. > x $setosa x[, "Sepal.Length"] n missing unique Mean .05 .10 .25 .50 .75 50 0 15 5.006 4.40 4.59
2007 Sep 07
3
Delete query in sqldf?
Dear All, Is sqldf equipped with delete queries? I have tried delete queries but with no success. Thanks in advance, Paul
2009 Feb 20
2
importing data to SQLite database with sqldf
Hi all, I am attempting to learn SQL through sqldf... One task I am particularly interested in is merging separate (presumably large) files into a single table without loading these files into R as an intermediate step (by loading them into SQLite and merging them there). Taking a step back, I've considered these alternatives: 1) I know if I use straight SQLite commands I might use the
2010 May 20
1
sqldf: issues with natural joins
Hello, I'm having trouble discovering what's going wrong with my use of natural joins via sqldf. Following the instructions under 4i at http://code.google.com/p/sqldf/, which discusses creating indices to speed joins, I have been only unreliably able to get natural joins to work. For example, > Tid <- c('AES 01-01-02 10:58:00', 'AES 01-01-02 11:53:00', 'AES
2015 Jul 27
2
Error sql en función
Hola Carlos: Gracias por responder! Ayer caí en esta página al buscar el problema con google, pero no conseguir entender y implementar lo que sugiere. Sin entender nada, lo que hice fue: ======================== > library(MASS) > library (sqldf) # Per SQL > data(Aids2, package="MASS") > SQL_PROVA = function (XDADES, XWHE) + { + XDADES_SQL = sqldf ("select * from
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select statements on one or more R data frames. It is optimized for convenience making it useful for ad hoc queries against R data frames. Given an SQL select statement whose tables are the names of R data frames it: - sets up the database (by default it transparently sets up an in memory SQLite database using RSQLite; however, MySQL via RMySQL, can be
2007 Aug 01
1
New R package sqldf
sqldf is an R package for running SQL select statements on one or more R data frames. It is optimized for convenience making it useful for ad hoc queries against R data frames. Given an SQL select statement whose tables are the names of R data frames it: - sets up the database (by default it transparently sets up an in memory SQLite database using RSQLite; however, MySQL via RMySQL, can be