[R] crostab qry - Too many crosstab column headers
Hello I guess not, but is there a way to reduce/split up a MS-access crosstab query resulting in more than 256 cols. by using sqlGetResults in RODBC to e.g. produce several dataframes of < 256 columns (that is without changing the query itself). --- [1] "[RODBC] ERROR: Could not SQLExecDirect" [2] "S1001 -1040 [Microsoft][ODBC Microsoft Access Driver] Too many crosstab column headers (2270)." R - 2.3 WinXp with Ms access 2002 Best Regards Anders __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] repeating values
Hello I have 2 two vectors like x N 2 3 4 1 5 2 and want to make a new vector x 2 2 2 4 5 5 i.e. repeat the values in x according to N Thanks for your help. Best Regards Anders __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] find position to last number in a vector
Hello Is there a function to extract the position (i.e. row number or more desirable the value from another column with the same rownumber ) of last number in a vector? This is done in a loop with 1000s of columns. e.g. vector/column.n: na,na,10,na,2,na,na,1,na,na fixed column:10,20,30,40,50,60,70,80,85,100 result: 8 and/or 80 Thanks... Best Regards Anders __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] filter data set unique, duplicate..
Hello First, thanks for the help for an earlier question about error handling! I have problem filtering a dataset. I'm trying to filter the data in the y columns based on the values in the x column, e.g.: x y1y2yn 1.0 1 NA 3 2.0 1 NA 11 2.0 2 NA NA 3.0 1 5 16 3.0 7 5 2 4.0 8 4 1 and want to keep the highest y if x is identical, like this: x y1y2yn 1.0 1 NA 3 2.0 2 NA 11 3.0 7 5 16 4.0 8 4 1 or just as good: x y1y2yn 1.01 NA 3 2.0 NA*NA NA 2.0 2 NA 11 3.0 NA*5 16 3.0 7 NA*NA* 4.0 8 4 1 If any has any suggestions or pointers how to do this I would really appreciate it. /Anders __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] filtering a dataset, loop,unique duplicate?
__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] catching errors in a loop
Hello I can't figure out how to handle errors in R. I have a loop, e.g. for (i in 2:n) { . fit <- nls(model), start=list if any type of error occur write i to a text file . } I putted try around the nls-expression and this let me run through the loop without R stopping (which I want because each loop takes some time so I do not want it to stop), but I also want to capture the variable when an error occur. Appreciate any help /Anders - - - - - - - - - - - - - - - - - - - I tried to use: **options(error=write(variable.names(matrix[i]), file="..\\error.txt",append = TRUE)), hoping this made R write to the text file every time an error occurred (but this made R write all is in the loop to the text file). **tryCatch(<- nls(model), start=list ), finally =write( ) also writes to a text file but not necessary when there is an error. **if (Parameter>x errorM=9 else errorM =0 works but I want to capture any type of error. - - - - - - - - - - - - - - - - - __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html